summaryrefslogtreecommitdiff
path: root/pylint/test/functional/too_many_branches.py
diff options
context:
space:
mode:
Diffstat (limited to 'pylint/test/functional/too_many_branches.py')
-rw-r--r--pylint/test/functional/too_many_branches.py69
1 files changed, 69 insertions, 0 deletions
diff --git a/pylint/test/functional/too_many_branches.py b/pylint/test/functional/too_many_branches.py
new file mode 100644
index 0000000..54428fd
--- /dev/null
+++ b/pylint/test/functional/too_many_branches.py
@@ -0,0 +1,69 @@
+""" Test for too many branches. """
+
+def wrong(): # [too-many-branches]
+ """ Has too many branches. """
+ if 1:
+ pass
+ elif 1:
+ pass
+ elif 1:
+ pass
+ elif 1:
+ pass
+ elif 1:
+ pass
+ elif 1:
+ pass
+ try:
+ pass
+ finally:
+ pass
+ if 2:
+ pass
+ while True:
+ pass
+ if 1:
+ pass
+ elif 2:
+ pass
+ elif 3:
+ pass
+
+def good():
+ """ Too many branches only if we take
+ into consideration the nested functions.
+ """
+ def nested_1():
+ """ empty """
+ if 1:
+ pass
+ elif 2:
+ pass
+ elif 3:
+ pass
+ elif 4:
+ pass
+
+ nested_1()
+ try:
+ pass
+ finally:
+ pass
+ try:
+ pass
+ finally:
+ pass
+ if 1:
+ pass
+ elif 2:
+ pass
+ elif 3:
+ pass
+ elif 4:
+ pass
+ elif 5:
+ pass
+ elif 6:
+ pass
+ elif 7:
+ pass