summaryrefslogtreecommitdiff
path: root/tests/test_similar.py
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/test_similar.py
parentadf660a7300148a31cdb8bc25301bfd21af0602b (diff)
downloadpylint-git-8f872bf49c344d1d16b3573136d53b2cbda007c6.tar.gz
Use ``python-typing-update`` on half of the ``tests`` directory (#6317)
Diffstat (limited to 'tests/test_similar.py')
-rw-r--r--tests/test_similar.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/test_similar.py b/tests/test_similar.py
index f595102bc..2c258a019 100644
--- a/tests/test_similar.py
+++ b/tests/test_similar.py
@@ -2,14 +2,17 @@
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
+from __future__ import annotations
+
import contextlib
import os
import re
import sys
import warnings
+from collections.abc import Iterator
from io import StringIO
from os.path import abspath, dirname, join
-from typing import Iterator, List, TextIO
+from typing import TextIO
import pytest
@@ -31,7 +34,7 @@ def _patch_streams(out: TextIO) -> Iterator:
class TestSimilarCodeChecker:
- def _runtest(self, args: List[str], code: int) -> None:
+ def _runtest(self, args: list[str], code: int) -> None:
"""Runs the tests and sees if output code is as expected."""
out = StringIO()
pylint_code = self._run_pylint(args, out=out)
@@ -42,7 +45,7 @@ class TestSimilarCodeChecker:
assert pylint_code == code, msg
@staticmethod
- def _run_pylint(args: List[str], out: TextIO) -> int:
+ def _run_pylint(args: list[str], out: TextIO) -> int:
"""Runs pylint with a patched output."""
args = args + ["--persistent=no"]
with _patch_streams(out):
@@ -58,7 +61,7 @@ class TestSimilarCodeChecker:
output = re.sub(CLEAN_PATH, "", output, flags=re.MULTILINE)
return output.replace("\\", "/")
- def _test_output(self, args: List[str], expected_output: str) -> None:
+ def _test_output(self, args: list[str], expected_output: str) -> None:
"""Tests if the output of a pylint run is as expected."""
out = StringIO()
self._run_pylint(args, out=out)