diff options
Diffstat (limited to 'tests/functional/b/bad_exception_context.py')
| -rw-r--r-- | tests/functional/b/bad_exception_context.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/functional/b/bad_exception_context.py b/tests/functional/b/bad_exception_context.py new file mode 100644 index 000000000..af3e4fb9f --- /dev/null +++ b/tests/functional/b/bad_exception_context.py @@ -0,0 +1,24 @@ +"""Check that raise ... from .. uses a proper exception context """ + +# pylint: disable=unreachable, import-error, multiple-imports + +import socket, unknown + +__revision__ = 0 + +class ExceptionSubclass(Exception): + """ subclass """ + +def test(): + """ docstring """ + raise IndexError from 1 # [bad-exception-context] + raise IndexError from None + raise IndexError from ZeroDivisionError + raise IndexError from object() # [bad-exception-context] + 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() # [bad-exception-context] + raise IndexError() from unknown |
