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

@@ -1,15 +1,12 @@
from typing import AsyncGenerator, Generator
from typing import Generator
import pytest
from __module_name__.vectorstores import __ModuleName__VectorStore
from langchain_core.vectorstores import VectorStore
from langchain_tests.integration_tests import (
AsyncReadWriteTestSuite,
ReadWriteTestSuite,
)
from langchain_tests.integration_tests import VectorStoreIntegrationTests
class Test__ModuleName__VectorStoreSync(ReadWriteTestSuite):
class Test__ModuleName__VectorStore(VectorStoreIntegrationTests):
@pytest.fixture()
def vectorstore(self) -> Generator[VectorStore, None, None]: # type: ignore
"""Get an empty vectorstore for unit tests."""
@@ -21,17 +18,3 @@ class Test__ModuleName__VectorStoreSync(ReadWriteTestSuite):
finally:
# cleanup operations, or deleting data
pass
class Test__ModuleName__VectorStoreAsync(AsyncReadWriteTestSuite):
@pytest.fixture()
async def vectorstore(self) -> AsyncGenerator[VectorStore, None]: # type: ignore
"""Get an empty vectorstore for unit tests."""
store = __ModuleName__VectorStore(self.get_embeddings())
# note: store should be EMPTY at this point
# if you need to delete data, you may do so here
try:
yield store
finally:
# cleanup operations, or deleting data
pass