@@ -117,19 +117,16 @@ async def test_delete_by_filter_async(self, document_store: PgvectorDocumentStor
117117 await document_store .write_documents_async (docs )
118118 assert await document_store .count_documents_async () == 3
119119
120- # Delete documents with category="A"
121120 deleted_count = await document_store .delete_by_filter_async (
122121 filters = {"field" : "meta.category" , "operator" : "==" , "value" : "A" }
123122 )
124123 assert deleted_count == 2
125124 assert await document_store .count_documents_async () == 1
126125
127- # Verify only category B remains
128126 remaining_docs = await document_store .filter_documents_async ()
129127 assert len (remaining_docs ) == 1
130128 assert remaining_docs [0 ].meta ["category" ] == "B"
131129
132- # Delete remaining document with year filter
133130 deleted_count = await document_store .delete_by_filter_async (
134131 filters = {"field" : "meta.year" , "operator" : "==" , "value" : 2023 }
135132 )
@@ -144,14 +141,13 @@ async def test_delete_by_filter_async_no_matches(self, document_store: PgvectorD
144141 await document_store .write_documents_async (docs )
145142 assert await document_store .count_documents_async () == 2
146143
147- # Try to delete documents with category="C" (no matches)
148144 deleted_count = await document_store .delete_by_filter_async (
149145 filters = {"field" : "meta.category" , "operator" : "==" , "value" : "C" }
150146 )
151147 assert deleted_count == 0
152148 assert await document_store .count_documents_async () == 2
153149
154- async def test_delete_by_filter_async_complex_filters (self , document_store : PgvectorDocumentStore ):
150+ async def test_delete_by_filter_async_advanced_filters (self , document_store : PgvectorDocumentStore ):
155151 docs = [
156152 Document (content = "Doc 1" , meta = {"category" : "A" , "year" : 2023 , "status" : "draft" }),
157153 Document (content = "Doc 2" , meta = {"category" : "A" , "year" : 2024 , "status" : "published" }),
@@ -160,7 +156,7 @@ async def test_delete_by_filter_async_complex_filters(self, document_store: Pgve
160156 await document_store .write_documents_async (docs )
161157 assert await document_store .count_documents_async () == 3
162158
163- # Delete with AND condition
159+ # AND condition
164160 deleted_count = await document_store .delete_by_filter_async (
165161 filters = {
166162 "operator" : "AND" ,
@@ -173,7 +169,7 @@ async def test_delete_by_filter_async_complex_filters(self, document_store: Pgve
173169 assert deleted_count == 1
174170 assert await document_store .count_documents_async () == 2
175171
176- # Delete with OR condition
172+ # OR condition
177173 deleted_count = await document_store .delete_by_filter_async (
178174 filters = {
179175 "operator" : "OR" ,
@@ -226,14 +222,14 @@ async def test_update_by_filter_async_multiple_fields(self, document_store: Pgve
226222 await document_store .write_documents_async (docs )
227223 assert await document_store .count_documents_async () == 3
228224
229- # Update multiple fields for category="A" documents
225+ # update multiple fields for category="A" documents
230226 updated_count = await document_store .update_by_filter_async (
231227 filters = {"field" : "meta.category" , "operator" : "==" , "value" : "A" },
232228 meta = {"status" : "published" , "priority" : "high" , "reviewed" : True },
233229 )
234230 assert updated_count == 2
235231
236- # Verify the updates
232+ # verify
237233 published_docs = await document_store .filter_documents_async (
238234 filters = {"field" : "meta.category" , "operator" : "==" , "value" : "A" }
239235 )
@@ -244,7 +240,7 @@ async def test_update_by_filter_async_multiple_fields(self, document_store: Pgve
244240 assert doc .meta ["reviewed" ] is True
245241 assert doc .meta ["year" ] == 2023 # Original field should still be present
246242
247- # Verify category B was not updated
243+ # verify category B was not updated
248244 b_docs = await document_store .filter_documents_async (
249245 filters = {"field" : "meta.category" , "operator" : "==" , "value" : "B" }
250246 )
@@ -260,20 +256,20 @@ async def test_update_by_filter_async_no_matches(self, document_store: PgvectorD
260256 await document_store .write_documents_async (docs )
261257 assert await document_store .count_documents_async () == 2
262258
263- # Try to update documents with category="C" (no matches)
259+ # update documents with category="C" (no matches)
264260 updated_count = await document_store .update_by_filter_async (
265261 filters = {"field" : "meta.category" , "operator" : "==" , "value" : "C" }, meta = {"status" : "published" }
266262 )
267263 assert updated_count == 0
268264 assert await document_store .count_documents_async () == 2
269265
270- # Verify no documents were updated
266+ # verify no documents were updated
271267 published_docs = await document_store .filter_documents_async (
272268 filters = {"field" : "meta.status" , "operator" : "==" , "value" : "published" }
273269 )
274270 assert len (published_docs ) == 0
275271
276- async def test_update_by_filter_async_complex_filters (self , document_store : PgvectorDocumentStore ):
272+ async def test_update_by_filter_async_advanced_filters (self , document_store : PgvectorDocumentStore ):
277273 docs = [
278274 Document (content = "Doc 1" , meta = {"category" : "A" , "year" : 2023 , "status" : "draft" }),
279275 Document (content = "Doc 2" , meta = {"category" : "A" , "year" : 2024 , "status" : "draft" }),
@@ -282,7 +278,7 @@ async def test_update_by_filter_async_complex_filters(self, document_store: Pgve
282278 await document_store .write_documents_async (docs )
283279 assert await document_store .count_documents_async () == 3
284280
285- # Update with AND condition
281+ # AND condition
286282 updated_count = await document_store .update_by_filter_async (
287283 filters = {
288284 "operator" : "AND" ,
@@ -295,15 +291,15 @@ async def test_update_by_filter_async_complex_filters(self, document_store: Pgve
295291 )
296292 assert updated_count == 1
297293
298- # Verify only one document was updated
294+ # verify
299295 published_docs = await document_store .filter_documents_async (
300296 filters = {"field" : "meta.status" , "operator" : "==" , "value" : "published" }
301297 )
302298 assert len (published_docs ) == 1
303299 assert published_docs [0 ].meta ["category" ] == "A"
304300 assert published_docs [0 ].meta ["year" ] == 2023
305301
306- # Update with OR condition
302+ # OR condition
307303 updated_count = await document_store .update_by_filter_async (
308304 filters = {
309305 "operator" : "OR" ,
@@ -316,7 +312,6 @@ async def test_update_by_filter_async_complex_filters(self, document_store: Pgve
316312 )
317313 assert updated_count == 2
318314
319- # Verify both documents were updated
320315 featured_docs = await document_store .filter_documents_async (
321316 filters = {"field" : "meta.featured" , "operator" : "==" , "value" : True }
322317 )
@@ -326,7 +321,6 @@ async def test_update_by_filter_async_empty_meta_raises_error(self, document_sto
326321 docs = [Document (content = "Doc 1" , meta = {"category" : "A" })]
327322 await document_store .write_documents_async (docs )
328323
329- # Empty meta dict should raise ValueError
330324 with pytest .raises (ValueError , match = "meta must be a non-empty dictionary" ):
331325 await document_store .update_by_filter_async (
332326 filters = {"field" : "meta.category" , "operator" : "==" , "value" : "A" }, meta = {}
0 commit comments