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

test_deprecated_model_warning_stream() — anthropic-sdk-python Function Reference

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

Function python AnthropicClient AsyncAPI calls 3 called by 1

Entity Profile

Dependency Diagram

graph TD
  f42894a9_1e28_d352_5d76_aa4d35f3716f["test_deprecated_model_warning_stream()"]
  58e51afa_63b8_b81d_14f4_b90e7b76512c["TestAsyncMessages"]
  f42894a9_1e28_d352_5d76_aa4d35f3716f -->|defined in| 58e51afa_63b8_b81d_14f4_b90e7b76512c
  2eb8e093_0b72_7084_6802_ae8ae503a89a["test_deprecated_model_warning_stream()"]
  2eb8e093_0b72_7084_6802_ae8ae503a89a -->|calls| f42894a9_1e28_d352_5d76_aa4d35f3716f
  2eb8e093_0b72_7084_6802_ae8ae503a89a["test_deprecated_model_warning_stream()"]
  f42894a9_1e28_d352_5d76_aa4d35f3716f -->|calls| 2eb8e093_0b72_7084_6802_ae8ae503a89a
  cb02636d_b74b_7724_2966_191b6bc19c0f["to_async_iter()"]
  f42894a9_1e28_d352_5d76_aa4d35f3716f -->|calls| cb02636d_b74b_7724_2966_191b6bc19c0f
  d1b2725b_0ccb_90ce_868b_51db8c397a89["get_response()"]
  f42894a9_1e28_d352_5d76_aa4d35f3716f -->|calls| d1b2725b_0ccb_90ce_868b_51db8c397a89
  style f42894a9_1e28_d352_5d76_aa4d35f3716f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/lib/streaming/test_messages.py lines 236–249

    async def test_deprecated_model_warning_stream(self, respx_mock: MockRouter) -> None:
        for deprecated_model in DEPRECATED_MODELS:
            respx_mock.post("/v1/messages").mock(
                return_value=httpx.Response(200, content=to_async_iter(get_response("basic_response.txt")))
            )

            with pytest.warns(DeprecationWarning, match=f"The model '{deprecated_model}' is deprecated"):
                async with async_client.messages.stream(
                    max_tokens=1024,
                    messages=[{"role": "user", "content": "Hello"}],
                    model=deprecated_model,
                ) as stream:
                    # Consume the stream to ensure the warning is triggered
                    await stream.get_final_message()

Subdomains

Frequently Asked Questions

What does test_deprecated_model_warning_stream() do?
test_deprecated_model_warning_stream() is a function in the anthropic-sdk-python codebase, defined in tests/lib/streaming/test_messages.py.
Where is test_deprecated_model_warning_stream() defined?
test_deprecated_model_warning_stream() is defined in tests/lib/streaming/test_messages.py at line 236.
What does test_deprecated_model_warning_stream() call?
test_deprecated_model_warning_stream() calls 3 function(s): get_response, test_deprecated_model_warning_stream, to_async_iter.
What calls test_deprecated_model_warning_stream()?
test_deprecated_model_warning_stream() is called by 1 function(s): test_deprecated_model_warning_stream.

Analyze Your Own Codebase

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

Try Supermodel Free