summaryrefslogtreecommitdiff
path: root/pylint/test/input/func_bad_exception_context_py30.py
diff options
context:
space:
mode:
Diffstat (limited to 'pylint/test/input/func_bad_exception_context_py30.py')
-rw-r--r--pylint/test/input/func_bad_exception_context_py30.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/pylint/test/input/func_bad_exception_context_py30.py b/pylint/test/input/func_bad_exception_context_py30.py
new file mode 100644
index 0000000..98b44ee
--- /dev/null
+++ b/pylint/test/input/func_bad_exception_context_py30.py
@@ -0,0 +1,24 @@
+"""Check that raise ... from .. uses a proper exception context """
+
+# pylint: disable=unreachable, import-error
+
+import socket, unknown
+
+__revision__ = 0
+
+class ExceptionSubclass(Exception):
+ """ subclass """
+
+def test():
+ """ docstring """
+ raise IndexError from 1
+ raise IndexError from None
+ raise IndexError from ZeroDivisionError
+ raise IndexError from object()
+ raise IndexError from ExceptionSubclass
+ raise IndexError from socket.error
+ raise IndexError() from None
+ raise IndexError() from ZeroDivisionError
+ raise IndexError() from ZeroDivisionError()
+ raise IndexError() from object()
+ raise IndexError() from unknown