-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[libclang/python/tests] Remove unused variables #114397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@llvm/pr-subscribers-clang Author: Jannick Kremer (DeinAlptraum) ChangesRemove all occurrences of unused varialbes in the python bindings tests. Full diff: https://github.com/llvm/llvm-project/pull/114397.diff 4 Files Affected:
diff --git a/clang/bindings/python/tests/cindex/test_cdb.py b/clang/bindings/python/tests/cindex/test_cdb.py
index a5cc22796aa2ad..b19c2b7bf721ae 100644
--- a/clang/bindings/python/tests/cindex/test_cdb.py
+++ b/clang/bindings/python/tests/cindex/test_cdb.py
@@ -31,7 +31,7 @@ def test_create_fail(self):
with open(os.devnull, "wb") as null:
os.dup2(null.fileno(), 2)
with self.assertRaises(CompilationDatabaseError) as cm:
- cdb = CompilationDatabase.fromDirectory(path)
+ CompilationDatabase.fromDirectory(path)
os.dup2(stderr, 2)
os.close(stderr)
@@ -40,7 +40,7 @@ def test_create_fail(self):
def test_create(self):
"""Check we can load a compilation database"""
- cdb = CompilationDatabase.fromDirectory(kInputsDir)
+ CompilationDatabase.fromDirectory(kInputsDir)
def test_lookup_succeed(self):
"""Check we get some results if the file exists in the db"""
@@ -175,7 +175,7 @@ def test_compilationDB_references(self):
cmds = cdb.getCompileCommands("/home/john.doe/MyProject/project.cpp")
del cdb
gc.collect()
- workingdir = cmds[0].directory
+ cmds[0].directory
def test_compilationCommands_references(self):
"""Ensure CompilationsCommand keeps a reference to CompilationCommands"""
@@ -185,4 +185,4 @@ def test_compilationCommands_references(self):
cmd0 = cmds[0]
del cmds
gc.collect()
- workingdir = cmd0.directory
+ cmd0.directory
diff --git a/clang/bindings/python/tests/cindex/test_cursor.py b/clang/bindings/python/tests/cindex/test_cursor.py
index 77d8ca415708f8..a5e159a3a309ff 100644
--- a/clang/bindings/python/tests/cindex/test_cursor.py
+++ b/clang/bindings/python/tests/cindex/test_cursor.py
@@ -170,7 +170,7 @@ def test_references(self):
self.assertIsInstance(cursor.translation_unit, TranslationUnit)
# If the TU was destroyed, this should cause a segfault.
- parent = cursor.semantic_parent
+ cursor.semantic_parent
def test_canonical(self):
source = "struct X; struct X; struct X { int member; };"
diff --git a/clang/bindings/python/tests/cindex/test_index.py b/clang/bindings/python/tests/cindex/test_index.py
index bf29628f5e4e79..72146f5f5b08b5 100644
--- a/clang/bindings/python/tests/cindex/test_index.py
+++ b/clang/bindings/python/tests/cindex/test_index.py
@@ -14,7 +14,7 @@
class TestIndex(unittest.TestCase):
def test_create(self):
- index = Index.create()
+ Index.create()
# FIXME: test Index.read
diff --git a/clang/bindings/python/tests/cindex/test_type.py b/clang/bindings/python/tests/cindex/test_type.py
index 928a9794e42133..ef6630c93bb258 100644
--- a/clang/bindings/python/tests/cindex/test_type.py
+++ b/clang/bindings/python/tests/cindex/test_type.py
@@ -138,7 +138,7 @@ def test_references(self):
self.assertIsInstance(t.translation_unit, TranslationUnit)
# If the TU was destroyed, this should cause a segfault.
- decl = t.get_declaration()
+ t.get_declaration()
def testConstantArray(self):
tu = get_tu(constarrayInput)
@@ -459,8 +459,8 @@ def test_offset(self):
(["-target", "i386-pc-win32"], (8, 16, 0, 32, 64, 96)),
(["-target", "msp430-none-none"], (2, 14, 0, 32, 64, 96)),
]
- for flags, values in tries:
- align, total, f1, bariton, foo, bar = values
+ for _, values in tries:
+ _, _, f1, bariton, foo, bar = values
tu = get_tu(source)
teststruct = get_cursor(tu, "Test")
children = list(teststruct.get_children())
|
Endilll
approved these changes
Oct 31, 2024
smallp-o-p
pushed a commit
to smallp-o-p/llvm-project
that referenced
this pull request
Nov 3, 2024
Remove all occurrences of unused varialbes in the python bindings tests. Use `_` to ignore unused values in tuple unpacking expressions.
NoumanAmir657
pushed a commit
to NoumanAmir657/llvm-project
that referenced
this pull request
Nov 4, 2024
Remove all occurrences of unused varialbes in the python bindings tests. Use `_` to ignore unused values in tuple unpacking expressions.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Remove all occurrences of unused varialbes in the python bindings tests.
Use
_
to ignore unused values in tuple unpacking expressions.