test_override_preserves_identity() — langchain Function Reference
Architecture documentation for the test_override_preserves_identity() function in test_overrides.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD f7c7d58e_00b2_ff3a_7d7c_75db373d9868["test_override_preserves_identity()"] fe9405ec_9f76_8e01_a9d8_c9a8313d07fc["TestToolCallRequestOverride"] f7c7d58e_00b2_ff3a_7d7c_75db373d9868 -->|defined in| fe9405ec_9f76_8e01_a9d8_c9a8313d07fc style f7c7d58e_00b2_ff3a_7d7c_75db373d9868 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_overrides.py lines 387–410
def test_override_preserves_identity(self) -> None:
"""Test that unchanged attributes maintain object identity."""
@tool
def test_tool(x: int) -> str:
"""A test tool."""
return f"Result: {x}"
tool_call = ToolCall(name="test_tool", args={"x": 5}, id="1", type="tool_call")
state = AgentState[Any](messages=[])
original_request = ToolCallRequest(
tool_call=tool_call,
tool=test_tool,
state=state,
runtime=Mock(),
)
new_call = ToolCall(name="test_tool", args={"x": 10}, id="1", type="tool_call")
new_request = original_request.override(tool_call=new_call)
# Unchanged objects should be the same instance
assert new_request.tool is test_tool
assert new_request.state is state
Domain
Subdomains
Source
Frequently Asked Questions
What does test_override_preserves_identity() do?
test_override_preserves_identity() 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() defined?
test_override_preserves_identity() is defined in libs/langchain_v1/tests/unit_tests/agents/middleware/core/test_overrides.py at line 387.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free