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 SyncAPI calls 1 called by 1

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

tests/test_client.py lines 950–978

    def test_omit_retry_count_header(
        self, client: Anthropic, failures_before_success: int, respx_mock: MockRouter
    ) -> None:
        client = 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 = 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 950.
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