summaryrefslogtreecommitdiff
path: root/pyflakes/test/test_type_annotations.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyflakes/test/test_type_annotations.py')
-rw-r--r--pyflakes/test/test_type_annotations.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/pyflakes/test/test_type_annotations.py b/pyflakes/test/test_type_annotations.py
index f3b6c24..3b6d5e7 100644
--- a/pyflakes/test/test_type_annotations.py
+++ b/pyflakes/test/test_type_annotations.py
@@ -301,6 +301,46 @@ class TestTypeAnnotations(TestCase):
''', m.ForwardAnnotationSyntaxError)
@skipIf(version_info < (3, 6), 'new in Python 3.6')
+ def test_TypeAlias_annotations(self):
+ self.flakes("""
+ from typing_extensions import TypeAlias
+ from foo import Bar
+
+ bar: TypeAlias = Bar
+ """)
+ self.flakes("""
+ from typing_extensions import TypeAlias
+ from foo import Bar
+
+ bar: TypeAlias = 'Bar'
+ """)
+ self.flakes("""
+ from typing_extensions import TypeAlias
+ from foo import Bar
+
+ class A:
+ bar: TypeAlias = Bar
+ """)
+ self.flakes("""
+ from typing_extensions import TypeAlias
+ from foo import Bar
+
+ class A:
+ bar: TypeAlias = 'Bar'
+ """)
+ self.flakes("""
+ from typing_extensions import TypeAlias
+
+ bar: TypeAlias
+ """)
+ self.flakes("""
+ from typing_extensions import TypeAlias
+ from foo import Bar
+
+ bar: TypeAlias
+ """, m.UnusedImport)
+
+ @skipIf(version_info < (3, 6), 'new in Python 3.6')
def test_annotating_an_import(self):
self.flakes('''
from a import b, c