diff options
author | Adam Dangoor <adamdangoor@gmail.com> | 2018-05-16 01:21:23 +0100 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2018-05-16 16:42:06 -0400 |
commit | 50f44f3ecefb84a42d271376451511d57d036a11 (patch) | |
tree | f3a639604d961d193d31ce7582d89c5674620eb1 | |
parent | 2a317ecf523cf1a1cbcf01c56e968e559207182a (diff) | |
download | pylint-git-50f44f3ecefb84a42d271376451511d57d036a11.tar.gz |
Fix an error which occurred when using the docparams extension and documenting a NotImplementedError.
-rw-r--r-- | CONTRIBUTORS.txt | 2 | ||||
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | pylint/extensions/docparams.py | 2 | ||||
-rw-r--r-- | pylint/test/extensions/test_check_raise_docs.py | 12 |
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 @@ -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) |