test_lc_store.py — langchain Source File
Architecture documentation for test_lc_store.py, a python file in the langchain codebase. 7 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 7bebc3db_9f0f_839e_6892_a5b6e7890c14["test_lc_store.py"] d47804b2_9963_be65_f855_93c7c6a0eab8["tempfile"] 7bebc3db_9f0f_839e_6892_a5b6e7890c14 --> d47804b2_9963_be65_f855_93c7c6a0eab8 cfe2bde5_180e_e3b0_df2b_55b3ebaca8e7["collections.abc"] 7bebc3db_9f0f_839e_6892_a5b6e7890c14 --> cfe2bde5_180e_e3b0_df2b_55b3ebaca8e7 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3["typing"] 7bebc3db_9f0f_839e_6892_a5b6e7890c14 --> 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3 120e2591_3e15_b895_72b6_cb26195e40a6["pytest"] 7bebc3db_9f0f_839e_6892_a5b6e7890c14 --> 120e2591_3e15_b895_72b6_cb26195e40a6 c554676d_b731_47b2_a98f_c1c2d537c0aa["langchain_core.documents"] 7bebc3db_9f0f_839e_6892_a5b6e7890c14 --> c554676d_b731_47b2_a98f_c1c2d537c0aa aa26d4cf_7506_d0bd_5c39_6056e46f2c85["langchain_classic.storage._lc_store"] 7bebc3db_9f0f_839e_6892_a5b6e7890c14 --> aa26d4cf_7506_d0bd_5c39_6056e46f2c85 558dc521_5525_3944_3516_758d65922590["langchain_classic.storage.file_system"] 7bebc3db_9f0f_839e_6892_a5b6e7890c14 --> 558dc521_5525_3944_3516_758d65922590 style 7bebc3db_9f0f_839e_6892_a5b6e7890c14 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import tempfile
from collections.abc import Generator
from typing import cast
import pytest
from langchain_core.documents import Document
from langchain_classic.storage._lc_store import create_kv_docstore, create_lc_store
from langchain_classic.storage.file_system import LocalFileStore
@pytest.fixture
def file_store() -> Generator[LocalFileStore, None, None]:
# Create a temporary directory for testing
with tempfile.TemporaryDirectory() as temp_dir:
# Instantiate the LocalFileStore with the temporary directory as the root path
store = LocalFileStore(temp_dir)
yield store
def test_create_lc_store(file_store: LocalFileStore) -> None:
"""Test that a docstore is created from a base store."""
docstore = create_lc_store(file_store)
docstore.mset([("key1", Document(page_content="hello", metadata={"key": "value"}))])
fetched_doc = cast("Document", docstore.mget(["key1"])[0])
assert fetched_doc.page_content == "hello"
assert fetched_doc.metadata == {"key": "value"}
def test_create_kv_store(file_store: LocalFileStore) -> None:
"""Test that a docstore is created from a base store."""
docstore = create_kv_docstore(file_store)
docstore.mset([("key1", Document(page_content="hello", metadata={"key": "value"}))])
fetched_doc = docstore.mget(["key1"])[0]
assert isinstance(fetched_doc, Document)
assert fetched_doc.page_content == "hello"
assert fetched_doc.metadata == {"key": "value"}
Domain
Subdomains
Dependencies
- collections.abc
- langchain_classic.storage._lc_store
- langchain_classic.storage.file_system
- langchain_core.documents
- pytest
- tempfile
- typing
Source
Frequently Asked Questions
What does test_lc_store.py do?
test_lc_store.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, RunnableInterface subdomain.
What functions are defined in test_lc_store.py?
test_lc_store.py defines 3 function(s): file_store, test_create_kv_store, test_create_lc_store.
What does test_lc_store.py depend on?
test_lc_store.py imports 7 module(s): collections.abc, langchain_classic.storage._lc_store, langchain_classic.storage.file_system, langchain_core.documents, pytest, tempfile, typing.
Where is test_lc_store.py in the architecture?
test_lc_store.py is located at libs/langchain/tests/unit_tests/storage/test_lc_store.py (domain: CoreAbstractions, subdomain: RunnableInterface, directory: libs/langchain/tests/unit_tests/storage).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free