test_override_preserves_identity_of_unchanged_objects() — langchain Function Reference
Architecture documentation for the test_override_preserves_identity_of_unchanged_objects() function in test_overrides.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 23f0a0fc_1a3a_a740_8cb9_f3f7eda66ec6["test_override_preserves_identity_of_unchanged_objects()"] 5e5133af_311a_09ab_c36c_5325b6843847["TestModelRequestOverride"] 23f0a0fc_1a3a_a740_8cb9_f3f7eda66ec6 -->|defined in| 5e5133af_311a_09ab_c36c_5325b6843847 style 23f0a0fc_1a3a_a740_8cb9_f3f7eda66ec6 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_overrides.py lines 151–174
def test_override_preserves_identity_of_unchanged_objects(self) -> None:
"""Test that unchanged attributes maintain object identity."""
model = GenericFakeChatModel(messages=iter([AIMessage(content="Hello")]))
messages: list[AnyMessage] = [HumanMessage("Hi")]
state = AgentState[Any](messages=[])
original_request = ModelRequest(
model=model,
system_message=SystemMessage("Original prompt"),
messages=messages,
tool_choice=None,
tools=[],
response_format=None,
state=state,
runtime=None,
)
new_request = original_request.override(system_message=SystemMessage("New prompt"))
# Unchanged objects should be the same instance
assert new_request.messages is messages
assert new_request.state is state
assert new_request.model is model
Domain
Subdomains
Source
Frequently Asked Questions
What does test_override_preserves_identity_of_unchanged_objects() do?
test_override_preserves_identity_of_unchanged_objects() 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_preserves_identity_of_unchanged_objects() defined?
test_override_preserves_identity_of_unchanged_objects() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_overrides.py at line 151.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free