Skip to content

Commit b6e50c4

Browse files
committed
test load dictionary with below threshold words
1 parent 7326ddd commit b6e50c4

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ requires = ["setuptools>=58.0.4", "wheel"]
33
build-backend = "setuptools.build_meta"
44

55
[tool.basedpyright]
6+
ignore = ["tests"]
67
pythonVersion = "3.8"
78

89
reportUnusedCallResult = "none"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
below 8
2+
threshold 10
3+
word 10

tests/test_symspellpy.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
FORTESTS_DIR = Path(__file__).resolve().parent / "fortests"
1111
BAD_DICT_PATH = FORTESTS_DIR / "bad_dict.txt"
12+
BELOW_THRESHOLD_DICT_PATH = FORTESTS_DIR / "below_threshold_dict.txt"
1213
BIG_MODIFIED_PATH = FORTESTS_DIR / "big_modified.txt"
1314
BIG_WORDS_PATH = FORTESTS_DIR / "big_words.txt"
1415
NON_EN_DICT_PATH = FORTESTS_DIR / "non_en_dict.txt"
@@ -196,6 +197,15 @@ def test_load_dictionary_count(self, symspell_default, dictionary_path):
196197
assert 82834 == symspell_default.word_count
197198
assert 676094 == symspell_default.entry_count
198199

200+
@pytest.mark.parametrize("symspell_short", [10], indirect=True)
201+
def test_load_dictionary_below_threshold(self, symspell_short):
202+
symspell_short.load_dictionary(BELOW_THRESHOLD_DICT_PATH, 0, 1)
203+
204+
assert 1 == len(symspell_short.below_threshold_words)
205+
assert 8 == symspell_short.below_threshold_words["below"]
206+
207+
assert 2 == symspell_short.word_count
208+
199209
def test_load_dictionary_separator(self, symspell_default):
200210
assert symspell_default.load_dictionary(SEPARATOR_DICT_PATH, 0, 1, SEPARATOR)
201211
assert 5 == symspell_default.word_count

0 commit comments

Comments
 (0)