standard-tests[patch]: Add pytest assert rewrites (#24408)

This will surface nice error messages in subclasses that fail assertions.
This commit is contained in:
Eugene Yurtsev
2024-07-18 17:41:11 -04:00
committed by GitHub
parent f62b323108
commit ef22ebe431
5 changed files with 62 additions and 0 deletions

View File

@@ -1,6 +1,35 @@
from typing import Tuple
import pytest
from langchain_standard_tests.integration_tests.base_store import (
BaseStoreAsyncTests,
BaseStoreSyncTests,
)
from langchain_core.stores import InMemoryStore
# Check against standard tests
class TestSyncInMemoryStore(BaseStoreSyncTests):
@pytest.fixture
def kv_store(self) -> InMemoryStore:
return InMemoryStore()
@pytest.fixture
def three_values(self) -> Tuple[str, str, str]: # type: ignore
return "value1", "value2", "value3"
class TestAsyncInMemoryStore(BaseStoreAsyncTests):
@pytest.fixture
async def kv_store(self) -> InMemoryStore:
return InMemoryStore()
@pytest.fixture
def three_values(self) -> Tuple[str, str, str]: # type: ignore
return "value1", "value2", "value3"
def test_mget() -> None:
store = InMemoryStore()
store.mset([("key1", "value1"), ("key2", "value2")])