mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-16 15:04:13 +00:00
multiple: combine sync/async vector store standard test suites (#28580)
Breaking change in `langchain-tests`.
This commit is contained in:
@@ -2,10 +2,7 @@ from pathlib import Path
|
||||
from unittest.mock import AsyncMock, Mock
|
||||
|
||||
import pytest
|
||||
from langchain_tests.integration_tests.vectorstores import (
|
||||
AsyncReadWriteTestSuite,
|
||||
ReadWriteTestSuite,
|
||||
)
|
||||
from langchain_tests.integration_tests.vectorstores import VectorStoreIntegrationTests
|
||||
|
||||
from langchain_core.documents import Document
|
||||
from langchain_core.embeddings.fake import DeterministicFakeEmbedding
|
||||
@@ -13,18 +10,12 @@ from langchain_core.vectorstores import InMemoryVectorStore
|
||||
from tests.unit_tests.stubs import _any_id_document
|
||||
|
||||
|
||||
class TestInMemoryReadWriteTestSuite(ReadWriteTestSuite):
|
||||
class TestInMemoryStandard(VectorStoreIntegrationTests):
|
||||
@pytest.fixture
|
||||
def vectorstore(self) -> InMemoryVectorStore:
|
||||
return InMemoryVectorStore(embedding=self.get_embeddings())
|
||||
|
||||
|
||||
class TestAsyncInMemoryReadWriteTestSuite(AsyncReadWriteTestSuite):
|
||||
@pytest.fixture
|
||||
async def vectorstore(self) -> InMemoryVectorStore:
|
||||
return InMemoryVectorStore(embedding=self.get_embeddings())
|
||||
|
||||
|
||||
async def test_inmemory_similarity_search() -> None:
|
||||
"""Test end to end similarity search."""
|
||||
store = await InMemoryVectorStore.afrom_texts(
|
||||
|
Reference in New Issue
Block a user