mirror of
https://github.com/deepset-ai/haystack.git
synced 2025-12-24 21:48:52 +00:00
test: fix test incorrectly marked as async (#9327)
* test: fix test incorrectly marked as async * fix inmemory async tests
This commit is contained in:
parent
201becd400
commit
e3f9da13d0
@ -894,7 +894,7 @@ class TestOpenAIChatGenerator:
|
||||
assert message.meta["finish_reason"] == "stop"
|
||||
assert message.meta["usage"]["prompt_tokens"] > 0
|
||||
|
||||
async def test_run_with_wrong_model(self):
|
||||
def test_run_with_wrong_model(self):
|
||||
mock_client = MagicMock()
|
||||
mock_client.chat.completions.create.side_effect = OpenAIError("Invalid model name")
|
||||
|
||||
|
||||
@ -409,7 +409,7 @@ class TestMemoryDocumentStore(DocumentStoreBaseTests): # pylint: disable=R0904
|
||||
# Test async/await methods and concurrency
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_write_documents(self, document_store: InMemoryDocumentStore):
|
||||
async def test_write_documents_async(self, document_store: InMemoryDocumentStore):
|
||||
docs = [Document(id="1")]
|
||||
assert await document_store.write_documents_async(docs) == 1
|
||||
with pytest.raises(DuplicateDocumentError):
|
||||
@ -443,7 +443,7 @@ class TestMemoryDocumentStore(DocumentStoreBaseTests): # pylint: disable=R0904
|
||||
assert await document_store.count_documents_async() == 0
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_bm25_retrieval(self, document_store: InMemoryDocumentStore):
|
||||
async def test_bm25_retrieval_async(self, document_store: InMemoryDocumentStore):
|
||||
# Tests if the bm25_retrieval method returns the correct document based on the input query.
|
||||
docs = [Document(content="Hello world"), Document(content="Haystack supports multiple languages")]
|
||||
await document_store.write_documents_async(docs)
|
||||
@ -452,7 +452,7 @@ class TestMemoryDocumentStore(DocumentStoreBaseTests): # pylint: disable=R0904
|
||||
assert results[0].content == "Haystack supports multiple languages"
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_embedding_retrieval(self):
|
||||
async def test_embedding_retrieval_async(self):
|
||||
docstore = InMemoryDocumentStore(embedding_similarity_function="cosine")
|
||||
# Tests if the embedding retrieval method returns the correct document based on the input query embedding.
|
||||
docs = [
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user