mirror of
https://github.com/deepset-ai/haystack.git
synced 2025-07-19 15:01:40 +00:00

* add stub implementation * reimplementation * test files * docstore tests * tests for document * better testing * remove mmh3 * readme * only store, no retrieval yet * linting * review feedback * initial filters implementation * working on filters * linters * filtering works and is isolated by document store * simplify filters * comments * improve filters matching code * review feedback * pylint * move logic into_create_id * mypy
39 lines
914 B
Python
39 lines
914 B
Python
import pytest
|
|
from haystack.preview.document_stores import MemoryDocumentStore
|
|
|
|
from test.preview.document_stores._base import DocumentStoreBaseTests
|
|
|
|
|
|
class TestMemoryDocumentStore(DocumentStoreBaseTests):
|
|
"""
|
|
Test MemoryDocumentStore's specific features
|
|
"""
|
|
|
|
@pytest.fixture
|
|
def docstore(self) -> MemoryDocumentStore:
|
|
return MemoryDocumentStore()
|
|
|
|
def direct_access(self, docstore, doc_id):
|
|
"""
|
|
Bypass `filter_documents()`
|
|
"""
|
|
return docstore.storage[doc_id]
|
|
|
|
def direct_write(self, docstore, documents):
|
|
"""
|
|
Bypass `write_documents()`
|
|
"""
|
|
for doc in documents:
|
|
docstore.storage[doc.id] = doc
|
|
|
|
def direct_delete(self, docstore, ids):
|
|
"""
|
|
Bypass `delete_documents()`
|
|
"""
|
|
for doc_id in ids:
|
|
del docstore.storage[doc_id]
|
|
|
|
#
|
|
# Test retrieval
|
|
#
|