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

test_omit_retry_count_header() — anthropic-sdk-python Function Reference

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

Function python AnthropicClient AsyncAPI calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  833a2208_3f09_cba7_71d2_72d7c2b4e4df["test_omit_retry_count_header()"]
  9bf4cfe0_e3b0_70de_25ac_2113c8918900["TestAsyncAnthropic"]
  833a2208_3f09_cba7_71d2_72d7c2b4e4df -->|defined in| 9bf4cfe0_e3b0_70de_25ac_2113c8918900
  5af1ef79_9f74_a41d_94b1_152fb5ad662c["test_omit_retry_count_header()"]
  5af1ef79_9f74_a41d_94b1_152fb5ad662c -->|calls| 833a2208_3f09_cba7_71d2_72d7c2b4e4df
  5af1ef79_9f74_a41d_94b1_152fb5ad662c["test_omit_retry_count_header()"]
  833a2208_3f09_cba7_71d2_72d7c2b4e4df -->|calls| 5af1ef79_9f74_a41d_94b1_152fb5ad662c
  style 833a2208_3f09_cba7_71d2_72d7c2b4e4df fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_client.py lines 1949–1977

    async def test_omit_retry_count_header(
        self, async_client: AsyncAnthropic, failures_before_success: int, respx_mock: MockRouter
    ) -> None:
        client = async_client.with_options(max_retries=4)

        nb_retries = 0

        def retry_handler(_request: httpx.Request) -> httpx.Response:
            nonlocal nb_retries
            if nb_retries < failures_before_success:
                nb_retries += 1
                return httpx.Response(500)
            return httpx.Response(200)

        respx_mock.post("/v1/messages").mock(side_effect=retry_handler)

        response = await client.messages.with_raw_response.create(
            max_tokens=1024,
            messages=[
                {
                    "content": "Hello, world",
                    "role": "user",
                }
            ],
            model="claude-opus-4-6",
            extra_headers={"x-stainless-retry-count": Omit()},
        )

        assert len(response.http_request.headers.get_list("x-stainless-retry-count")) == 0

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free