summaryrefslogtreecommitdiff
path: root/tests/checkers
diff options
context:
space:
mode:
authorDaniƫl van Noord <13665637+DanielNoord@users.noreply.github.com>2022-09-09 11:05:00 +0200
committerGitHub <noreply@github.com>2022-09-09 11:05:00 +0200
commitc0272571bcdba466f237e0aeadff289e53f8bedd (patch)
tree7e2ee7394b4b29dbcb1f45da88d02958bea43c32 /tests/checkers
parentf29bdd4e04c8c144b378220434646b37a8e7d9a0 (diff)
downloadpylint-git-c0272571bcdba466f237e0aeadff289e53f8bedd.tar.gz
Add typing to several test files (#7440)
Diffstat (limited to 'tests/checkers')
-rw-r--r--tests/checkers/unittest_non_ascii_name.py4
-rw-r--r--tests/checkers/unittest_unicode/unittest_bad_chars.py4
-rw-r--r--tests/checkers/unittest_unicode/unittest_bidirectional_unicode.py2
-rw-r--r--tests/checkers/unittest_unicode/unittest_invalid_encoding.py10
4 files changed, 12 insertions, 8 deletions
diff --git a/tests/checkers/unittest_non_ascii_name.py b/tests/checkers/unittest_non_ascii_name.py
index 1830dd7ec..7b1c9d7c6 100644
--- a/tests/checkers/unittest_non_ascii_name.py
+++ b/tests/checkers/unittest_non_ascii_name.py
@@ -136,7 +136,7 @@ class TestNonAsciiChecker(pylint.testutils.CheckerTestCase):
self,
code: str,
assign_type: str,
- ):
+ ) -> None:
"""Variables defined no matter where, should be checked for non ascii."""
assign_node = astroid.extract_node(code)
@@ -261,7 +261,7 @@ class TestNonAsciiChecker(pylint.testutils.CheckerTestCase):
),
],
)
- def test_check_import(self, import_statement: str, wrong_name: str | None):
+ def test_check_import(self, import_statement: str, wrong_name: str | None) -> None:
"""We expect that for everything that user can change there is a message."""
node = astroid.extract_node(f"{import_statement} #@")
diff --git a/tests/checkers/unittest_unicode/unittest_bad_chars.py b/tests/checkers/unittest_unicode/unittest_bad_chars.py
index 41445e226..08b4c9539 100644
--- a/tests/checkers/unittest_unicode/unittest_bad_chars.py
+++ b/tests/checkers/unittest_unicode/unittest_bad_chars.py
@@ -120,7 +120,7 @@ class TestBadCharsChecker(pylint.testutils.CheckerTestCase):
codec_and_msg: tuple[str, tuple[pylint.testutils.MessageTest]],
line_ending: str,
add_invalid_bytes: bool,
- ):
+ ) -> None:
"""All combinations of bad characters that are accepted by Python at the moment
are tested in all possible combinations of
- line ending
@@ -215,7 +215,7 @@ class TestBadCharsChecker(pylint.testutils.CheckerTestCase):
char: str,
msg_id: str,
codec_and_msg: tuple[str, tuple[pylint.testutils.MessageTest]],
- ):
+ ) -> None:
"""Special test for a file containing chars that lead to
Python or Astroid crashes (which causes Pylint to exit early)
"""
diff --git a/tests/checkers/unittest_unicode/unittest_bidirectional_unicode.py b/tests/checkers/unittest_unicode/unittest_bidirectional_unicode.py
index c450db211..6b11dcfef 100644
--- a/tests/checkers/unittest_unicode/unittest_bidirectional_unicode.py
+++ b/tests/checkers/unittest_unicode/unittest_bidirectional_unicode.py
@@ -78,7 +78,7 @@ class TestBidirectionalUnicodeChecker(pylint.testutils.CheckerTestCase):
)
],
)
- def test_find_bidi_string(self, bad_string: str, codec: str):
+ def test_find_bidi_string(self, bad_string: str, codec: str) -> None:
"""Ensure that all Bidirectional strings are detected.
Tests also UTF-16 and UTF-32.
diff --git a/tests/checkers/unittest_unicode/unittest_invalid_encoding.py b/tests/checkers/unittest_unicode/unittest_invalid_encoding.py
index d2807301c..e8695a74f 100644
--- a/tests/checkers/unittest_unicode/unittest_invalid_encoding.py
+++ b/tests/checkers/unittest_unicode/unittest_invalid_encoding.py
@@ -52,7 +52,9 @@ class TestInvalidEncoding(pylint.testutils.CheckerTestCase):
("pep_bidirectional_utf_32_bom.txt", 1),
],
)
- def test_invalid_unicode_files(self, tmp_path: Path, test_file: str, line_no: int):
+ def test_invalid_unicode_files(
+ self, tmp_path: Path, test_file: str, line_no: int
+ ) -> None:
test_file_path = UNICODE_TESTS / test_file
target = shutil.copy(
test_file_path, tmp_path / test_file.replace(".txt", ".py")
@@ -126,7 +128,7 @@ class TestInvalidEncoding(pylint.testutils.CheckerTestCase):
),
],
)
- def test__determine_codec(self, content: bytes, codec: str, line: int):
+ def test__determine_codec(self, content: bytes, codec: str, line: int) -> None:
"""The codec determined should be exact no matter what we throw at it."""
assert self.checker._determine_codec(io.BytesIO(content)) == (codec, line)
@@ -139,6 +141,8 @@ class TestInvalidEncoding(pylint.testutils.CheckerTestCase):
"codec, msg",
(pytest.param(codec, msg, id=codec) for codec, msg in CODEC_AND_MSG),
)
- def test___check_codec(self, codec: str, msg: tuple[pylint.testutils.MessageTest]):
+ def test___check_codec(
+ self, codec: str, msg: tuple[pylint.testutils.MessageTest]
+ ) -> None:
with self.assertAddsMessages(*msg):
self.checker._check_codec(codec, 1)