MCPcopy
hub / github.com/langchain-ai/langchain / test_partial

Function test_partial

libs/core/tests/unit_tests/prompts/test_prompt.py:442–452  ·  view source on GitHub ↗

Test prompt can be partialed.

()

Source from the content-addressed store, hash-verified

440
441
442def test_partial() -> None:
443 """Test prompt can be partialed."""
444 template = "This is a {foo} test."
445 prompt = PromptTemplate(input_variables=["foo"], template=template)
446 assert prompt.template == template
447 assert prompt.input_variables == ["foo"]
448 new_prompt = prompt.partial(foo="3")
449 new_result = new_prompt.format()
450 assert new_result == "This is a 3 test."
451 result = prompt.format(foo="foo")
452 assert result == "This is a foo test."
453
454
455@pytest.mark.requires("jinja2")

Callers

nothing calls this directly

Calls 3

formatMethod · 0.95
PromptTemplateClass · 0.90
partialMethod · 0.45

Tested by

no test coverage detected