Skip to content

Commit f29ec5c

Browse files
DeinAlptraumsmallp-o-p
authored andcommitted
[libclang/python/tests] Remove unused variables (llvm#114397)
Remove all occurrences of unused varialbes in the python bindings tests. Use `_` to ignore unused values in tuple unpacking expressions.
1 parent b276170 commit f29ec5c

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

clang/bindings/python/tests/cindex/test_cdb.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def test_create_fail(self):
3131
with open(os.devnull, "wb") as null:
3232
os.dup2(null.fileno(), 2)
3333
with self.assertRaises(CompilationDatabaseError) as cm:
34-
cdb = CompilationDatabase.fromDirectory(path)
34+
CompilationDatabase.fromDirectory(path)
3535
os.dup2(stderr, 2)
3636
os.close(stderr)
3737

@@ -40,7 +40,7 @@ def test_create_fail(self):
4040

4141
def test_create(self):
4242
"""Check we can load a compilation database"""
43-
cdb = CompilationDatabase.fromDirectory(kInputsDir)
43+
CompilationDatabase.fromDirectory(kInputsDir)
4444

4545
def test_lookup_succeed(self):
4646
"""Check we get some results if the file exists in the db"""
@@ -175,7 +175,7 @@ def test_compilationDB_references(self):
175175
cmds = cdb.getCompileCommands("/home/john.doe/MyProject/project.cpp")
176176
del cdb
177177
gc.collect()
178-
workingdir = cmds[0].directory
178+
cmds[0].directory
179179

180180
def test_compilationCommands_references(self):
181181
"""Ensure CompilationsCommand keeps a reference to CompilationCommands"""
@@ -185,4 +185,4 @@ def test_compilationCommands_references(self):
185185
cmd0 = cmds[0]
186186
del cmds
187187
gc.collect()
188-
workingdir = cmd0.directory
188+
cmd0.directory

clang/bindings/python/tests/cindex/test_cursor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def test_references(self):
170170
self.assertIsInstance(cursor.translation_unit, TranslationUnit)
171171

172172
# If the TU was destroyed, this should cause a segfault.
173-
parent = cursor.semantic_parent
173+
cursor.semantic_parent
174174

175175
def test_canonical(self):
176176
source = "struct X; struct X; struct X { int member; };"

clang/bindings/python/tests/cindex/test_index.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
class TestIndex(unittest.TestCase):
1616
def test_create(self):
17-
index = Index.create()
17+
Index.create()
1818

1919
# FIXME: test Index.read
2020

clang/bindings/python/tests/cindex/test_type.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def test_references(self):
138138
self.assertIsInstance(t.translation_unit, TranslationUnit)
139139

140140
# If the TU was destroyed, this should cause a segfault.
141-
decl = t.get_declaration()
141+
t.get_declaration()
142142

143143
def testConstantArray(self):
144144
tu = get_tu(constarrayInput)
@@ -459,8 +459,8 @@ def test_offset(self):
459459
(["-target", "i386-pc-win32"], (8, 16, 0, 32, 64, 96)),
460460
(["-target", "msp430-none-none"], (2, 14, 0, 32, 64, 96)),
461461
]
462-
for flags, values in tries:
463-
align, total, f1, bariton, foo, bar = values
462+
for _, values in tries:
463+
_, _, f1, bariton, foo, bar = values
464464
tu = get_tu(source)
465465
teststruct = get_cursor(tu, "Test")
466466
children = list(teststruct.get_children())

0 commit comments

Comments
 (0)