Skip to content

Commit c9bae48

Browse files
committed
Test that used variable in loop is considered used
1 parent b8a5841 commit c9bae48

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pyflakes/test/test_other.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,18 @@ def a():
534534
b = 2
535535
''', m.UnusedVariable)
536536

537+
def test_variableUsedInLoop(self):
538+
"""
539+
Shadowing a used variable cannot raise an UnusedVariable warning in the
540+
context of a loop.
541+
"""
542+
self.flakes('''
543+
def a():
544+
b = True
545+
while b:
546+
b = False
547+
''')
548+
537549
def test_assignToGlobal(self):
538550
"""
539551
Assigning to a global and then not using that global is perfectly

0 commit comments

Comments
 (0)