test_tool_use() — anthropic-sdk-python Function Reference
Architecture documentation for the test_tool_use() function in test_messages.py from the anthropic-sdk-python codebase.
Entity Profile
Dependency Diagram
graph TD ee7a56e8_2e83_4351_5d7c_8d9b27fba3d2["test_tool_use()"] dee3798b_de54_17a3_eda7_2fcb6484288c["TestSyncMessages"] ee7a56e8_2e83_4351_5d7c_8d9b27fba3d2 -->|defined in| dee3798b_de54_17a3_eda7_2fcb6484288c 5ebbac27_1dab_4a90_da3e_df522b071a97["test_tool_use()"] 5ebbac27_1dab_4a90_da3e_df522b071a97 -->|calls| ee7a56e8_2e83_4351_5d7c_8d9b27fba3d2 5ebbac27_1dab_4a90_da3e_df522b071a97["test_tool_use()"] ee7a56e8_2e83_4351_5d7c_8d9b27fba3d2 -->|calls| 5ebbac27_1dab_4a90_da3e_df522b071a97 d1b2725b_0ccb_90ce_868b_51db8c397a89["get_response()"] ee7a56e8_2e83_4351_5d7c_8d9b27fba3d2 -->|calls| d1b2725b_0ccb_90ce_868b_51db8c397a89 af77ac1b_27fe_6c86_65c8_5db8fbaa22dc["assert_tool_use_response()"] ee7a56e8_2e83_4351_5d7c_8d9b27fba3d2 -->|calls| af77ac1b_27fe_6c86_65c8_5db8fbaa22dc style ee7a56e8_2e83_4351_5d7c_8d9b27fba3d2 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
tests/lib/streaming/test_messages.py lines 168–186
def test_tool_use(self, respx_mock: MockRouter) -> None:
respx_mock.post("/v1/messages").mock(
return_value=httpx.Response(200, content=get_response("tool_use_response.txt"))
)
with sync_client.messages.stream(
max_tokens=1024,
messages=[
{
"role": "user",
"content": "Say hello there!",
}
],
model="claude-sonnet-4-20250514",
) as stream:
with pytest.warns(DeprecationWarning):
assert isinstance(cast(Any, stream), Stream)
assert_tool_use_response([event for event in stream], stream.get_final_message())
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does test_tool_use() do?
test_tool_use() is a function in the anthropic-sdk-python codebase, defined in tests/lib/streaming/test_messages.py.
Where is test_tool_use() defined?
test_tool_use() is defined in tests/lib/streaming/test_messages.py at line 168.
What does test_tool_use() call?
test_tool_use() calls 3 function(s): assert_tool_use_response, get_response, test_tool_use.
What calls test_tool_use()?
test_tool_use() is called by 1 function(s): test_tool_use.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free