summaryrefslogtreecommitdiff
path: root/pylint/test/functional/undefined_loop_variable.py
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2016-07-24 11:21:49 +0300
committerClaudiu Popa <pcmanticore@gmail.com>2016-07-24 12:01:59 +0300
commit67be95a25da3c720e449864ea61db4cb1dd91a81 (patch)
treecb5210513316be408fbdd7ebf7a4ce6885f73e62 /pylint/test/functional/undefined_loop_variable.py
parent6ece3046d3fe08f357796f869a830b976e5cc5cc (diff)
downloadpylint-git-67be95a25da3c720e449864ea61db4cb1dd91a81.tar.gz
Move more tests to the new format.
Diffstat (limited to 'pylint/test/functional/undefined_loop_variable.py')
-rw-r--r--pylint/test/functional/undefined_loop_variable.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/pylint/test/functional/undefined_loop_variable.py b/pylint/test/functional/undefined_loop_variable.py
new file mode 100644
index 000000000..6c28a4088
--- /dev/null
+++ b/pylint/test/functional/undefined_loop_variable.py
@@ -0,0 +1,37 @@
+# pylint: disable=missing-docstring
+
+def do_stuff(some_random_list):
+ for var in some_random_list:
+ pass
+ return var # [undefined-loop-variable]
+
+
+def do_else(some_random_list):
+ for var in some_random_list:
+ if var == 42:
+ break
+ else:
+ var = 84
+ return var
+
+__revision__ = 'yo'
+
+TEST_LC = [C for C in __revision__ if C.isalpha()]
+B = [B for B in __revision__ if B.isalpha()]
+VAR2 = B # nor this one
+
+for var1, var2 in TEST_LC:
+ var1 = var2 + 4
+VAR3 = var1 # [undefined-loop-variable]
+
+for note in __revision__:
+ note.something()
+for line in __revision__:
+ for note in line:
+ A = note.anotherthing()
+
+
+for x in []:
+ pass
+for x in range(3):
+ VAR5 = (lambda: x)()