test_prompt_falsy_vars() — langchain Function Reference
Architecture documentation for the test_prompt_falsy_vars() function in test_prompt.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 34524317_6e6f_c4bd_6d0e_23b51fe51d98["test_prompt_falsy_vars()"] af1b998b_a7bf_9d5c_32ef_bab507a6bee3["test_prompt.py"] 34524317_6e6f_c4bd_6d0e_23b51fe51d98 -->|defined in| af1b998b_a7bf_9d5c_32ef_bab507a6bee3 style 34524317_6e6f_c4bd_6d0e_23b51fe51d98 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/prompts/test_prompt.py lines 627–648
def test_prompt_falsy_vars(
template_format: PromptTemplateFormat,
value: Any,
expected: str | dict[str, str],
) -> None:
# each line is value, f-string, mustache
if template_format == "f-string":
template = "{my_var}"
elif template_format == "mustache":
template = "{{my_var}}"
else:
msg = f"Invalid template format: {template_format}"
raise ValueError(msg)
prompt = PromptTemplate.from_template(template, template_format=template_format)
result = prompt.invoke({"my_var": value})
expected_output = (
expected if not isinstance(expected, dict) else expected[template_format]
)
assert result.to_string() == expected_output
Domain
Subdomains
Source
Frequently Asked Questions
What does test_prompt_falsy_vars() do?
test_prompt_falsy_vars() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/prompts/test_prompt.py.
Where is test_prompt_falsy_vars() defined?
test_prompt_falsy_vars() is defined in libs/core/tests/unit_tests/prompts/test_prompt.py at line 627.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free