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

test_streaming_response_count_tokens() — anthropic-sdk-python Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  4794f635_d5a7_68c6_7d80_a0612d2c2908["test_streaming_response_count_tokens()"]
  8298da58_cf54_f234_c9e6_f284f44aa796["TestAsyncMessages"]
  4794f635_d5a7_68c6_7d80_a0612d2c2908 -->|defined in| 8298da58_cf54_f234_c9e6_f284f44aa796
  8a59ae29_7f77_64fb_76da_3feb0afd5e6b["test_streaming_response_count_tokens()"]
  8a59ae29_7f77_64fb_76da_3feb0afd5e6b -->|calls| 4794f635_d5a7_68c6_7d80_a0612d2c2908
  8a59ae29_7f77_64fb_76da_3feb0afd5e6b["test_streaming_response_count_tokens()"]
  4794f635_d5a7_68c6_7d80_a0612d2c2908 -->|calls| 8a59ae29_7f77_64fb_76da_3feb0afd5e6b
  08e9c9e7_d7f9_615f_5837_b3de69122e37["assert_matches_type()"]
  4794f635_d5a7_68c6_7d80_a0612d2c2908 -->|calls| 08e9c9e7_d7f9_615f_5837_b3de69122e37
  style 4794f635_d5a7_68c6_7d80_a0612d2c2908 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/api_resources/beta/test_messages.py lines 1105–1121

    async def test_streaming_response_count_tokens(self, async_client: AsyncAnthropic) -> None:
        async with async_client.beta.messages.with_streaming_response.count_tokens(
            messages=[
                {
                    "content": "string",
                    "role": "user",
                }
            ],
            model="claude-opus-4-6",
        ) as response:
            assert not response.is_closed
            assert response.http_request.headers.get("X-Stainless-Lang") == "python"

            message = await response.parse()
            assert_matches_type(BetaMessageTokensCount, message, path=["response"])

        assert cast(Any, response.is_closed) is True

Subdomains

Frequently Asked Questions

What does test_streaming_response_count_tokens() do?
test_streaming_response_count_tokens() is a function in the anthropic-sdk-python codebase, defined in tests/api_resources/beta/test_messages.py.
Where is test_streaming_response_count_tokens() defined?
test_streaming_response_count_tokens() is defined in tests/api_resources/beta/test_messages.py at line 1105.
What does test_streaming_response_count_tokens() call?
test_streaming_response_count_tokens() calls 2 function(s): assert_matches_type, test_streaming_response_count_tokens.
What calls test_streaming_response_count_tokens()?
test_streaming_response_count_tokens() is called by 1 function(s): test_streaming_response_count_tokens.

Analyze Your Own Codebase

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

Try Supermodel Free