diff options
author | Mark Byrne <31762852+mbyrnepr2@users.noreply.github.com> | 2022-11-09 21:51:29 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-09 20:51:29 +0000 |
commit | 3a89322949aaaa2b394ef1cfb6202315a8bc6591 (patch) | |
tree | 7f3f431c7352a74f26705d5eb8b06bc09d742ef6 /tests/checkers | |
parent | a0461a4546c42b4a5c25f314702fab331031048e (diff) | |
download | pylint-git-3a89322949aaaa2b394ef1cfb6202315a8bc6591.tar.gz |
Fix a false negative for ``unused-import`` (#7678)
* Fix a false negative for ``unused-import`` when a constant inside ``typing.Annotated`` was treated as a reference to an import.
* Update with Daniƫl's suggestions:
- More understandable function parameter name.
- Update function parameter type: Expect a tuple of strings.
Closes #7547
Diffstat (limited to 'tests/checkers')
-rw-r--r-- | tests/checkers/unittest_utils.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/checkers/unittest_utils.py b/tests/checkers/unittest_utils.py index 187c38c6a..08b9c188d 100644 --- a/tests/checkers/unittest_utils.py +++ b/tests/checkers/unittest_utils.py @@ -491,7 +491,7 @@ def test_deprecation_check_messages() -> None: ) -def test_is_typing_literal() -> None: +def test_is_typing_member() -> None: code = astroid.extract_node( """ from typing import Literal as Lit, Set as Literal @@ -503,9 +503,9 @@ def test_is_typing_literal() -> None: """ ) - assert not utils.is_typing_literal(code[0]) - assert utils.is_typing_literal(code[1]) - assert utils.is_typing_literal(code[2]) + assert not utils.is_typing_member(code[0], ("Literal",)) + assert utils.is_typing_member(code[1], ("Literal",)) + assert utils.is_typing_member(code[2], ("Literal",)) code = astroid.extract_node( """ @@ -513,5 +513,5 @@ def test_is_typing_literal() -> None: typing.Literal #@ """ ) - assert not utils.is_typing_literal(code[0]) - assert not utils.is_typing_literal(code[1]) + assert not utils.is_typing_member(code[0], ("Literal",)) + assert not utils.is_typing_member(code[1], ("Literal",)) |