test_prompt_from_file_with_partial_variables() — langchain Function Reference
Architecture documentation for the test_prompt_from_file_with_partial_variables() function in test_prompt.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 2cc35e04_a7a8_f4d7_c674_69d8bc22e62c["test_prompt_from_file_with_partial_variables()"] af1b998b_a7bf_9d5c_32ef_bab507a6bee3["test_prompt.py"] 2cc35e04_a7a8_f4d7_c674_69d8bc22e62c -->|defined in| af1b998b_a7bf_9d5c_32ef_bab507a6bee3 style 2cc35e04_a7a8_f4d7_c674_69d8bc22e62c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/prompts/test_prompt.py lines 361–380
def test_prompt_from_file_with_partial_variables() -> None:
"""Test prompt from file with partial variables.
Test prompt can be successfully constructed from a file with partial variables.
"""
# given
template = "This is a {foo} test {bar}."
partial_variables = {"bar": "baz"}
# when
with mock.patch("pathlib.Path.open", mock.mock_open(read_data=template)):
prompt = PromptTemplate.from_file(
"mock_file_name", partial_variables=partial_variables
)
# then
expected_prompt = PromptTemplate(
template=template,
input_variables=["foo"],
partial_variables=partial_variables,
)
assert prompt == expected_prompt
Domain
Subdomains
Source
Frequently Asked Questions
What does test_prompt_from_file_with_partial_variables() do?
test_prompt_from_file_with_partial_variables() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/prompts/test_prompt.py.
Where is test_prompt_from_file_with_partial_variables() defined?
test_prompt_from_file_with_partial_variables() is defined in libs/core/tests/unit_tests/prompts/test_prompt.py at line 361.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free