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

test_method_count_tokens_with_all_params() — anthropic-sdk-python Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  792f9665_d0eb_15e8_ac70_f8761a12b788["test_method_count_tokens_with_all_params()"]
  8298da58_cf54_f234_c9e6_f284f44aa796["TestAsyncMessages"]
  792f9665_d0eb_15e8_ac70_f8761a12b788 -->|defined in| 8298da58_cf54_f234_c9e6_f284f44aa796
  e4ddf946_553a_8255_2e95_abf83c8cd9b3["test_method_count_tokens_with_all_params()"]
  e4ddf946_553a_8255_2e95_abf83c8cd9b3 -->|calls| 792f9665_d0eb_15e8_ac70_f8761a12b788
  e4ddf946_553a_8255_2e95_abf83c8cd9b3["test_method_count_tokens_with_all_params()"]
  792f9665_d0eb_15e8_ac70_f8761a12b788 -->|calls| e4ddf946_553a_8255_2e95_abf83c8cd9b3
  08e9c9e7_d7f9_615f_5837_b3de69122e37["assert_matches_type()"]
  792f9665_d0eb_15e8_ac70_f8761a12b788 -->|calls| 08e9c9e7_d7f9_615f_5837_b3de69122e37
  style 792f9665_d0eb_15e8_ac70_f8761a12b788 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/api_resources/beta/test_messages.py lines 975–1083

    async def test_method_count_tokens_with_all_params(self, async_client: AsyncAnthropic) -> None:
        message = await async_client.beta.messages.count_tokens(
            messages=[
                {
                    "content": "string",
                    "role": "user",
                }
            ],
            model="claude-opus-4-6",
            context_management={
                "edits": [
                    {
                        "type": "clear_tool_uses_20250919",
                        "clear_at_least": {
                            "type": "input_tokens",
                            "value": 0,
                        },
                        "clear_tool_inputs": True,
                        "exclude_tools": ["string"],
                        "keep": {
                            "type": "tool_uses",
                            "value": 0,
                        },
                        "trigger": {
                            "type": "input_tokens",
                            "value": 1,
                        },
                    }
                ]
            },
            mcp_servers=[
                {
                    "name": "name",
                    "type": "url",
                    "url": "url",
                    "authorization_token": "authorization_token",
                    "tool_configuration": {
                        "allowed_tools": ["string"],
                        "enabled": True,
                    },
                }
            ],
            output_config={
                "effort": "low",
                "format": {
                    "schema": {"foo": "bar"},
                    "type": "json_schema",
                },
            },
            output_format={
                "schema": {"foo": "bar"},
                "type": "json_schema",
            },
            speed="fast",
            system=[
                {
                    "text": "Today's date is 2024-06-01.",
                    "type": "text",
                    "cache_control": {
                        "type": "ephemeral",
                        "ttl": "5m",
                    },
                    "citations": [
                        {
                            "cited_text": "cited_text",
                            "document_index": 0,
                            "document_title": "x",
                            "end_char_index": 0,
                            "start_char_index": 0,
                            "type": "char_location",
                        }
                    ],
                }
            ],
            thinking={
                "budget_tokens": 1024,
                "type": "enabled",
            },
            tool_choice={
                "type": "auto",
                "disable_parallel_tool_use": True,

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free