Skip to content

Commit 78901f8

Browse files
committed
Update workflow test fixes
1 parent 7fea4c1 commit 78901f8

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

meilisearch/_httprequests.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ def send_request(
6565
data = (
6666
json.dumps(body, cls=serializer)
6767
if serialize_body
68-
else "" if body == "" else "null"
68+
else ""
69+
if body == ""
70+
else "null"
6971
)
7072

7173
request = http_method(

meilisearch/client.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,9 @@ def multi_search(
248248
body={"queries": queries, "federation": federation},
249249
)
250250

251-
def update_documents_by_function(self, index_uid: str, queries: Dict[str, List[Dict[str, Any]]]) -> Dict[str, Any]:
251+
def update_documents_by_function(
252+
self, index_uid: str, queries: Dict[str, List[Dict[str, Any]]]
253+
) -> Dict[str, Any]:
252254
"""Update Documents by function
253255
Parameters
254256
----------
@@ -268,8 +270,10 @@ def update_documents_by_function(self, index_uid: str, queries: Dict[str, List[D
268270
MeilisearchApiError
269271
An error containing details about why Meilisearch can't process your request. Meilisearch error codes are described here: https://www.meilisearch.com/docs/reference/errors/error_codes#meilisearch-errors
270272
"""
271-
return self.http.post(path=f"{self.config.paths.index}/{index_uid}/{self.config.paths.document}/{self.config.paths.edit}",
272-
body=dict(queries))
273+
return self.http.post(
274+
path=f"{self.config.paths.index}/{index_uid}/{self.config.paths.document}/{self.config.paths.edit}",
275+
body=dict(queries),
276+
)
273277

274278
def get_all_stats(self) -> Dict[str, Any]:
275279
"""Get all stats of Meilisearch

tests/client/test_client_update_document_by_functions.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44
from tests.common import INDEX_UID
55
from tests.conftest import index_with_documents
66

7+
78
def test_basic_multi_search(client, index_with_documents):
89
"""Delete the document with id."""
910
index_with_documents()
1011
response = client.update_documents_by_function(
11-
"indexA", {"function": "if doc.id == \"522681\" {doc = () } else {doc.title = `* ${doc.title} *`}"}
12+
"indexA",
13+
{"function": 'if doc.id == "522681" {doc = () } else {doc.title = `* ${doc.title} *`}'},
1214
)
1315

1416
assert isinstance(response, dict)
15-
assert response['indexUid'] == INDEX_UID
17+
assert response["indexUid"] == INDEX_UID

tests/index/test_index_document_meilisearch.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ def test_update_documents_json_custom_serializer(empty_index):
171171

172172

173173
def test_update_documents_raw_custom_serializer(empty_index):
174-
175174
documents = [
176175
{"id": uuid4(), "title": "test 1", "when": datetime.now()},
177176
{"id": uuid4(), "title": "Test 2", "when": datetime.now()},

0 commit comments

Comments
 (0)