test_basic_call_async() — anthropic-sdk-python Function Reference
Architecture documentation for the test_basic_call_async() function in test_runners.py from the anthropic-sdk-python codebase.
Entity Profile
Dependency Diagram
graph TD 2b3dba12_a276_98a4_6fd3_f9b5878e1c32["test_basic_call_async()"] 8ecd4321_1ed7_9c90_8d23_e61f807683d3["test_runners.py"] 2b3dba12_a276_98a4_6fd3_f9b5878e1c32 -->|defined in| 8ecd4321_1ed7_9c90_8d23_e61f807683d3 be8a7f3a_5951_1f73_7331_3ad05c999ecf["_get_weather()"] 2b3dba12_a276_98a4_6fd3_f9b5878e1c32 -->|calls| be8a7f3a_5951_1f73_7331_3ad05c999ecf style 2b3dba12_a276_98a4_6fd3_f9b5878e1c32 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
tests/lib/tools/test_runners.py lines 553–581
async def test_basic_call_async(
async_client: AsyncAnthropic, respx_mock: MockRouter, monkeypatch: pytest.MonkeyPatch
) -> None:
@beta_async_tool
async def get_weather(location: str, units: Literal["c", "f"]) -> BetaFunctionToolResultType:
"""Lookup the weather for a given city in either celsius or fahrenheit
Args:
location: The city and state, e.g. San Francisco, CA
units: Unit for the output, either 'c' for celsius or 'f' for fahrenheit
Returns:
A dictionary containing the location, temperature, and weather condition.
"""
return json.dumps(_get_weather(location, units))
message = await make_async_snapshot_request(
lambda c: c.beta.messages.tool_runner(
max_tokens=1024,
model="claude-3-7",
tools=[get_weather],
messages=[{"role": "user", "content": "What is the weather in SF?"}],
).until_done(),
content_snapshot=snapshots["basic"]["responses"],
path="/v1/messages",
mock_client=async_client,
respx_mock=respx_mock,
)
assert print_obj(message, monkeypatch) == snapshots["basic"]["result"]
Domain
Subdomains
Defined In
Calls
Source
Frequently Asked Questions
What does test_basic_call_async() do?
test_basic_call_async() is a function in the anthropic-sdk-python codebase, defined in tests/lib/tools/test_runners.py.
Where is test_basic_call_async() defined?
test_basic_call_async() is defined in tests/lib/tools/test_runners.py at line 553.
What does test_basic_call_async() call?
test_basic_call_async() calls 1 function(s): _get_weather.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free