test_count_tokens_emits_deprecation_warning() — anthropic-sdk-python Function Reference
Architecture documentation for the test_count_tokens_emits_deprecation_warning() function in test_output_format_conversion.py from the anthropic-sdk-python codebase.
Entity Profile
Dependency Diagram
graph TD 51f83926_e8cf_a49f_77ef_77df83ecdc24["test_count_tokens_emits_deprecation_warning()"] 16f322e6_6eea_a8f2_83a5_9fdca56649bd["TestOutputFormatDeprecation"] 51f83926_e8cf_a49f_77ef_77df83ecdc24 -->|defined in| 16f322e6_6eea_a8f2_83a5_9fdca56649bd style 51f83926_e8cf_a49f_77ef_77df83ecdc24 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
tests/api_resources/beta/test_output_format_conversion.py lines 245–256
def test_count_tokens_emits_deprecation_warning(self, client: Anthropic, respx_mock: MockRouter) -> None:
"""Verify .count_tokens() emits DeprecationWarning when output_format is used."""
respx_mock.post("/v1/messages/count_tokens?beta=true").mock(
return_value=httpx.Response(200, json={"input_tokens": 10})
)
with pytest.warns(DeprecationWarning, match="output_format.*deprecated.*output_config.format"):
client.beta.messages.count_tokens(
messages=[{"role": "user", "content": "Test"}],
model="claude-sonnet-4-5",
output_format={"type": "json_schema", "schema": {"type": "array"}},
)
Domain
Subdomains
Source
Frequently Asked Questions
What does test_count_tokens_emits_deprecation_warning() do?
test_count_tokens_emits_deprecation_warning() 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_emits_deprecation_warning() defined?
test_count_tokens_emits_deprecation_warning() is defined in tests/api_resources/beta/test_output_format_conversion.py at line 245.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free