Skip to content

Commit f4c463d

Browse files
test(elasticsearch): restore inline comments in test_embedding_retrieval_async
1 parent 84dc468 commit f4c463d

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

integrations/elasticsearch/tests/test_document_store_async.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,22 +243,26 @@ async def test_bm25_retrieval_async_with_filters(self, document_store):
243243

244244
@pytest.mark.asyncio
245245
async def test_embedding_retrieval_async(self, document_store):
246+
# init document store
246247
docs = [
247248
Document(content="Most similar document", embedding=[1.0, 1.0, 1.0, 1.0]),
248249
Document(content="Less similar document", embedding=[0.5, 0.5, 0.5, 0.5]),
249250
]
250251
await document_store.write_documents_async(docs)
251252

253+
# without num_candidates set to None
252254
results = await document_store._embedding_retrieval_async(query_embedding=[1.0, 1.0, 1.0, 1.0], top_k=1)
253255
assert len(results) == 1
254256
assert results[0].content == "Most similar document"
255257

258+
# with num_candidates not None
256259
results = await document_store._embedding_retrieval_async(
257260
query_embedding=[1.0, 1.0, 1.0, 1.0], top_k=2, num_candidates=2
258261
)
259262
assert len(results) == 2
260263
assert results[0].content == "Most similar document"
261264

265+
# with an embedding containing None
262266
with pytest.raises(ValueError, match="query_embedding must be a non-empty list of floats"):
263267
_ = await document_store._embedding_retrieval_async(query_embedding=None, top_k=2)
264268

0 commit comments

Comments
 (0)