diff options
author | Angus L'Herrou <piraka@brandeis.edu> | 2021-10-05 18:44:29 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-05 18:44:29 -0400 |
commit | 13cad915e6b181b2f6a85efc2ead4856b23bccc0 (patch) | |
tree | 0b7346048016eef7168a1a95b1b851ccf649279a /pyflakes/test/test_type_annotations.py | |
parent | cf75971656d9a04faa1b5aeaeb776da3567b8041 (diff) | |
download | pyflakes-13cad915e6b181b2f6a85efc2ead4856b23bccc0.tar.gz |
Detect typing module attributes with 'import typing as <name>' (#632)
* added functionality to detect typing module attributes with 'import typing as <name>'
* remove async keyword from test_aliased_import
Diffstat (limited to 'pyflakes/test/test_type_annotations.py')
-rw-r--r-- | pyflakes/test/test_type_annotations.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/pyflakes/test/test_type_annotations.py b/pyflakes/test/test_type_annotations.py index 6a66bcd..f3b6c24 100644 --- a/pyflakes/test/test_type_annotations.py +++ b/pyflakes/test/test_type_annotations.py @@ -121,6 +121,23 @@ class TestTypeAnnotations(TestCase): def f(self, x): return x """) + def test_aliased_import(self): + """Detect when typing is imported as another name""" + self.flakes(""" + import typing as t + + @t.overload + def f(s): # type: (None) -> None + pass + + @t.overload + def f(s): # type: (int) -> int + pass + + def f(s): + return s + """) + def test_not_a_typing_overload(self): """regression test for @typing.overload detection bug in 2.1.0""" self.flakes(""" |