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.

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

tests/lib/test_vertex.py lines 24–49

    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"}),
            ]
        )

        self.client.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 24.
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