Skip to content

CountDocumentsAsyncTest, WriteDocumentsAsyncTest, WriteDocumentsAsyncTest #10917

@davidsbatista

Description

@davidsbatista

NOTES:

  • Tests should be written into haystack/testing/document_store_async.py
  • Use async def for all test methods
  • Decorate each test method with @pytest.mark.asyncio
  • Rely on an async-compatible document_store fixture (to be provided by the concrete test class in each integration)
  • Use await on all *_async() calls
  • Use write_documents_async / count_documents_async in setup steps (not the sync variants), so the full async path is exercised end-to-end
  • Open the PR to the async-mixin-tests feature branch

CountDocumentsAsyncTest

Mirrors: CountDocumentsTest

Test Description
test_count_empty_async await count_documents_async() returns 0 on empty store
test_count_not_empty_async After writing 3 docs via write_documents_async, count_documents_async() returns 3

WriteDocumentsAsyncTest(AssertDocumentsEqualMixin)

Mirrors: WriteDocumentsTest

Test Description
test_write_documents_async Abstract — raise NotImplementedError with a message; concrete classes must override this
test_write_documents_duplicate_fail_async Writing same doc twice with DuplicatePolicy.FAIL raises DuplicateDocumentError on second write
test_write_documents_duplicate_skip_async Second write of same doc with DuplicatePolicy.SKIP returns 0
test_write_documents_duplicate_overwrite_async DuplicatePolicy.OVERWRITE updates content; verify via filter_documents_async
test_write_documents_invalid_input_async Passing ["not a document"] or a plain string raises ValueError

DeleteDocumentsAsyncTest

Mirrors: DeleteDocumentsTest

Test Description
test_delete_documents_async Write 1 doc, delete it by id, count_documents_async() returns 0
test_delete_documents_empty_document_store_async delete_documents_async(["non_existing_id"]) on empty store doesn't raise
test_delete_documents_non_existing_document_async Delete non-existing id from a 1-doc store; count stays at 1

Metadata

Metadata

Assignees

Labels

P1High priority, add to the next sprint

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions