Skip to content

Commit f91e400

Browse files
committed
removing duplicated tests from Astra
1 parent 6755b5c commit f91e400

1 file changed

Lines changed: 0 additions & 68 deletions

File tree

integrations/astra/tests/test_document_store.py

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -204,74 +204,6 @@ def test_filter_documents_by_in_operator(self, document_store):
204204
self.assert_documents_are_equal([result[0]], [docs[0]])
205205
self.assert_documents_are_equal([result[1]], [docs[1]])
206206

207-
def test_delete_all_documents(self, document_store: AstraDocumentStore):
208-
"""
209-
Test delete_all_documents() on an Astra.
210-
"""
211-
document_store.delete_all_documents()
212-
assert document_store.count_documents() == 0
213-
214-
def test_delete_by_filter(self, document_store: AstraDocumentStore, filterable_docs):
215-
document_store.write_documents(filterable_docs)
216-
initial_count = document_store.count_documents()
217-
assert initial_count > 0
218-
219-
# count documents that match the filter before deletion
220-
matching_docs = [d for d in filterable_docs if d.meta.get("chapter") == "intro"]
221-
expected_deleted_count = len(matching_docs)
222-
223-
# delete all documents with chapter="intro"
224-
deleted_count = document_store.delete_by_filter(
225-
filters={"field": "meta.chapter", "operator": "==", "value": "intro"}
226-
)
227-
228-
assert deleted_count == expected_deleted_count
229-
assert document_store.count_documents() == initial_count - deleted_count
230-
231-
# remaining documents don't have chapter="intro"
232-
remaining_docs = document_store.filter_documents()
233-
for doc in remaining_docs:
234-
assert doc.meta.get("chapter") != "intro"
235-
236-
# all documents with chapter="intro" were deleted
237-
intro_docs = document_store.filter_documents(
238-
filters={"field": "meta.chapter", "operator": "==", "value": "intro"}
239-
)
240-
assert len(intro_docs) == 0
241-
242-
def test_update_by_filter(self, document_store: AstraDocumentStore, filterable_docs):
243-
document_store.write_documents(filterable_docs)
244-
initial_count = document_store.count_documents()
245-
assert initial_count > 0
246-
247-
# count documents that match the filter before update
248-
matching_docs = [d for d in filterable_docs if d.meta.get("chapter") == "intro"]
249-
expected_updated_count = len(matching_docs)
250-
251-
# update all documents with chapter="intro" to have status="updated"
252-
updated_count = document_store.update_by_filter(
253-
filters={"field": "meta.chapter", "operator": "==", "value": "intro"},
254-
meta={"status": "updated"},
255-
)
256-
257-
assert updated_count == expected_updated_count
258-
assert document_store.count_documents() == initial_count
259-
260-
# verify the updated documents have the new metadata
261-
updated_docs = document_store.filter_documents(
262-
filters={"field": "meta.status", "operator": "==", "value": "updated"}
263-
)
264-
assert len(updated_docs) == expected_updated_count
265-
for doc in updated_docs:
266-
assert doc.meta.get("chapter") == "intro"
267-
assert doc.meta.get("status") == "updated"
268-
269-
# verify other documents weren't affected
270-
all_docs = document_store.filter_documents()
271-
for doc in all_docs:
272-
if doc.meta.get("chapter") != "intro":
273-
assert doc.meta.get("status") != "updated"
274-
275207
@pytest.mark.skip(reason="Unsupported filter operator not.")
276208
def test_not_operator(self, document_store, filterable_docs):
277209
pass

0 commit comments

Comments
 (0)