diff options
author | Daniƫl van Noord <13665637+DanielNoord@users.noreply.github.com> | 2022-09-04 13:04:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-04 13:04:45 +0200 |
commit | c2989ad5c71b3e1be0f0a7e5297f9b7e47fa2766 (patch) | |
tree | 89f867543fdf13470f0dddfc509686fe137c60a8 /tests/testutils | |
parent | cd7761d4fcdf1d6d3ad19b34a426a7033b41cc1a (diff) | |
download | pylint-git-c2989ad5c71b3e1be0f0a7e5297f9b7e47fa2766.tar.gz |
Complete typing of all generic types (#7406)
And update ``mypy`` configuration
Diffstat (limited to 'tests/testutils')
-rw-r--r-- | tests/testutils/test_output_line.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/tests/testutils/test_output_line.py b/tests/testutils/test_output_line.py index 2a21ce1fd..5b2bf1a1b 100644 --- a/tests/testutils/test_output_line.py +++ b/tests/testutils/test_output_line.py @@ -6,7 +6,7 @@ from __future__ import annotations -from collections.abc import Callable +import sys import pytest @@ -16,9 +16,19 @@ from pylint.message import Message from pylint.testutils.output_line import OutputLine from pylint.typing import MessageLocationTuple +if sys.version_info >= (3, 8): + from typing import Protocol +else: + from typing_extensions import Protocol + + +class _MessageCallable(Protocol): + def __call__(self, confidence: Confidence = HIGH) -> Message: + ... + @pytest.fixture() -def message() -> Callable: +def message() -> _MessageCallable: def inner(confidence: Confidence = HIGH) -> Message: return Message( symbol="missing-docstring", @@ -55,7 +65,7 @@ def test_output_line() -> None: assert output_line.confidence == "HIGH" -def test_output_line_from_message(message: Callable) -> None: +def test_output_line_from_message(message: _MessageCallable) -> None: """Test that the OutputLine NamedTuple is instantiated correctly with from_msg.""" expected_column = 2 if PY38_PLUS else 0 @@ -91,7 +101,7 @@ def test_output_line_from_message(message: Callable) -> None: @pytest.mark.parametrize("confidence", [HIGH, INFERENCE]) -def test_output_line_to_csv(confidence: Confidence, message: Callable) -> None: +def test_output_line_to_csv(confidence: Confidence, message: _MessageCallable) -> None: """Test that the OutputLine NamedTuple is instantiated correctly with from_msg and then converted to csv. """ |