-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Bruno Casali <brunoocasali@gmail.com> Update meilisearch/client.py Co-authored-by: Bruno Casali <brunoocasali@gmail.com> Fix error names
- Loading branch information
Showing
3 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
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
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
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,34 @@ | ||
import pytest | ||
|
||
from meilisearch.errors import MeilisearchApiError | ||
|
||
|
||
def test_basic_multi_search(client, empty_index): | ||
"""Tests multi-search on two indexes.""" | ||
empty_index("indexA") | ||
empty_index("indexB") | ||
response = client.multi_search( | ||
[{"indexUid": "indexA", "q": ""}, {"indexUid": "indexB", "q": ""}] | ||
) | ||
|
||
assert isinstance(response, dict) | ||
assert response["results"][0]["indexUid"] == "indexA" | ||
assert response["results"][1]["indexUid"] == "indexB" | ||
assert response["results"][0]["limit"] == 20 | ||
assert response["results"][1]["limit"] == 20 | ||
|
||
|
||
def test_multi_search_one_index(client, empty_index): | ||
"""Tests multi-search on a simple query.""" | ||
empty_index("indexA") | ||
response = client.multi_search([{"indexUid": "indexA", "q": ""}]) | ||
|
||
assert isinstance(response, dict) | ||
assert response["results"][0]["indexUid"] == "indexA" | ||
assert response["results"][0]["limit"] == 20 | ||
|
||
|
||
def test_multi_search_on_no_index(client): | ||
"""Tests multi-search on a non existing index.""" | ||
with pytest.raises(MeilisearchApiError): | ||
client.multi_search([{"indexUid": "indexDoesNotExist", "q": ""}]) |