diff options
| author | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2023-02-27 21:47:19 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-27 20:47:19 +0000 |
| commit | 5e0223bc82dca273590460a1114d2bfefaf62031 (patch) | |
| tree | 104588022f6a6d5d8e4762ee8119065cebcc1a28 /tests/checkers | |
| parent | 5786d88285917bf944c994dceccd2e46933b98f7 (diff) | |
| download | pylint-git-5e0223bc82dca273590460a1114d2bfefaf62031.tar.gz | |
[spelling checker] Better help message and code organization (#8338)
Following a failed attempt to add functional tests for spelling checker in #6137
Diffstat (limited to 'tests/checkers')
| -rw-r--r-- | tests/checkers/unittest_spelling.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/checkers/unittest_spelling.py b/tests/checkers/unittest_spelling.py index 29783429b..d716def60 100644 --- a/tests/checkers/unittest_spelling.py +++ b/tests/checkers/unittest_spelling.py @@ -8,6 +8,7 @@ import astroid import pytest from pylint.checkers import spelling +from pylint.checkers.spelling import _get_enchant_dict_help from pylint.testutils import CheckerTestCase, MessageTest, _tokenize_str, set_config # try to create enchant dictionary @@ -39,6 +40,20 @@ class TestSpellingChecker(CheckerTestCase): # pylint:disable=too-many-public-me suggestions = "' or '".join(self.checker.spelling_dict.suggest(word)[:count]) return f"'{suggestions}'" + def test_spelling_dict_help_no_enchant(self) -> None: + assert "both the python package and the system dep" in _get_enchant_dict_help( + [], pyenchant_available=False + ) + assert "need to install the system dep" in _get_enchant_dict_help( + [], pyenchant_available=True + ) + + @skip_on_missing_package_or_dict + def test_spelling_dict_help_enchant(self) -> None: + assert "Available dictionaries: " in _get_enchant_dict_help( + enchant.Broker().list_dicts(), pyenchant_available=True + ) + @skip_on_missing_package_or_dict @set_config(spelling_dict=spell_dict) def test_check_bad_coment(self) -> None: |
