Skip to content

Commit c02f508

Browse files
committed
Add a test for type comments as well.
1 parent b43ef07 commit c02f508

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pyflakes/test/test_imports.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,6 +1069,18 @@ def f() -> "b":
10691069
pass
10701070
''')
10711071

1072+
def test_uses_typing_imports_for_annotations_in_comments(self):
1073+
"""Uses imports within 'if TYPE_CHECKING' checking annotations."""
1074+
if self.withDoctest:
1075+
return
1076+
self.flakes('''
1077+
from typing import TYPE_CHECKING
1078+
if TYPE_CHECKING:
1079+
from a import b
1080+
def f(): # type: () -> b
1081+
pass
1082+
''')
1083+
10721084

10731085
class TestSpecialAll(TestCase):
10741086
"""

0 commit comments

Comments
 (0)