summaryrefslogtreecommitdiff
path: root/tests/functional/e/exception_is_binary_op.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/functional/e/exception_is_binary_op.py')
-rw-r--r--tests/functional/e/exception_is_binary_op.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/functional/e/exception_is_binary_op.py b/tests/functional/e/exception_is_binary_op.py
new file mode 100644
index 000000000..f71163d1f
--- /dev/null
+++ b/tests/functional/e/exception_is_binary_op.py
@@ -0,0 +1,12 @@
+"""Warn about binary operations used as exceptions."""
+from __future__ import print_function
+try:
+ pass
+except Exception or BaseException: # [binary-op-exception]
+ print("caught1")
+except Exception and BaseException: # [binary-op-exception]
+ print("caught2")
+except Exception or BaseException: # [binary-op-exception]
+ print("caught3")
+except (Exception or BaseException) as exc: # [binary-op-exception]
+ print("caught4")