Home / Function/ test_to_document() — langchain Function Reference

test_to_document() — langchain Function Reference

Architecture documentation for the test_to_document() function in test_hashed_document.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  14963e43_4c1e_5dd5_4d47_e38cd4be2af5["test_to_document()"]
  ff1be92f_01d3_2f18_b6ed_c7119b2a77ec["test_hashed_document.py"]
  14963e43_4c1e_5dd5_4d47_e38cd4be2af5 -->|defined in| ff1be92f_01d3_2f18_b6ed_c7119b2a77ec
  style 14963e43_4c1e_5dd5_4d47_e38cd4be2af5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/indexing/test_hashed_document.py lines 15–24

def test_to_document() -> None:
    """Test to_document method."""
    original_doc = Document(
        page_content="Lorem ipsum dolor sit amet", metadata={"key": "value"}
    )
    hashed_doc = _get_document_with_hash(original_doc, key_encoder="sha1")
    assert isinstance(hashed_doc, Document)
    assert hashed_doc is not original_doc
    assert hashed_doc.page_content == "Lorem ipsum dolor sit amet"
    assert hashed_doc.metadata["key"] == "value"

Domain

Subdomains

Frequently Asked Questions

What does test_to_document() do?
test_to_document() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/indexing/test_hashed_document.py.
Where is test_to_document() defined?
test_to_document() is defined in libs/core/tests/unit_tests/indexing/test_hashed_document.py at line 15.

Analyze Your Own Codebase

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

Try Supermodel Free