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

test_parse_emits_deprecation_warning() — anthropic-sdk-python Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  3f797b55_92a4_87aa_a7f9_5c348c904f2e["test_parse_emits_deprecation_warning()"]
  16f322e6_6eea_a8f2_83a5_9fdca56649bd["TestOutputFormatDeprecation"]
  3f797b55_92a4_87aa_a7f9_5c348c904f2e -->|defined in| 16f322e6_6eea_a8f2_83a5_9fdca56649bd
  style 3f797b55_92a4_87aa_a7f9_5c348c904f2e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/api_resources/beta/test_output_format_conversion.py lines 190–217

    def test_parse_emits_deprecation_warning(self, client: Anthropic, respx_mock: MockRouter) -> None:
        """Verify .parse() emits DeprecationWarning when output_format is used."""

        class SimpleModel(BaseModel):
            value: str

        respx_mock.post("/v1/messages?beta=true").mock(
            return_value=httpx.Response(
                200,
                json={
                    "id": "msg_123",
                    "type": "message",
                    "role": "assistant",
                    "model": "claude-sonnet-4-5",
                    "content": [{"text": '{"value": "test"}', "type": "text"}],
                    "stop_reason": "end_turn",
                    "usage": {"input_tokens": 10, "output_tokens": 20},
                },
            )
        )

        with pytest.warns(DeprecationWarning, match="output_format.*deprecated.*output_config.format"):
            client.beta.messages.parse(
                max_tokens=1024,
                messages=[{"role": "user", "content": "Test"}],
                model="claude-sonnet-4-5",
                output_format=SimpleModel,
            )

Subdomains

Frequently Asked Questions

What does test_parse_emits_deprecation_warning() do?
test_parse_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_parse_emits_deprecation_warning() defined?
test_parse_emits_deprecation_warning() is defined in tests/api_resources/beta/test_output_format_conversion.py at line 190.

Analyze Your Own Codebase

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

Try Supermodel Free