|
1 | 1 | # pylint: disable=invalid-name
|
2 | 2 |
|
3 | 3 | from math import ceil
|
| 4 | +from time import sleep |
4 | 5 | from meilisearch.client import Client
|
5 | 6 | from meilisearch.models.document import Document
|
6 | 7 | from meilisearch.models.task import TaskInfo
|
@@ -91,17 +92,23 @@ def test_update_documents(index_with_documents, small_movies):
|
91 | 92 | """Tests updating a single document and a set of documents."""
|
92 | 93 | index = index_with_documents()
|
93 | 94 | response = index.get_documents()
|
94 |
| - response.results[0].title = 'Some title' |
95 |
| - update = index.update_documents([dict(response.results[0])]) |
| 95 | + doc = response.results[0] |
| 96 | + doc.title = 'Some title' |
| 97 | + |
| 98 | + update = index.update_documents([dict(doc)]) |
| 99 | + |
96 | 100 | assert isinstance(update, TaskInfo)
|
97 | 101 | assert update.task_uid != None
|
98 | 102 | index.wait_for_task(update.task_uid)
|
99 |
| - response = index.get_documents() |
100 |
| - assert response.results[0].title == 'Some title' |
| 103 | + |
| 104 | + response = index.get_document(doc.id) |
| 105 | + assert response.title == 'Some title' |
| 106 | + |
101 | 107 | update = index.update_documents(small_movies)
|
102 | 108 | index.wait_for_task(update.task_uid)
|
103 |
| - response = index.get_documents() |
104 |
| - assert response.results[0].title != 'Some title' |
| 109 | + |
| 110 | + response = index.get_document(doc.id) |
| 111 | + assert response.title != 'Some title' |
105 | 112 |
|
106 | 113 | @pytest.mark.parametrize('batch_size', [2, 3, 1000])
|
107 | 114 | @pytest.mark.parametrize(
|
|
0 commit comments