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

test_messages_retries() — anthropic-sdk-python Function Reference

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

Function python AnthropicClient SyncAPI calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  c3f91a84_efa8_0579_b9be_ecfdfac60301["test_messages_retries()"]
  d3290b43_b727_3d0c_38d7_e3383a13bfe4["TestAsyncAnthropicVertex"]
  c3f91a84_efa8_0579_b9be_ecfdfac60301 -->|defined in| d3290b43_b727_3d0c_38d7_e3383a13bfe4
  3b3c7af1_44b3_cbc7_4c8d_4ea75f33e855["test_messages_retries()"]
  3b3c7af1_44b3_cbc7_4c8d_4ea75f33e855 -->|calls| c3f91a84_efa8_0579_b9be_ecfdfac60301
  3b3c7af1_44b3_cbc7_4c8d_4ea75f33e855["test_messages_retries()"]
  c3f91a84_efa8_0579_b9be_ecfdfac60301 -->|calls| 3b3c7af1_44b3_cbc7_4c8d_4ea75f33e855
  style c3f91a84_efa8_0579_b9be_ecfdfac60301 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/lib/test_vertex.py lines 154–179

    async def test_messages_retries(self, respx_mock: MockRouter) -> None:
        request_url = "https://region-aiplatform.googleapis.com/v1/projects/project/locations/region/publishers/anthropic/models/claude-3-sonnet@20240229:rawPredict"
        respx_mock.post(request_url).mock(
            side_effect=[
                httpx.Response(500, json={"error": "server error"}, headers={"retry-after-ms": "10"}),
                httpx.Response(200, json={"foo": "bar"}),
            ]
        )

        await self.client.with_options(timeout=0.2).messages.create(
            max_tokens=1024,
            messages=[
                {
                    "role": "user",
                    "content": "Say hello there!",
                }
            ],
            model="claude-3-sonnet@20240229",
        )

        calls = cast("list[MockRequestCall]", respx_mock.calls)

        assert len(calls) == 2

        assert calls[0].request.url == request_url
        assert calls[1].request.url == request_url

Subdomains

Frequently Asked Questions

What does test_messages_retries() do?
test_messages_retries() is a function in the anthropic-sdk-python codebase, defined in tests/lib/test_vertex.py.
Where is test_messages_retries() defined?
test_messages_retries() is defined in tests/lib/test_vertex.py at line 154.
What does test_messages_retries() call?
test_messages_retries() calls 1 function(s): test_messages_retries.
What calls test_messages_retries()?
test_messages_retries() is called by 1 function(s): test_messages_retries.

Analyze Your Own Codebase

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

Try Supermodel Free