summaryrefslogtreecommitdiff
path: root/pylint/test/extensions
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2016-07-18 09:43:03 +0300
committerClaudiu Popa <pcmanticore@gmail.com>2016-07-18 09:43:39 +0300
commitd422f976d80ca5505527b231014e3ee4091b9052 (patch)
treea8e884d6670025babbefb6d27a917961450cb78d /pylint/test/extensions
parentaad5ed6b519d9c8a941182bcd44fef992e193553 (diff)
downloadpylint-git-d422f976d80ca5505527b231014e3ee4091b9052.tar.gz
Make sure that only exception instances or classes are processed.
Diffstat (limited to 'pylint/test/extensions')
-rw-r--r--pylint/test/extensions/test_check_raise_docs.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/pylint/test/extensions/test_check_raise_docs.py b/pylint/test/extensions/test_check_raise_docs.py
index b0635d2ae..3cb3d9cf3 100644
--- a/pylint/test/extensions/test_check_raise_docs.py
+++ b/pylint/test/extensions/test_check_raise_docs.py
@@ -428,6 +428,38 @@ class DocstringCheckerRaiseTest(CheckerTestCase):
# we do NOT expect a warning about the OSError in inner_func!
self.checker.visit_raise(raise_node)
+ def test_ignores_returns_use_only_names(self):
+ raise_node = astroid.extract_node('''
+ def myfunc():
+ """This is a docstring
+
+ :raises NameError: Never
+ """
+ def inner_func():
+ return 42
+
+ raise inner_func() #@
+ ''')
+ with self.assertNoMessages():
+ self.checker.visit_raise(raise_node)
+
+ def test_ignores_returns_use_only_exception_instances(self):
+ raise_node = astroid.extract_node('''
+ def myfunc():
+ """This is a docstring
+
+ :raises MyException: Never
+ """
+ class MyException(Exception):
+ pass
+ def inner_func():
+ return MyException
+
+ raise inner_func() #@
+ ''')
+ with self.assertNoMessages():
+ self.checker.visit_raise(raise_node)
+
if __name__ == '__main__':
unittest.main()