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_messages.py from the anthropic-sdk-python codebase.

Function python AnthropicClient SyncAPI calls 4 called by 1

Entity Profile

Dependency Diagram

graph TD
  f6c26296_9449_f4e1_1c5a_123a02758efb["test_basic_response()"]
  58e51afa_63b8_b81d_14f4_b90e7b76512c["TestAsyncMessages"]
  f6c26296_9449_f4e1_1c5a_123a02758efb -->|defined in| 58e51afa_63b8_b81d_14f4_b90e7b76512c
  ce440b6f_3c48_2cbe_7590_84a80c8bb509["test_basic_response()"]
  ce440b6f_3c48_2cbe_7590_84a80c8bb509 -->|calls| f6c26296_9449_f4e1_1c5a_123a02758efb
  ce440b6f_3c48_2cbe_7590_84a80c8bb509["test_basic_response()"]
  f6c26296_9449_f4e1_1c5a_123a02758efb -->|calls| ce440b6f_3c48_2cbe_7590_84a80c8bb509
  cb02636d_b74b_7724_2966_191b6bc19c0f["to_async_iter()"]
  f6c26296_9449_f4e1_1c5a_123a02758efb -->|calls| cb02636d_b74b_7724_2966_191b6bc19c0f
  d1b2725b_0ccb_90ce_868b_51db8c397a89["get_response()"]
  f6c26296_9449_f4e1_1c5a_123a02758efb -->|calls| d1b2725b_0ccb_90ce_868b_51db8c397a89
  64ce2427_c16b_3c37_c170_cb822aa3dc26["assert_basic_response()"]
  f6c26296_9449_f4e1_1c5a_123a02758efb -->|calls| 64ce2427_c16b_3c37_c170_cb822aa3dc26
  style f6c26296_9449_f4e1_1c5a_123a02758efb fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/lib/streaming/test_messages.py lines 192–210

    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.messages.stream(
            max_tokens=1024,
            messages=[
                {
                    "role": "user",
                    "content": "Say hello there!",
                }
            ],
            model="claude-3-opus-latest",
        ) as stream:
            with pytest.warns(DeprecationWarning):
                assert isinstance(cast(Any, stream), AsyncStream)

            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_messages.py.
Where is test_basic_response() defined?
test_basic_response() is defined in tests/lib/streaming/test_messages.py at line 192.
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