Skip to content

Commit 28b643e

Browse files
committed
parameterizes test and fixes yaml lint error
1 parent b553aeb commit 28b643e

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

datasets/small_movies.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,4 +227,4 @@
227227
"release_date": 1114669984,
228228
"genre": "Sci Fi"
229229
}
230-
]
230+
]

tests/index/test_index_search_meilisearch.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -520,16 +520,17 @@ def test_search_distinct(index_with_documents):
520520
assert response["hits"][0]["id"] == "399579"
521521

522522

523-
def test_search_ranking_threshold(index_with_documents):
524-
# No documents matched with exact phrase and ranking threshold 1
525-
response = index_with_documents().search("Husband and wife", {"rankingScoreThreshold": 1})
526-
assert len(response["hits"]) == 0
527-
# Only one document contains this phrase
528-
response = index_with_documents().search("Husband and wife", {"rankingScoreThreshold": 0.9})
529-
assert len(response["hits"]) == 1
530-
# No documents matched with too high of a threshold for this term
531-
response = index_with_documents().search("wife", {"rankingScoreThreshold": 0.9})
532-
assert len(response["hits"]) == 0
533-
# Two documents do contain the term but they only match at a lower threshold
534-
response = index_with_documents().search("wife", {"rankingScoreThreshold": 0.5})
535-
assert len(response["hits"]) == 2
523+
@pytest.mark.parametrize(
524+
"query, ranking_score_threshold, expected",
525+
(
526+
("Husband and wife", 1, 0),
527+
("Husband and wife", 0.9, 1),
528+
("wife", 0.9, 0),
529+
("wife", 0.5, 2),
530+
),
531+
)
532+
def test_search_ranking_threshold(query, ranking_score_threshold, expected, index_with_documents):
533+
response = index_with_documents().search(
534+
query, {"rankingScoreThreshold": ranking_score_threshold}
535+
)
536+
assert len(response["hits"]) == expected

0 commit comments

Comments
 (0)