Home / Function/ test_prompt_missing_vars_error() — langchain Function Reference

test_prompt_missing_vars_error() — langchain Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

libs/core/tests/unit_tests/prompts/test_prompt.py lines 651–660

def test_prompt_missing_vars_error() -> None:
    prompt = PromptTemplate.from_template("This is a {foo} {goingtobemissing} test.")
    with pytest.raises(KeyError) as e:
        prompt.invoke({"foo": "bar"})

    # Check that the error message contains the missing variable
    assert "{'goingtobemissing'}" in str(e.value.args[0])

    # Check helper text has right number of braces
    assert "'{{goingtobemissing}}'" in str(e.value.args[0])

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free