standard-tests[minor]: Add standard tests for BaseStore (#23360)

Add standard tests to base store abstraction. These only work on [str,
str] right now. We'll need to check if it's possible to add
encoder/decoders to generalize
This commit is contained in:
Eugene Yurtsev
2024-06-24 15:38:50 -04:00
committed by GitHub
parent e1190c8f3c
commit 3b3ed72d35
2 changed files with 306 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
"""Tests for the InMemoryStore class."""
from typing import Tuple
import pytest
from langchain_core.stores import InMemoryStore
from langchain_standard_tests.integration_tests.base_store import (
BaseStoreAsyncTests,
BaseStoreSyncTests,
)
class TestInMemoryStore(BaseStoreSyncTests):
@pytest.fixture
def three_values(self) -> Tuple[str, str, str]:
return "foo", "bar", "buzz"
@pytest.fixture
def kv_store(self) -> InMemoryStore:
return InMemoryStore()
class TestInMemoryStoreAsync(BaseStoreAsyncTests):
@pytest.fixture
def three_values(self) -> Tuple[str, str, str]: # type: ignore
return "foo", "bar", "buzz"
@pytest.fixture
async def kv_store(self) -> InMemoryStore:
return InMemoryStore()