Home / Function/ test_basic_call_sync() — anthropic-sdk-python Function Reference

test_basic_call_sync() — anthropic-sdk-python Function Reference

Architecture documentation for the test_basic_call_sync() function in test_runners.py from the anthropic-sdk-python codebase.

Entity Profile

Dependency Diagram

graph TD
  49e71ebb_20f4_087e_7d45_f025ccd02165["test_basic_call_sync()"]
  6847e1ae_03a4_3e19_19ff_ea808e74d94c["TestSyncRunTools"]
  49e71ebb_20f4_087e_7d45_f025ccd02165 -->|defined in| 6847e1ae_03a4_3e19_19ff_ea808e74d94c
  be8a7f3a_5951_1f73_7331_3ad05c999ecf["_get_weather()"]
  49e71ebb_20f4_087e_7d45_f025ccd02165 -->|calls| be8a7f3a_5951_1f73_7331_3ad05c999ecf
  style 49e71ebb_20f4_087e_7d45_f025ccd02165 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/lib/tools/test_runners.py lines 81–107

    def test_basic_call_sync(self, client: Anthropic, respx_mock: MockRouter, monkeypatch: pytest.MonkeyPatch) -> None:
        @beta_tool
        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 = make_snapshot_request(
            lambda c: c.beta.messages.tool_runner(
                max_tokens=1024,
                model="claude-haiku-4-5",
                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=client,
            respx_mock=respx_mock,
        )

        assert print_obj(message, monkeypatch) == snapshots["basic"]["result"]

Subdomains

Frequently Asked Questions

What does test_basic_call_sync() do?
test_basic_call_sync() is a function in the anthropic-sdk-python codebase, defined in tests/lib/tools/test_runners.py.
Where is test_basic_call_sync() defined?
test_basic_call_sync() is defined in tests/lib/tools/test_runners.py at line 81.
What does test_basic_call_sync() call?
test_basic_call_sync() 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