diff options
author | ryneeverett <ryneeverett@gmail.com> | 2015-08-14 10:19:19 -0400 |
---|---|---|
committer | ryneeverett <ryneeverett@gmail.com> | 2015-08-14 10:19:19 -0400 |
commit | c9bae487f8d65f13a545bc03c12cb60952d10936 (patch) | |
tree | c98c5d68ea1792bb67bc66a5f98d4e766027b0d7 | |
parent | b8a5841d9f4c47bd6fecf1473612587b3df0e301 (diff) | |
download | pyflakes-c9bae487f8d65f13a545bc03c12cb60952d10936.tar.gz |
Test that used variable in loop is considered used
-rw-r--r-- | pyflakes/test/test_other.py | 12 |
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 |