Skip to content

Commit 3d55e8b

Browse files
committed
Update PR test fixes
1 parent 78901f8 commit 3d55e8b

File tree

3 files changed

+23
-8
lines changed

3 files changed

+23
-8
lines changed

meilisearch/_httprequests.py

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

7371
request = http_method(
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import pytest
22

3-
from meilisearch.errors import MeilisearchApiError
43
from tests.common import INDEX_UID
5-
from tests.conftest import index_with_documents
64

75

8-
def test_basic_multi_search(client, index_with_documents):
9-
"""Delete the document with id."""
6+
@pytest.mark.usefixtures("enable_edit_documents_by_function")
7+
def test_update_document_by_function(client, index_with_documents):
8+
"""Delete the document with id and update document title"""
109
index_with_documents()
1110
response = client.update_documents_by_function(
12-
"indexA",
11+
INDEX_UID,
1312
{"function": 'if doc.id == "522681" {doc = () } else {doc.title = `* ${doc.title} *`}'},
1413
)
1514

1615
assert isinstance(response, dict)
16+
assert isinstance(response["taskUid"], int)
1717
assert response["indexUid"] == INDEX_UID

tests/conftest.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,23 @@ def enable_vector_search():
230230
)
231231

232232

233+
@fixture
234+
def enable_edit_documents_by_function():
235+
requests.patch(
236+
f"{common.BASE_URL}/experimental-features",
237+
headers={"Authorization": f"Bearer {common.MASTER_KEY}"},
238+
json={"editDocumentsByFunction": True},
239+
timeout=10,
240+
)
241+
yield
242+
requests.patch(
243+
f"{common.BASE_URL}/experimental-features",
244+
headers={"Authorization": f"Bearer {common.MASTER_KEY}"},
245+
json={"editDocumentsByFunction": False},
246+
timeout=10,
247+
)
248+
249+
233250
@fixture
234251
def new_embedders():
235252
return {

0 commit comments

Comments
 (0)