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

assert_basic_response() — anthropic-sdk-python Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  64ce2427_c16b_3c37_c170_cb822aa3dc26["assert_basic_response()"]
  8cc8cd20_a242_314f_b59d_2d554c624e7c["test_messages.py"]
  64ce2427_c16b_3c37_c170_cb822aa3dc26 -->|defined in| 8cc8cd20_a242_314f_b59d_2d554c624e7c
  ce440b6f_3c48_2cbe_7590_84a80c8bb509["test_basic_response()"]
  ce440b6f_3c48_2cbe_7590_84a80c8bb509 -->|calls| 64ce2427_c16b_3c37_c170_cb822aa3dc26
  f6c26296_9449_f4e1_1c5a_123a02758efb["test_basic_response()"]
  f6c26296_9449_f4e1_1c5a_123a02758efb -->|calls| 64ce2427_c16b_3c37_c170_cb822aa3dc26
  style 64ce2427_c16b_3c37_c170_cb822aa3dc26 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/lib/streaming/test_messages.py lines 29–53

def assert_basic_response(events: list[ParsedMessageStreamEvent[None]], message: Message) -> None:
    assert message.id == "msg_4QpJur2dWWDjF6C758FbBw5vm12BaVipnK"
    assert message.model == "claude-3-opus-latest"
    assert message.role == "assistant"
    assert message.stop_reason == "end_turn"
    assert message.stop_sequence is None
    assert message.type == "message"
    assert len(message.content) == 1

    content = message.content[0]
    assert content.type == "text"
    assert content.text == "Hello there!"

    assert [e.type for e in events] == [
        "message_start",
        "content_block_start",
        "content_block_delta",
        "text",
        "content_block_delta",
        "text",
        "content_block_delta",
        "text",
        "content_block_stop",
        "message_delta",
    ]

Subdomains

Frequently Asked Questions

What does assert_basic_response() do?
assert_basic_response() is a function in the anthropic-sdk-python codebase, defined in tests/lib/streaming/test_messages.py.
Where is assert_basic_response() defined?
assert_basic_response() is defined in tests/lib/streaming/test_messages.py at line 29.
What calls assert_basic_response()?
assert_basic_response() is called by 2 function(s): test_basic_response, test_basic_response.

Analyze Your Own Codebase

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

Try Supermodel Free