Skip to content

Commit 69e368b

Browse files
committed
renaming a missing async method + updating async tests to correct name
1 parent e53a626 commit 69e368b

4 files changed

Lines changed: 12 additions & 12 deletions

File tree

integrations/oracle/src/haystack_integrations/document_stores/oracle/document_store.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ def filter_documents(self, filters: dict[str, Any] | None = None) -> list[Docume
399399
rows = cur.fetchall()
400400
return [OracleDocumentStore._row_to_document(r) for r in rows]
401401

402-
async def afilter_documents(self, filters: dict[str, Any] | None = None) -> list[Document]:
402+
async def filter_documents_async(self, filters: dict[str, Any] | None = None) -> list[Document]:
403403
return await asyncio.to_thread(self.filter_documents, filters)
404404

405405
def delete_documents(self, document_ids: list[str]) -> None:

integrations/oracle/tests/integration/test_docker_document_store.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,8 @@ def test_embedding_retrieval_with_filter(store):
293293
@pytest.mark.asyncio
294294
async def test_async_write_and_count(store):
295295
doc = _doc(_uid("M001"))
296-
await store.awrite_documents([doc])
297-
count = await store.acount_documents()
296+
await store.write_documents_async([doc])
297+
count = await store.count_documents_async()
298298
assert count >= 1
299299

300300

@@ -303,16 +303,16 @@ async def test_async_write_and_count(store):
303303
async def test_async_filter_documents(store):
304304
tag = _uid("N")[:8]
305305
doc = _doc(_uid("N001"), meta={"tag": tag})
306-
await store.awrite_documents([doc])
307-
results = await store.afilter_documents(filters={"field": "meta.tag", "operator": "==", "value": tag})
306+
await store.write_documents_async([doc])
307+
results = await store.filter_documents_async(filters={"field": "meta.tag", "operator": "==", "value": tag})
308308
assert len(results) == 1
309309

310310

311311
@pytest.mark.integration
312312
@pytest.mark.asyncio
313313
async def test_async_delete_documents(store):
314314
doc_id = _uid("O001")
315-
await store.awrite_documents([_doc(doc_id)])
316-
await store.adelete_documents([doc_id])
317-
results = await store.afilter_documents(filters={"field": "id", "operator": "==", "value": doc_id})
315+
await store.write_documents_async([_doc(doc_id)])
316+
await store.delete_documents_async([doc_id])
317+
results = await store.filter_documents_async(filters={"field": "id", "operator": "==", "value": doc_id})
318318
assert len(results) == 0

integrations/oracle/tests/integration/test_oracle_document_store.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,6 @@ def test_hnsw_index_creation(store):
207207
async def test_async_write_and_retrieve(store):
208208
doc_id = uuid4().hex.upper()[:32]
209209
doc = Document(id=doc_id, content="async test", meta={}, embedding=[0.5, 0.5, 0.0, 0.0])
210-
await store.awrite_documents([doc])
211-
results = await store._async_embedding_retrieval([0.5, 0.5, 0.0, 0.0], top_k=1)
210+
await store.write_documents_async([doc])
211+
results = await store._embedding_retrieval_async([0.5, 0.5, 0.0, 0.0], top_k=1)
212212
assert len(results) >= 1

integrations/oracle/tests/unit/test_embedding_retriever.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def mock_store():
1414
store = MagicMock(spec=OracleDocumentStore)
1515
store.distance_metric = "COSINE"
1616
store._embedding_retrieval.return_value = [Document(id="A" * 32, content="hi")]
17-
store._async_embedding_retrieval.return_value = [Document(id="A" * 32, content="hi")]
17+
store._embedding_retrieval_async.return_value = [Document(id="A" * 32, content="hi")]
1818
store.to_dict.return_value = {
1919
"type": "haystack_integrations.document_stores.oracle.document_store.OracleDocumentStore",
2020
"init_parameters": {
@@ -83,5 +83,5 @@ def test_to_dict_from_dict_roundtrip(mock_store, monkeypatch):
8383
async def test_run_async_calls_async_retrieval(mock_store):
8484
retriever = OracleEmbeddingRetriever(document_store=mock_store, top_k=5)
8585
result = await retriever.run_async(query_embedding=[0.1, 0.2, 0.3, 0.4])
86-
mock_store._async_embedding_retrieval.assert_called_once()
86+
mock_store._embedding_retrieval_async.assert_called_once()
8787
assert "documents" in result

0 commit comments

Comments
 (0)