Home / File/ base_store.py — langchain Source File

base_store.py — langchain Source File

Architecture documentation for base_store.py, a python file in the langchain codebase. 6 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  ab32a486_8161_ae81_5956_d15d97c6646a["base_store.py"]
  cccbe73e_4644_7211_4d55_e8fb133a8014["abc"]
  ab32a486_8161_ae81_5956_d15d97c6646a --> cccbe73e_4644_7211_4d55_e8fb133a8014
  cfe2bde5_180e_e3b0_df2b_55b3ebaca8e7["collections.abc"]
  ab32a486_8161_ae81_5956_d15d97c6646a --> cfe2bde5_180e_e3b0_df2b_55b3ebaca8e7
  8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3["typing"]
  ab32a486_8161_ae81_5956_d15d97c6646a --> 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3
  120e2591_3e15_b895_72b6_cb26195e40a6["pytest"]
  ab32a486_8161_ae81_5956_d15d97c6646a --> 120e2591_3e15_b895_72b6_cb26195e40a6
  cf23aed0_f3dd_3cba_61aa_c00a3e5a1b92["langchain_core.stores"]
  ab32a486_8161_ae81_5956_d15d97c6646a --> cf23aed0_f3dd_3cba_61aa_c00a3e5a1b92
  86e12e47_abd3_7376_ceed_f0108db0965a["langchain_tests.base"]
  ab32a486_8161_ae81_5956_d15d97c6646a --> 86e12e47_abd3_7376_ceed_f0108db0965a
  style ab32a486_8161_ae81_5956_d15d97c6646a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"""Standard tests for the `BaseStore` abstraction.

We don't recommend implementing externally managed `BaseStore` abstractions at this
time.
"""

from abc import abstractmethod
from collections.abc import AsyncGenerator, Generator
from typing import Generic, TypeVar

import pytest
from langchain_core.stores import BaseStore

from langchain_tests.base import BaseStandardTests

V = TypeVar("V")


class BaseStoreSyncTests(BaseStandardTests, Generic[V]):
    """Test suite for checking the key-value API of a `BaseStore`.

    This test suite verifies the basic key-value API of a `BaseStore`.

    The test suite is designed for synchronous key-value stores.

    Implementers should subclass this test suite and provide a fixture
    that returns an empty key-value store for each test.
    """

    @abstractmethod
    @pytest.fixture
    def kv_store(self) -> BaseStore[str, V]:
        """Get the key-value store class to test.

        The returned key-value store should be EMPTY.
        """

    @abstractmethod
    @pytest.fixture
    def three_values(self) -> tuple[V, V, V]:
        """Three example values that will be used in the tests."""

    def test_three_values(self, three_values: tuple[V, V, V]) -> None:
        """Test that the fixture provides three values."""
        assert isinstance(three_values, tuple)
        assert len(three_values) == 3

    def test_kv_store_is_empty(self, kv_store: BaseStore[str, V]) -> None:
        """Test that the key-value store is empty."""
        keys = ["foo", "bar", "buzz"]
        assert kv_store.mget(keys) == [None, None, None]

    def test_set_and_get_values(
        self,
        kv_store: BaseStore[str, V],
        three_values: tuple[V, V, V],
    ) -> None:
        """Test setting and getting values in the key-value store."""
        foo = three_values[0]
        bar = three_values[1]
// ... (256 more lines)

Subdomains

Dependencies

  • abc
  • collections.abc
  • langchain_core.stores
  • langchain_tests.base
  • pytest
  • typing

Frequently Asked Questions

What does base_store.py do?
base_store.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, RunnableInterface subdomain.
What does base_store.py depend on?
base_store.py imports 6 module(s): abc, collections.abc, langchain_core.stores, langchain_tests.base, pytest, typing.
Where is base_store.py in the architecture?
base_store.py is located at libs/standard-tests/langchain_tests/integration_tests/base_store.py (domain: CoreAbstractions, subdomain: RunnableInterface, directory: libs/standard-tests/langchain_tests/integration_tests).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free