multiple: combine sync/async vector store standard test suites (#28580)

Breaking change in `langchain-tests`.
This commit is contained in:
ccurme
2024-12-06 14:55:06 -05:00
committed by GitHub
parent dda9f90047
commit 2c6bc74cb1
9 changed files with 56 additions and 229 deletions

View File

@@ -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(