mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-03 12:07:36 +00:00
multiple: combine sync/async vector store standard test suites (#28580)
Breaking change in `langchain-tests`.
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user