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

test_count_tokens_rejects_both_output_format_and_config() — anthropic-sdk-python Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  78e8056d_a807_a57f_b3b7_e6c4acd9cddc["test_count_tokens_rejects_both_output_format_and_config()"]
  268b39c2_fa64_757e_49eb_5b59eb7422f0["TestOutputConfigConflict"]
  78e8056d_a807_a57f_b3b7_e6c4acd9cddc -->|defined in| 268b39c2_fa64_757e_49eb_5b59eb7422f0
  style 78e8056d_a807_a57f_b3b7_e6c4acd9cddc fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/api_resources/beta/test_output_format_conversion.py lines 341–349

    def test_count_tokens_rejects_both_output_format_and_config(self, client: Anthropic) -> None:
        """Verify .count_tokens() raises error when both are provided."""
        with pytest.raises(AnthropicError, match="Both output_format and output_config.format were provided"):
            client.beta.messages.count_tokens(
                messages=[{"role": "user", "content": "Test"}],
                model="claude-sonnet-4-5",
                output_format={"type": "json_schema", "schema": {"type": "object"}},
                output_config={"format": {"type": "json_schema", "schema": {"type": "string"}}},
            )

Subdomains

Frequently Asked Questions

What does test_count_tokens_rejects_both_output_format_and_config() do?
test_count_tokens_rejects_both_output_format_and_config() is a function in the anthropic-sdk-python codebase, defined in tests/api_resources/beta/test_output_format_conversion.py.
Where is test_count_tokens_rejects_both_output_format_and_config() defined?
test_count_tokens_rejects_both_output_format_and_config() is defined in tests/api_resources/beta/test_output_format_conversion.py at line 341.

Analyze Your Own Codebase

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

Try Supermodel Free