diff options
author | Daniƫl van Noord <13665637+DanielNoord@users.noreply.github.com> | 2021-09-04 18:52:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-04 18:52:55 +0200 |
commit | 25000863761220c1aa5db129e3cd41f5fe51b167 (patch) | |
tree | d211e4464a8aef25f969adffe7ba7cb6df8b8981 /tests/utils/unittest_ast_walker.py | |
parent | 6c818310fd0e2396b6333ad623da577bf84e361e (diff) | |
download | pylint-git-25000863761220c1aa5db129e3cd41f5fe51b167.tar.gz |
Add typing with `PyAnnotate` to `./tests` (#4950)
* Add mypy_extensions to requirement for ``NoReturn``
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
Diffstat (limited to 'tests/utils/unittest_ast_walker.py')
-rw-r--r-- | tests/utils/unittest_ast_walker.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/tests/utils/unittest_ast_walker.py b/tests/utils/unittest_ast_walker.py index 364b35a35..9d350830a 100644 --- a/tests/utils/unittest_ast_walker.py +++ b/tests/utils/unittest_ast_walker.py @@ -2,6 +2,7 @@ # For details: https://github.com/PyCQA/pylint/blob/main/LICENSE import warnings +from typing import Dict, Set import astroid @@ -11,15 +12,15 @@ from pylint.utils import ASTWalker class TestASTWalker: class MockLinter: - def __init__(self, msgs): + def __init__(self, msgs: Dict[str, bool]) -> None: self._msgs = msgs - def is_message_enabled(self, msgid): + def is_message_enabled(self, msgid: str) -> bool: return self._msgs.get(msgid, True) class Checker: - def __init__(self): - self.called = set() + def __init__(self) -> None: + self.called: Set[str] = set() @check_messages("first-message") def visit_module(self, module): # pylint: disable=unused-argument @@ -37,7 +38,7 @@ class TestASTWalker: def leave_assignname(self, module): raise NotImplementedError - def test_check_messages(self): + def test_check_messages(self) -> None: linter = self.MockLinter( {"first-message": True, "second-message": False, "third-message": True} ) @@ -47,9 +48,9 @@ class TestASTWalker: walker.walk(astroid.parse("x = func()")) assert {"module", "assignname"} == checker.called - def test_deprecated_methods(self): + def test_deprecated_methods(self) -> None: class Checker: - def __init__(self): + def __init__(self) -> None: self.called = False @check_messages("first-message") |