Home / Function/ test_partial() — langchain Function Reference

test_partial() — langchain Function Reference

Architecture documentation for the test_partial() function in test_prompt.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  afce914f_f4b2_4606_69cf_3779fde15414["test_partial()"]
  af1b998b_a7bf_9d5c_32ef_bab507a6bee3["test_prompt.py"]
  afce914f_f4b2_4606_69cf_3779fde15414 -->|defined in| af1b998b_a7bf_9d5c_32ef_bab507a6bee3
  style afce914f_f4b2_4606_69cf_3779fde15414 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/tests/unit_tests/prompts/test_prompt.py lines 407–417

def test_partial() -> None:
    """Test prompt can be partialed."""
    template = "This is a {foo} test."
    prompt = PromptTemplate(input_variables=["foo"], template=template)
    assert prompt.template == template
    assert prompt.input_variables == ["foo"]
    new_prompt = prompt.partial(foo="3")
    new_result = new_prompt.format()
    assert new_result == "This is a 3 test."
    result = prompt.format(foo="foo")
    assert result == "This is a foo test."

Subdomains

Frequently Asked Questions

What does test_partial() do?
test_partial() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/prompts/test_prompt.py.
Where is test_partial() defined?
test_partial() is defined in libs/core/tests/unit_tests/prompts/test_prompt.py at line 407.

Analyze Your Own Codebase

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

Try Supermodel Free