summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Dangoor <adamdangoor@gmail.com>2018-05-16 01:21:23 +0100
committerClaudiu Popa <pcmanticore@gmail.com>2018-05-16 16:42:06 -0400
commit50f44f3ecefb84a42d271376451511d57d036a11 (patch)
treef3a639604d961d193d31ce7582d89c5674620eb1
parent2a317ecf523cf1a1cbcf01c56e968e559207182a (diff)
downloadpylint-git-50f44f3ecefb84a42d271376451511d57d036a11.tar.gz
Fix an error which occurred when using the docparams extension and documenting a NotImplementedError.
-rw-r--r--CONTRIBUTORS.txt2
-rw-r--r--ChangeLog3
-rw-r--r--pylint/extensions/docparams.py2
-rw-r--r--pylint/test/extensions/test_check_raise_docs.py12
4 files changed, 18 insertions, 1 deletions
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
index b26c5a902..16a4d6b51 100644
--- a/CONTRIBUTORS.txt
+++ b/CONTRIBUTORS.txt
@@ -187,3 +187,5 @@ Order doesn't matter (not that much, at least ;)
* Mariatta Wijaya: contributor
Added new check `logging-fstring-interpolation`
Documentation typo fixes
+
+* Adam Dangoor: contributor
diff --git a/ChangeLog b/ChangeLog
index f0602ed0c..66208051f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -223,6 +223,9 @@ Release date: |TBA|
* Updated the default report format to include paths that can be clicked on in some terminals (e.g. iTerm).
+ * Fix `KeyError` raised when using docparams and NotImplementedError is documented.
+
+ Fixes #2102
What's New in Pylint 1.9?
=========================
diff --git a/pylint/extensions/docparams.py b/pylint/extensions/docparams.py
index b0f0f0bc7..a86444cd0 100644
--- a/pylint/extensions/docparams.py
+++ b/pylint/extensions/docparams.py
@@ -213,7 +213,7 @@ class DocstringParameterChecker(BaseChecker):
return
found_excs = doc.exceptions()
- missing_excs = expected_excs - found_excs
+ missing_excs = list(expected_excs - found_excs)
self._add_raise_message(missing_excs, func_node)
def visit_return(self, node):
diff --git a/pylint/test/extensions/test_check_raise_docs.py b/pylint/test/extensions/test_check_raise_docs.py
index 24d380750..aaaca98ff 100644
--- a/pylint/test/extensions/test_check_raise_docs.py
+++ b/pylint/test/extensions/test_check_raise_docs.py
@@ -515,3 +515,15 @@ class TestDocstringCheckerRaise(CheckerTestCase):
''')
with self.assertNoMessages():
self.checker.visit_raise(raise_node)
+
+ def test_no_error_notimplemented_documented(self):
+ raise_node = astroid.extract_node('''
+ def my_func():
+ """
+ Raises:
+ NotImplementedError: When called.
+ """
+ raise NotImplementedError #@
+ ''')
+ with self.assertNoMessages():
+ self.checker.visit_raise(raise_node)