summaryrefslogtreecommitdiff
path: root/tests/functional/bad_except_order.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/functional/bad_except_order.py')
-rw-r--r--tests/functional/bad_except_order.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/functional/bad_except_order.py b/tests/functional/bad_except_order.py
new file mode 100644
index 000000000..4f2fa3ea8
--- /dev/null
+++ b/tests/functional/bad_except_order.py
@@ -0,0 +1,45 @@
+# pylint: disable=missing-docstring, bare-except, broad-except
+
+__revision__ = 1
+
+try:
+ __revision__ += 1
+except Exception:
+ __revision__ = 0
+except TypeError: # [bad-except-order]
+ __revision__ = 0
+
+try:
+ __revision__ += 1
+except LookupError:
+ __revision__ = 0
+except IndexError: # [bad-except-order]
+ __revision__ = 0
+
+try:
+ __revision__ += 1
+except (LookupError, NameError):
+ __revision__ = 0
+except (IndexError, UnboundLocalError): # [bad-except-order, bad-except-order]
+ __revision__ = 0
+
+try: # [bad-except-order]
+ __revision__ += 1
+except:
+ pass
+except Exception:
+ pass
+
+try:
+ __revision__ += 1
+except TypeError:
+ __revision__ = 0
+except:
+ __revision__ = 0
+
+try:
+ __revision__ += 1
+except Exception:
+ pass
+except:
+ pass