Home / Function/ test_metadata_not_shallow() — langchain Function Reference

test_metadata_not_shallow() — langchain Function Reference

Architecture documentation for the test_metadata_not_shallow() function in test_text_splitters.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  25eacccc_3270_a55b_5dfa_ae8943dd71a6["test_metadata_not_shallow()"]
  6d6b8ad4_1cfe_fbb0_e58e_76a50487c135["test_text_splitters.py"]
  25eacccc_3270_a55b_5dfa_ae8943dd71a6 -->|defined in| 6d6b8ad4_1cfe_fbb0_e58e_76a50487c135
  style 25eacccc_3270_a55b_5dfa_ae8943dd71a6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/text-splitters/tests/unit_tests/test_text_splitters.py lines 360–372

def test_metadata_not_shallow() -> None:
    """Test that metadatas are not shallow."""
    texts = ["foo bar"]
    splitter = CharacterTextSplitter(separator=" ", chunk_size=3, chunk_overlap=0)
    docs = splitter.create_documents(texts, [{"source": "1"}])
    expected_docs = [
        Document(page_content="foo", metadata={"source": "1"}),
        Document(page_content="bar", metadata={"source": "1"}),
    ]
    assert docs == expected_docs
    docs[0].metadata["foo"] = 1
    assert docs[0].metadata == {"source": "1", "foo": 1}
    assert docs[1].metadata == {"source": "1"}

Domain

Subdomains

Frequently Asked Questions

What does test_metadata_not_shallow() do?
test_metadata_not_shallow() is a function in the langchain codebase, defined in libs/text-splitters/tests/unit_tests/test_text_splitters.py.
Where is test_metadata_not_shallow() defined?
test_metadata_not_shallow() is defined in libs/text-splitters/tests/unit_tests/test_text_splitters.py at line 360.

Analyze Your Own Codebase

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

Try Supermodel Free