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.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/pyflakes/test/test_type_annotations.py b/pyflakes/test/test_type_annotations.py
index d881205..2ad9f45 100644
--- a/pyflakes/test/test_type_annotations.py
+++ b/pyflakes/test/test_type_annotations.py
@@ -174,7 +174,7 @@ class TestTypeAnnotations(TestCase):
def f():
name: str
age: int
- ''')
+ ''', m.UnusedAnnotation, m.UnusedAnnotation)
self.flakes('''
def f():
name: str = 'Bob'
@@ -190,7 +190,7 @@ class TestTypeAnnotations(TestCase):
from typing import Any
def f():
a: Any
- ''')
+ ''', m.UnusedAnnotation)
self.flakes('''
foo: not_a_real_type
''', m.UndefinedName)
@@ -356,11 +356,10 @@ class TestTypeAnnotations(TestCase):
class Cls:
y: int
''')
- # TODO: this should print a UnusedVariable message
self.flakes('''
def f():
x: int
- ''')
+ ''', m.UnusedAnnotation)
# This should only print one UnusedVariable message
self.flakes('''
def f():
@@ -368,6 +367,12 @@ class TestTypeAnnotations(TestCase):
x = 3
''', m.UnusedVariable)
+ def test_unassigned_annotation_is_undefined(self):
+ self.flakes('''
+ name: str
+ print(name)
+ ''', m.UndefinedName)
+
def test_annotated_async_def(self):
self.flakes('''
class c: pass