Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: test load dictionary with below threshold words #157

Merged
merged 1 commit into from
Aug 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading