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 AsyncAPI calls 3 called by 1

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

tests/lib/streaming/test_messages.py lines 110–128

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

        with sync_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), Stream)

            assert_basic_response([event for event in stream], 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 110.
What does test_basic_response() call?
test_basic_response() calls 3 function(s): assert_basic_response, get_response, test_basic_response.
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