summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pyflakes/test/test_other.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/pyflakes/test/test_other.py b/pyflakes/test/test_other.py
index d3de9c1..367c4b3 100644
--- a/pyflakes/test/test_other.py
+++ b/pyflakes/test/test_other.py
@@ -534,6 +534,18 @@ class TestUnusedAssignment(TestCase):
b = 2
''', m.UnusedVariable)
+ def test_variableUsedInLoop(self):
+ """
+ Shadowing a used variable cannot raise an UnusedVariable warning in the
+ context of a loop.
+ """
+ self.flakes('''
+ def a():
+ b = True
+ while b:
+ b = False
+ ''')
+
def test_assignToGlobal(self):
"""
Assigning to a global and then not using that global is perfectly