|
| 1 | +NEW_SEPARATOR_TOKENS = ["|", "…"] |
| 2 | +NEW_NON_SEPARATOR_TOKENS = ["@", "#"] |
| 3 | + |
| 4 | +def test_get_separator_tokens_default(empty_index): |
| 5 | + """Tests getting the default value of separator tokens.""" |
| 6 | + separator_tokens = empty_index().get_separator_tokens() |
| 7 | + assert separator_tokens == [] |
| 8 | + |
| 9 | +def test_get_non_separator_tokens_default(empty_index): |
| 10 | + """Tests getting the default value of separator tokens.""" |
| 11 | + non_separator_tokens = empty_index().get_separator_tokens() |
| 12 | + assert non_separator_tokens == [] |
| 13 | + |
| 14 | +def test_update_separator_tokens(empty_index): |
| 15 | + """Tests updating the separator tokens.""" |
| 16 | + index = empty_index() |
| 17 | + task = index.update_separator_tokens(NEW_SEPARATOR_TOKENS) |
| 18 | + task = index.wait_for_task(task.task_uid) |
| 19 | + assert task.status == "succeeded" |
| 20 | + |
| 21 | + separator_tokens = index.get_separator_tokens() |
| 22 | + for token in NEW_SEPARATOR_TOKENS: |
| 23 | + assert token in separator_tokens |
| 24 | + |
| 25 | +def test_update_non_separator_tokens(empty_index): |
| 26 | + """Tests updating the non separator tokens.""" |
| 27 | + index = empty_index() |
| 28 | + task = index.update_non_separator_tokens(NEW_NON_SEPARATOR_TOKENS) |
| 29 | + task = index.wait_for_task(task.task_uid) |
| 30 | + assert task.status == "succeeded" |
| 31 | + |
| 32 | + non_separator_tokens = index.get_non_separator_tokens() |
| 33 | + for token in NEW_NON_SEPARATOR_TOKENS: |
| 34 | + assert token in non_separator_tokens |
| 35 | + |
| 36 | + |
| 37 | +def test_reset_separator_tokens(empty_index): |
| 38 | + """Tests resetting the separator tokens to its default empty list.""" |
| 39 | + index = empty_index() |
| 40 | + task = index.update_separator_tokens(NEW_SEPARATOR_TOKENS) |
| 41 | + task = index.wait_for_task(task.task_uid) |
| 42 | + assert task.status == "succeeded" |
| 43 | + |
| 44 | + separator_tokens = index.get_separator_tokens() |
| 45 | + for token in NEW_SEPARATOR_TOKENS: |
| 46 | + assert token in separator_tokens |
| 47 | + |
| 48 | + reset_task = index.reset_separator_tokens() |
| 49 | + reset_task = index.wait_for_task(reset_task.task_uid) |
| 50 | + assert reset_task.status == "succeeded" |
| 51 | + |
| 52 | + separator_tokens = index.get_separator_tokens() |
| 53 | + assert separator_tokens == [] |
| 54 | + |
| 55 | +def test_non_reset_separator_tokens(empty_index): |
| 56 | + """Tests resetting the separator tokens to its default empty list.""" |
| 57 | + index = empty_index() |
| 58 | + task = index.update_non_separator_tokens(NEW_NON_SEPARATOR_TOKENS) |
| 59 | + task = index.wait_for_task(task.task_uid) |
| 60 | + assert task.status == "succeeded" |
| 61 | + |
| 62 | + non_separator_tokens = index.get_non_separator_tokens() |
| 63 | + for token in NEW_NON_SEPARATOR_TOKENS: |
| 64 | + assert token in non_separator_tokens |
| 65 | + |
| 66 | + reset_task = index.reset_non_separator_tokens() |
| 67 | + reset_task = index.wait_for_task(reset_task.task_uid) |
| 68 | + assert reset_task.status == "succeeded" |
| 69 | + |
| 70 | + non_separator_tokens = index.get_non_separator_tokens() |
| 71 | + assert non_separator_tokens == [] |
0 commit comments