test_override_single_attribute() — langchain Function Reference
Architecture documentation for the test_override_single_attribute() function in test_overrides.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 8fcb3ac8_0ca3_4b79_0913_d9434ad9bfbc["test_override_single_attribute()"] 5e5133af_311a_09ab_c36c_5325b6843847["TestModelRequestOverride"] 8fcb3ac8_0ca3_4b79_0913_d9434ad9bfbc -->|defined in| 5e5133af_311a_09ab_c36c_5325b6843847 style 8fcb3ac8_0ca3_4b79_0913_d9434ad9bfbc fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_overrides.py lines 24–46
def test_override_single_attribute(self) -> None:
"""Test overriding a single attribute."""
model = GenericFakeChatModel(messages=iter([AIMessage(content="Hello")]))
original_request = ModelRequest(
model=model,
system_message=SystemMessage("Original prompt"),
messages=[HumanMessage("Hi")],
tool_choice=None,
tools=[],
response_format=None,
state=AgentState(messages=[]),
runtime=None,
)
new_request = original_request.override(system_message=SystemMessage("New prompt"))
# New request should have the overridden value
assert new_request.system_prompt == "New prompt"
# Original request should be unchanged (immutability)
assert original_request.system_prompt == "Original prompt"
# Other attributes should be the same
assert new_request.model == original_request.model
assert new_request.messages == original_request.messages
Domain
Subdomains
Source
Frequently Asked Questions
What does test_override_single_attribute() do?
test_override_single_attribute() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_overrides.py.
Where is test_override_single_attribute() defined?
test_override_single_attribute() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_overrides.py at line 24.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free