diff options
| author | cpopa <devnull@localhost> | 2013-12-28 15:14:03 +0200 |
|---|---|---|
| committer | cpopa <devnull@localhost> | 2013-12-28 15:14:03 +0200 |
| commit | 74796a1eb4a79fc2f85e3208e74945b7a2db9af4 (patch) | |
| tree | 0cc032a0e9a54a7185660155a572deefff833633 /test | |
| parent | 3927b761d923c9d8d32290c5a694acda9083480b (diff) | |
| download | pylint-74796a1eb4a79fc2f85e3208e74945b7a2db9af4.tar.gz | |
Add bad-exception-context warning for checking that `raise ... from ...` sets a proper exception context.
Diffstat (limited to 'test')
| -rw-r--r-- | test/input/func_bad_exception_context_py30.py | 17 | ||||
| -rw-r--r-- | test/messages/func_bad_exception_context_py30.txt | 2 |
2 files changed, 19 insertions, 0 deletions
diff --git a/test/input/func_bad_exception_context_py30.py b/test/input/func_bad_exception_context_py30.py new file mode 100644 index 0000000..b520e68 --- /dev/null +++ b/test/input/func_bad_exception_context_py30.py @@ -0,0 +1,17 @@ +"""Check that raise ... from .. uses a proper exception context """ + +# pylint: disable=unreachable + +__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 + diff --git a/test/messages/func_bad_exception_context_py30.txt b/test/messages/func_bad_exception_context_py30.txt new file mode 100644 index 0000000..0a4b3ec --- /dev/null +++ b/test/messages/func_bad_exception_context_py30.txt @@ -0,0 +1,2 @@ +E: 12:test: Exception context set to something which is not an exception, nor None
+E: 15:test: Exception context set to something which is not an exception, nor None
\ No newline at end of file |
