Skip to content

Commit

Permalink
test load dictionary with below threshold words
Browse files Browse the repository at this point in the history
  • Loading branch information
mammothb committed Aug 31, 2024
1 parent 7326ddd commit b6e50c4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ requires = ["setuptools>=58.0.4", "wheel"]
build-backend = "setuptools.build_meta"

[tool.basedpyright]
ignore = ["tests"]
pythonVersion = "3.8"

reportUnusedCallResult = "none"
Expand Down
3 changes: 3 additions & 0 deletions tests/fortests/below_threshold_dict.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
below 8
threshold 10
word 10
10 changes: 10 additions & 0 deletions tests/test_symspellpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

FORTESTS_DIR = Path(__file__).resolve().parent / "fortests"
BAD_DICT_PATH = FORTESTS_DIR / "bad_dict.txt"
BELOW_THRESHOLD_DICT_PATH = FORTESTS_DIR / "below_threshold_dict.txt"
BIG_MODIFIED_PATH = FORTESTS_DIR / "big_modified.txt"
BIG_WORDS_PATH = FORTESTS_DIR / "big_words.txt"
NON_EN_DICT_PATH = FORTESTS_DIR / "non_en_dict.txt"
Expand Down Expand Up @@ -196,6 +197,15 @@ def test_load_dictionary_count(self, symspell_default, dictionary_path):
assert 82834 == symspell_default.word_count
assert 676094 == symspell_default.entry_count

@pytest.mark.parametrize("symspell_short", [10], indirect=True)
def test_load_dictionary_below_threshold(self, symspell_short):
symspell_short.load_dictionary(BELOW_THRESHOLD_DICT_PATH, 0, 1)

assert 1 == len(symspell_short.below_threshold_words)
assert 8 == symspell_short.below_threshold_words["below"]

assert 2 == symspell_short.word_count

def test_load_dictionary_separator(self, symspell_default):
assert symspell_default.load_dictionary(SEPARATOR_DICT_PATH, 0, 1, SEPARATOR)
assert 5 == symspell_default.word_count
Expand Down

0 comments on commit b6e50c4

Please sign in to comment.