summaryrefslogtreecommitdiff
path: root/tests/checkers/unittest_spelling.py
diff options
context:
space:
mode:
authorEli Fine <ubuntu@ip-172-31-89-59.ec2.internal>2021-04-09 14:38:16 +0000
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2021-04-10 08:36:29 +0200
commit04215ad5e0e0931494bd5c58cc09c6cca0ee2b44 (patch)
tree99467e65093884bcaf956a9fa1eb07cfc42194af /tests/checkers/unittest_spelling.py
parent525f24b2f9301a09f1a1c8ef8a5b18417dbe5226 (diff)
downloadpylint-git-04215ad5e0e0931494bd5c58cc09c6cca0ee2b44.tar.gz
skipping spellcheck for code flanked in backticks
Diffstat (limited to 'tests/checkers/unittest_spelling.py')
-rw-r--r--tests/checkers/unittest_spelling.py72
1 files changed, 40 insertions, 32 deletions
diff --git a/tests/checkers/unittest_spelling.py b/tests/checkers/unittest_spelling.py
index dec6b19ee..0d946bc84 100644
--- a/tests/checkers/unittest_spelling.py
+++ b/tests/checkers/unittest_spelling.py
@@ -37,7 +37,9 @@ if enchant is not None:
pass
-class TestSpellingChecker(CheckerTestCase):
+class TestSpellingChecker(
+ CheckerTestCase
+): # pylint:disable=too-many-public-methods # This is a test case class, not sure why it would be relevant to have this pylint rule enforced for test case classes
CHECKER_CLASS = spelling.SpellingChecker
skip_on_missing_package_or_dict = pytest.mark.skipif(
@@ -303,37 +305,6 @@ class TestSpellingChecker(CheckerTestCase):
):
self.checker.visit_classdef(stmt)
- # @skip_on_missing_package_or_dict
- # # @set_config(spelling_dict=spell_dict)
- # @pytest.mark.parametrize(
- # "num_files,num_jobs,num_checkers",
- # [
- # (1, 2, 1),
- # (1, 2, 2),
- # (1, 2, 3),
- # (2, 2, 1),
- # (2, 2, 2),
- # (2, 2, 3),
- # (3, 2, 1),
- # (3, 2, 2),
- # (3, 2, 3),
- # (3, 1, 1),
- # (3, 1, 2),
- # (3, 1, 3),
- # (3, 5, 1),
- # (3, 5, 2),
- # (3, 5, 3),
- # (10, 2, 1),
- # (10, 2, 2),
- # (10, 2, 3),
- # (2, 10, 1),
- # (2, 10, 2),
- # (2, 10, 3),
- # ],
- # )
- # def test_compare_workers_to_single_proc(self, num_files, num_jobs, num_checkers):
- # assert True
-
@skip_on_missing_package_or_dict
@set_config(spelling_dict=spell_dict)
@pytest.mark.parametrize(
@@ -351,6 +322,7 @@ class TestSpellingChecker(CheckerTestCase):
("noqa", ":", "flake8 / zimports directive"),
("nosec", "", "bandit directive"),
("isort", ":skip", "isort directive"),
+ ("mypy", ":", "mypy directive"),
),
)
def test_skip_tool_directives_at_beginning_of_comments_but_still_raise_error_if_directive_appears_later_in_comment( # pylint:disable=unused-argument # Having the extra description parameter allows the description to show up in the pytest output as part of the test name when running parametrized tests
@@ -373,6 +345,42 @@ class TestSpellingChecker(CheckerTestCase):
@skip_on_missing_package_or_dict
@set_config(spelling_dict=spell_dict)
+ def test_skip_code_flanked_in_double_backticks(self):
+ full_comment = "# The function ``.qsize()`` .qsize()"
+ with self.assertAddsMessages(
+ Message(
+ "wrong-spelling-in-comment",
+ line=1,
+ args=(
+ "qsize",
+ full_comment,
+ " ^^^^^",
+ self._get_msg_suggestions("qsize"),
+ ),
+ )
+ ):
+ self.checker.process_tokens(_tokenize_str(full_comment))
+
+ @skip_on_missing_package_or_dict
+ @set_config(spelling_dict=spell_dict)
+ def test_skip_code_flanked_in_single_backticks(self):
+ full_comment = "# The function `.qsize()` .qsize()"
+ with self.assertAddsMessages(
+ Message(
+ "wrong-spelling-in-comment",
+ line=1,
+ args=(
+ "qsize",
+ full_comment,
+ " ^^^^^",
+ self._get_msg_suggestions("qsize"),
+ ),
+ )
+ ):
+ self.checker.process_tokens(_tokenize_str(full_comment))
+
+ @skip_on_missing_package_or_dict
+ @set_config(spelling_dict=spell_dict)
def test_handle_words_joined_by_forward_slash(self):
stmt = astroid.extract_node(
'''