Skip to content

Commit

Permalink
test: Add test for issue PyCQA#428
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanaasagi committed Sep 4, 2019
1 parent 96e0da8 commit 2d07acf
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions pyflakes/test/test_undefined_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,33 @@ def _worker():
o = False
''')

def test_delFunctionScope(self):
"""
Global names should not be seen if there are same names
defined in function.
"""
self.flakes('''
a = 1
def func():
a = 2
del a
a
''', m.UndefinedName)

def test_delMethodScope(self):
"""
Global names should not be seen if there are same names
defined in method.
"""
self.flakes('''
a = 1
class A(object):
def method(self):
a = 2
del a
a
''', m.UndefinedName)

def test_globalFromNestedScope(self):
"""Global names are available from nested scopes."""
self.flakes('''
Expand Down

0 comments on commit 2d07acf

Please sign in to comment.