diff options
author | kasium <15907922+kasium@users.noreply.github.com> | 2021-12-15 00:19:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-15 00:19:44 +0100 |
commit | 26c9042825a6549c9f889b2cd17b5e08ba784ab2 (patch) | |
tree | 27973a03c916fc438402e0631f5d52be1ef49ae5 /tests/extensions | |
parent | af8cc2e75018d34fbbed08d4bfa3380e80f89b4d (diff) | |
download | pylint-git-26c9042825a6549c9f889b2cd17b5e08ba784ab2.tar.gz |
Enable missing-raises-doc to understand class hierarchies (#5278)
Before, missing-raises-doc could not understand class hierarchies but just compared names.
So, when a method documented a raise of a parent class, but a child exception was raised, the check failed.
With this change, if the name compare doesn't help, the exception class hierarchy is checked.
For that, possible_exc_types was changed to return classes instead of names
Resolved #4955
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
Co-authored-by: Daniƫl van Noord <13665637+DanielNoord@users.noreply.github.com>
Diffstat (limited to 'tests/extensions')
-rw-r--r-- | tests/extensions/test_check_docs_utils.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/extensions/test_check_docs_utils.py b/tests/extensions/test_check_docs_utils.py index c1552a0c3..0414d05a4 100644 --- a/tests/extensions/test_check_docs_utils.py +++ b/tests/extensions/test_check_docs_utils.py @@ -147,5 +147,7 @@ def test_space_indentation(string: str, count: int) -> None: ], ) def test_exception(raise_node, expected): - found = utils.possible_exc_types(raise_node) - assert found == expected + found_nodes = utils.possible_exc_types(raise_node) + for node in found_nodes: + assert isinstance(node, astroid.nodes.ClassDef) + assert {node.name for node in found_nodes} == expected |