Home / Function/ test_format_doc_with_metadata() — langchain Function Reference

test_format_doc_with_metadata() — langchain Function Reference

Architecture documentation for the test_format_doc_with_metadata() function in test_combine_documents.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  29ea7375_30b2_e078_82d8_1ef1233592cf["test_format_doc_with_metadata()"]
  fdcbc2e2_7fde_290c_7006_d84e63536c57["test_combine_documents.py"]
  29ea7375_30b2_e078_82d8_1ef1233592cf -->|defined in| fdcbc2e2_7fde_290c_7006_d84e63536c57
  style 29ea7375_30b2_e078_82d8_1ef1233592cf fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/tests/unit_tests/chains/test_combine_documents.py lines 125–136

async def test_format_doc_with_metadata() -> None:
    """Test format doc on a valid document."""
    doc = Document(page_content="foo", metadata={"bar": "baz"})
    prompt = PromptTemplate(
        input_variables=["page_content", "bar"],
        template="{page_content}, {bar}",
    )
    expected_output = "foo, baz"
    output = format_document(doc, prompt)
    assert output == expected_output
    output = await aformat_document(doc, prompt)
    assert output == expected_output

Domain

Subdomains

Frequently Asked Questions

What does test_format_doc_with_metadata() do?
test_format_doc_with_metadata() is a function in the langchain codebase, defined in libs/langchain/tests/unit_tests/chains/test_combine_documents.py.
Where is test_format_doc_with_metadata() defined?
test_format_doc_with_metadata() is defined in libs/langchain/tests/unit_tests/chains/test_combine_documents.py at line 125.

Analyze Your Own Codebase

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

Try Supermodel Free