-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
71 additions
and
0 deletions.
There are no files selected for viewing
71 changes: 71 additions & 0 deletions
71
tests/settings/test_settings_text_separators_meilisearch.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
NEW_SEPARATOR_TOKENS = ["|", "…"] | ||
NEW_NON_SEPARATOR_TOKENS = ["@", "#"] | ||
|
||
def test_get_separator_tokens_default(empty_index): | ||
"""Tests getting the default value of separator tokens.""" | ||
separator_tokens = empty_index().get_separator_tokens() | ||
assert separator_tokens == [] | ||
|
||
def test_get_non_separator_tokens_default(empty_index): | ||
"""Tests getting the default value of separator tokens.""" | ||
non_separator_tokens = empty_index().get_separator_tokens() | ||
assert non_separator_tokens == [] | ||
|
||
def test_update_separator_tokens(empty_index): | ||
"""Tests updating the separator tokens.""" | ||
index = empty_index() | ||
task = index.update_separator_tokens(NEW_SEPARATOR_TOKENS) | ||
task = index.wait_for_task(task.task_uid) | ||
assert task.status == "succeeded" | ||
|
||
separator_tokens = index.get_separator_tokens() | ||
for token in NEW_SEPARATOR_TOKENS: | ||
assert token in separator_tokens | ||
|
||
def test_update_non_separator_tokens(empty_index): | ||
"""Tests updating the non separator tokens.""" | ||
index = empty_index() | ||
task = index.update_non_separator_tokens(NEW_NON_SEPARATOR_TOKENS) | ||
task = index.wait_for_task(task.task_uid) | ||
assert task.status == "succeeded" | ||
|
||
non_separator_tokens = index.get_non_separator_tokens() | ||
for token in NEW_NON_SEPARATOR_TOKENS: | ||
assert token in non_separator_tokens | ||
|
||
|
||
def test_reset_separator_tokens(empty_index): | ||
"""Tests resetting the separator tokens to its default empty list.""" | ||
index = empty_index() | ||
task = index.update_separator_tokens(NEW_SEPARATOR_TOKENS) | ||
task = index.wait_for_task(task.task_uid) | ||
assert task.status == "succeeded" | ||
|
||
separator_tokens = index.get_separator_tokens() | ||
for token in NEW_SEPARATOR_TOKENS: | ||
assert token in separator_tokens | ||
|
||
reset_task = index.reset_separator_tokens() | ||
reset_task = index.wait_for_task(reset_task.task_uid) | ||
assert reset_task.status == "succeeded" | ||
|
||
separator_tokens = index.get_separator_tokens() | ||
assert separator_tokens == [] | ||
|
||
def test_non_reset_separator_tokens(empty_index): | ||
"""Tests resetting the separator tokens to its default empty list.""" | ||
index = empty_index() | ||
task = index.update_non_separator_tokens(NEW_NON_SEPARATOR_TOKENS) | ||
task = index.wait_for_task(task.task_uid) | ||
assert task.status == "succeeded" | ||
|
||
non_separator_tokens = index.get_non_separator_tokens() | ||
for token in NEW_NON_SEPARATOR_TOKENS: | ||
assert token in non_separator_tokens | ||
|
||
reset_task = index.reset_non_separator_tokens() | ||
reset_task = index.wait_for_task(reset_task.task_uid) | ||
assert reset_task.status == "succeeded" | ||
|
||
non_separator_tokens = index.get_non_separator_tokens() | ||
assert non_separator_tokens == [] |