Files
deepset-ai--haystack/releasenotes/notes/document-store-testing-c1a8050f06ff3e97.yaml
T
wehub-resource-sync c56bef871b
CodeQL / Analyze (python) (push) Has been cancelled
Update Platform Components Table / update (push) Has been cancelled
Docker image release / Build base image (push) Has been cancelled
Sync docs with Docusaurus / sync (push) Has been cancelled
Tests / Check if changed (push) Has been cancelled
Tests / format (push) Has been cancelled
Tests / check-imports (push) Has been cancelled
Tests / Unit / macos-latest (push) Has been cancelled
Tests / Unit / ubuntu-latest (push) Has been cancelled
Tests / Unit / windows-latest (push) Has been cancelled
Tests / mypy (push) Has been cancelled
Tests / Integration / ubuntu-latest (push) Has been cancelled
Tests / Integration / macos-latest (push) Has been cancelled
Tests / Integration / windows-latest (push) Has been cancelled
Tests / notify-slack-on-failure (push) Has been cancelled
Tests / Mark tests as completed (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:22:28 +08:00

26 lines
1.2 KiB
YAML

---
prelude: >
The `testing.DocumentStoreBaseTests` has been heavily overhauled.
It has been split into multiple classes so developers can gradually test their Document Store as they're implemented.
`DocumentStoreBaseTests` now inherits from this classes:
- `CountDocumentsTest`, to test `DocumentStore.count_documents()`
- `WriteDocumentsTest`, to test `DocumentStore.write_documents()`
- `DeleteDocumentsTest`, to test `DocumentStore.delete_documents()`
- `FilterDocumentsTest`, to test `DocumentStore.filter_documents()`
To use each class it's enough to inherit from it and define the `document_store` fixture to return an instance of the Document Store we're implementing.
```python
class MyDocumentStoreCountDocumentTest(CountDocumentsTest):
@pytest.fixture
def document_store(self):
return MyDocumentStore()
```
There's also another class that tests `DocumentStore.filter_documents()` using legacy filters.
This is not inherited by `DocumentStoreBaseTests` but can be added as a base class to verify the support of legacy filters.
- `LegacyFilterDocumentsTest`
preview:
- |
Rework the `testing.DocumentStoreBaseTests` class to ease Document Stores development and testing