summaryrefslogtreecommitdiff
path: root/tests/functional/n/not_in_loop.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/functional/n/not_in_loop.py')
-rw-r--r--tests/functional/n/not_in_loop.py55
1 files changed, 55 insertions, 0 deletions
diff --git a/tests/functional/n/not_in_loop.py b/tests/functional/n/not_in_loop.py
new file mode 100644
index 000000000..f7319eef7
--- /dev/null
+++ b/tests/functional/n/not_in_loop.py
@@ -0,0 +1,55 @@
+"""Test that not-in-loop is detected properly."""
+# pylint: disable=missing-docstring, invalid-name, too-few-public-methods
+# pylint: disable=useless-else-on-loop, using-constant-test, useless-object-inheritance
+# pylint: disable=no-else-continue
+
+while True:
+ def ala():
+ continue # [not-in-loop]
+
+while True:
+ pass
+else:
+ continue # [not-in-loop]
+
+def lala():
+ continue # [not-in-loop]
+
+while True:
+ class A(object):
+ continue # [not-in-loop]
+
+for _ in range(10):
+ pass
+else:
+ continue # [not-in-loop]
+
+for _ in range(42):
+ pass
+else:
+ break # [not-in-loop]
+
+if True:
+ continue # [not-in-loop]
+else:
+ break # [not-in-loop]
+
+for _ in range(10):
+ for _ in range(20):
+ pass
+ else:
+ continue
+
+while True:
+ while True:
+ break
+ else:
+ break
+ break
+else:
+ pass
+
+for _ in range(1):
+ continue
+for _ in range(42):
+ break