-
-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathstemming_test.py
40 lines (32 loc) · 1.13 KB
/
stemming_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
"""Tests for stemming."""
from typesense.stemming import Stemming
def test_actual_upsert(
actual_stemming: Stemming,
) -> None:
"""Test that it can upsert a stemming dictionary to Typesense Server."""
response = actual_stemming.dictionaries.upsert(
"set_1",
[{"word": "running", "root": "run"}, {"word": "fishing", "root": "fish"}],
)
assert response == [
{"word": "running", "root": "run"},
{"word": "fishing", "root": "fish"},
]
def test_actual_retrieve_many(
actual_stemming: Stemming,
) -> None:
"""Test that it can retrieve all stemming dictionaries from Typesense Server."""
response = actual_stemming.dictionaries.retrieve()
assert response == {"dictionaries": ["set_1"]}
def test_actual_retrieve(
actual_stemming: Stemming,
) -> None:
"""Test that it can retrieve a single stemming dictionary from Typesense Server."""
response = actual_stemming.dictionaries["set_1"].retrieve()
assert response == {
"id": "set_1",
"words": [
{"word": "running", "root": "run"},
{"word": "fishing", "root": "fish"},
],
}