summaryrefslogtreecommitdiff
path: root/tests/testutils
diff options
context:
space:
mode:
authorDaniƫl van Noord <13665637+DanielNoord@users.noreply.github.com>2022-04-14 19:37:49 +0200
committerGitHub <noreply@github.com>2022-04-14 19:37:49 +0200
commit8f872bf49c344d1d16b3573136d53b2cbda007c6 (patch)
treed203652d9d515b2a5d47cca6e1f7519a157d5990 /tests/testutils
parentadf660a7300148a31cdb8bc25301bfd21af0602b (diff)
downloadpylint-git-8f872bf49c344d1d16b3573136d53b2cbda007c6.tar.gz
Use ``python-typing-update`` on half of the ``tests`` directory (#6317)
Diffstat (limited to 'tests/testutils')
-rw-r--r--tests/testutils/test_lint_module_output_update.py15
-rw-r--r--tests/testutils/test_output_line.py6
2 files changed, 13 insertions, 8 deletions
diff --git a/tests/testutils/test_lint_module_output_update.py b/tests/testutils/test_lint_module_output_update.py
index 6d46f84b4..1c9e589af 100644
--- a/tests/testutils/test_lint_module_output_update.py
+++ b/tests/testutils/test_lint_module_output_update.py
@@ -3,8 +3,11 @@
# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
# pylint: disable=redefined-outer-name
+
+from __future__ import annotations
+
+from collections.abc import Callable
from pathlib import Path
-from typing import Callable, Tuple
import pytest
@@ -16,8 +19,8 @@ from pylint.testutils.functional import LintModuleOutputUpdate
@pytest.fixture()
def lint_module_fixture(
tmp_path: Path,
-) -> Callable[[str], Tuple[Path, Path, LintModuleOutputUpdate]]:
- def inner(base: str) -> Tuple[Path, Path, LintModuleOutputUpdate]:
+) -> Callable[[str], tuple[Path, Path, LintModuleOutputUpdate]]:
+ def inner(base: str) -> tuple[Path, Path, LintModuleOutputUpdate]:
filename = tmp_path / f"{base}.py"
expected_output_file = tmp_path / f"{base}.txt"
lmou = LintModuleOutputUpdate(
@@ -38,7 +41,7 @@ def test_not_py38(tmp_path: Path) -> None:
@pytest.mark.skipif(not PY38_PLUS, reason="Requires python 3.8 or superior")
def test_lint_module_output_update_fail_before(
- lint_module_fixture: Callable[[str], Tuple[Path, Path, LintModuleOutputUpdate]]
+ lint_module_fixture: Callable[[str], tuple[Path, Path, LintModuleOutputUpdate]]
) -> None:
"""There is a fail before the output need to be updated."""
filename, expected_output_file, lmou = lint_module_fixture("foo")
@@ -51,7 +54,7 @@ def test_lint_module_output_update_fail_before(
@pytest.mark.skipif(not PY38_PLUS, reason="Requires python 3.8 or superior")
def test_lint_module_output_update_effective(
- lint_module_fixture: Callable[[str], Tuple[Path, Path, LintModuleOutputUpdate]]
+ lint_module_fixture: Callable[[str], tuple[Path, Path, LintModuleOutputUpdate]]
) -> None:
"""The file is updated following a successful tests with wrong output."""
filename, expected_output_file, lmou = lint_module_fixture("foo")
@@ -66,7 +69,7 @@ def test_lint_module_output_update_effective(
@pytest.mark.skipif(not PY38_PLUS, reason="Requires python 3.8 or superior")
def test_lint_module_output_update_remove_useless_txt(
- lint_module_fixture: Callable[[str], Tuple[Path, Path, LintModuleOutputUpdate]]
+ lint_module_fixture: Callable[[str], tuple[Path, Path, LintModuleOutputUpdate]]
) -> None:
"""The file is updated following a successful tests with wrong output."""
filename, expected_output_file, lmou = lint_module_fixture("fine_name")
diff --git a/tests/testutils/test_output_line.py b/tests/testutils/test_output_line.py
index 6e6335ecc..0a194b973 100644
--- a/tests/testutils/test_output_line.py
+++ b/tests/testutils/test_output_line.py
@@ -4,7 +4,9 @@
# pylint: disable=redefined-outer-name
-from typing import Callable, Optional
+from __future__ import annotations
+
+from collections.abc import Callable
import pytest
@@ -151,7 +153,7 @@ def test_output_line_from_csv_error() -> None:
"confidence,expected_confidence", [[None, "UNDEFINED"], ["INFERENCE", "INFERENCE"]]
)
def test_output_line_from_csv_deprecated(
- confidence: Optional[str], expected_confidence: str
+ confidence: str | None, expected_confidence: str
) -> None:
"""Test that the OutputLine NamedTuple is instantiated correctly with from_csv.
Test OutputLine's of length 5 or 6.