diff options
| author | Ashley Whetter <ashley@awhetter.co.uk> | 2019-10-16 22:46:08 -0700 |
|---|---|---|
| committer | Claudiu Popa <pcmanticore@gmail.com> | 2019-10-17 09:08:05 +0200 |
| commit | 183dcc4cb134d3dab2696e2d28c51c5a3577e358 (patch) | |
| tree | 3b7fa7f7a6597fa8956a0d9f2f0428d116eb07a1 /tests/extensions/test_check_raise_docs.py | |
| parent | e1f8fdef9d5438701e852f285f0ac537203881e6 (diff) | |
| download | pylint-git-183dcc4cb134d3dab2696e2d28c51c5a3577e358.tar.gz | |
docparams can identify multiple types in raises sections
Closes #2729
Diffstat (limited to 'tests/extensions/test_check_raise_docs.py')
| -rw-r--r-- | tests/extensions/test_check_raise_docs.py | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/tests/extensions/test_check_raise_docs.py b/tests/extensions/test_check_raise_docs.py index f69c9c131..a95ccca0d 100644 --- a/tests/extensions/test_check_raise_docs.py +++ b/tests/extensions/test_check_raise_docs.py @@ -110,7 +110,6 @@ class TestDocstringCheckerRaise(CheckerTestCase): ) with self.assertNoMessages(): self.checker.visit_raise(raise_node) - pass def test_find_google_attr_raises_substr_exc(self): raise_node = astroid.extract_node( @@ -295,6 +294,43 @@ class TestDocstringCheckerRaise(CheckerTestCase): with self.assertNoMessages(): self.checker.visit_raise(raise_node) + def test_find_multiple_sphinx_raises(self): + raise_node = astroid.extract_node( + ''' + def my_func(self): + """This is a docstring. + + :raises RuntimeError: Always + :raises NameError, OSError, ValueError: Never + """ + raise RuntimeError('hi') + raise NameError('hi') #@ + raise OSError(2, 'abort!') + raise ValueError('foo') + ''' + ) + with self.assertNoMessages(): + self.checker.visit_raise(raise_node) + + def test_find_multiple_google_raises(self): + raise_node = astroid.extract_node( + ''' + def my_func(self): + """This is a docstring. + + Raises: + RuntimeError: Always + NameError, OSError, ValueError: Never + """ + raise RuntimeError('hi') + raise NameError('hi') #@ + raise OSError(2, 'abort!') + raise ValueError('foo') + ''' + ) + with self.assertNoMessages(): + self.checker.visit_raise(raise_node) + def test_finds_rethrown_sphinx_raises(self): raise_node = astroid.extract_node( ''' |
