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

test_basic_response() — anthropic-sdk-python Function Reference

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

Function python AnthropicClient SyncAPI calls 4 called by 1

Entity Profile

Dependency Diagram

graph TD
  71579650_ff21_691c_21c9_e39db60bb3bc["test_basic_response()"]
  3b785fa6_7fe8_27f9_a4b3_d1b931c9e188["TestAsyncMessages"]
  71579650_ff21_691c_21c9_e39db60bb3bc -->|defined in| 3b785fa6_7fe8_27f9_a4b3_d1b931c9e188
  da1cbf37_7a91_5789_d4cd_1ad1fab89ef7["test_basic_response()"]
  da1cbf37_7a91_5789_d4cd_1ad1fab89ef7 -->|calls| 71579650_ff21_691c_21c9_e39db60bb3bc
  da1cbf37_7a91_5789_d4cd_1ad1fab89ef7["test_basic_response()"]
  71579650_ff21_691c_21c9_e39db60bb3bc -->|calls| da1cbf37_7a91_5789_d4cd_1ad1fab89ef7
  cb02636d_b74b_7724_2966_191b6bc19c0f["to_async_iter()"]
  71579650_ff21_691c_21c9_e39db60bb3bc -->|calls| cb02636d_b74b_7724_2966_191b6bc19c0f
  d1b2725b_0ccb_90ce_868b_51db8c397a89["get_response()"]
  71579650_ff21_691c_21c9_e39db60bb3bc -->|calls| d1b2725b_0ccb_90ce_868b_51db8c397a89
  91cf480e_9510_5f3d_ae64_10ee575eb62f["assert_basic_response()"]
  71579650_ff21_691c_21c9_e39db60bb3bc -->|calls| 91cf480e_9510_5f3d_ae64_10ee575eb62f
  style 71579650_ff21_691c_21c9_e39db60bb3bc fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/lib/streaming/test_beta_messages.py lines 270–287

    async def test_basic_response(self, respx_mock: MockRouter) -> None:
        respx_mock.post("/v1/messages").mock(
            return_value=httpx.Response(200, content=to_async_iter(get_response("basic_response.txt")))
        )

        async with async_client.beta.messages.stream(
            max_tokens=1024,
            messages=[
                {
                    "role": "user",
                    "content": "Say hello there!",
                }
            ],
            model="claude-opus-4-0",
        ) as stream:
            assert isinstance(cast(Any, stream), BetaAsyncMessageStream)

            assert_basic_response([event async for event in stream], await stream.get_final_message())

Subdomains

Frequently Asked Questions

What does test_basic_response() do?
test_basic_response() is a function in the anthropic-sdk-python codebase, defined in tests/lib/streaming/test_beta_messages.py.
Where is test_basic_response() defined?
test_basic_response() is defined in tests/lib/streaming/test_beta_messages.py at line 270.
What does test_basic_response() call?
test_basic_response() calls 4 function(s): assert_basic_response, get_response, test_basic_response, to_async_iter.
What calls test_basic_response()?
test_basic_response() is called by 1 function(s): test_basic_response.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free