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

test_incomplete_response() — anthropic-sdk-python Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  f7761867_036e_f45b_09c1_0edd0d7dfaaa["test_incomplete_response()"]
  3b785fa6_7fe8_27f9_a4b3_d1b931c9e188["TestAsyncMessages"]
  f7761867_036e_f45b_09c1_0edd0d7dfaaa -->|defined in| 3b785fa6_7fe8_27f9_a4b3_d1b931c9e188
  cb02636d_b74b_7724_2966_191b6bc19c0f["to_async_iter()"]
  f7761867_036e_f45b_09c1_0edd0d7dfaaa -->|calls| cb02636d_b74b_7724_2966_191b6bc19c0f
  d1b2725b_0ccb_90ce_868b_51db8c397a89["get_response()"]
  f7761867_036e_f45b_09c1_0edd0d7dfaaa -->|calls| d1b2725b_0ccb_90ce_868b_51db8c397a89
  a2ff7c83_4d2b_9970_c545_c709b7a67707["assert_incomplete_partial_input_response()"]
  f7761867_036e_f45b_09c1_0edd0d7dfaaa -->|calls| a2ff7c83_4d2b_9970_c545_c709b7a67707
  style f7761867_036e_f45b_09c1_0edd0d7dfaaa fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/lib/streaming/test_beta_messages.py lines 351–372

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

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

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

Subdomains

Frequently Asked Questions

What does test_incomplete_response() do?
test_incomplete_response() is a function in the anthropic-sdk-python codebase, defined in tests/lib/streaming/test_beta_messages.py.
Where is test_incomplete_response() defined?
test_incomplete_response() is defined in tests/lib/streaming/test_beta_messages.py at line 351.
What does test_incomplete_response() call?
test_incomplete_response() calls 3 function(s): assert_incomplete_partial_input_response, get_response, to_async_iter.

Analyze Your Own Codebase

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

Try Supermodel Free