summaryrefslogtreecommitdiff
path: root/pyflakes/test/test_type_annotations.py
diff options
context:
space:
mode:
authorAnthony Sottile <asottile@umich.edu>2023-01-31 13:45:58 -0500
committerGitHub <noreply@github.com>2023-01-31 13:45:58 -0500
commite19886e583637a7e2eec428cc036094b9630f2d0 (patch)
tree5dad34e1dc3321b34c28339e175e02c8fbde6306 /pyflakes/test/test_type_annotations.py
parente9324649874a7124a08c3826d4cf78a4dc3aa32c (diff)
downloadpyflakes-e19886e583637a7e2eec428cc036094b9630f2d0.tar.gz
fix accessed global annotation being redefined in a local scope (#765)
Diffstat (limited to 'pyflakes/test/test_type_annotations.py')
-rw-r--r--pyflakes/test/test_type_annotations.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/pyflakes/test/test_type_annotations.py b/pyflakes/test/test_type_annotations.py
index f0fd3b9..396d676 100644
--- a/pyflakes/test/test_type_annotations.py
+++ b/pyflakes/test/test_type_annotations.py
@@ -367,6 +367,13 @@ class TestTypeAnnotations(TestCase):
x = 3
''', m.UnusedVariable)
+ def test_unused_annotation_in_outer_scope_reassigned_in_local_scope(self):
+ self.flakes('''
+ x: int
+ x.__dict__
+ def f(): x = 1
+ ''', m.UndefinedName, m.UnusedVariable)
+
def test_unassigned_annotation_is_undefined(self):
self.flakes('''
name: str