MCPcopy
hub / github.com/openai/openai-python / test_parse_retry_after_header

Method test_parse_retry_after_header

tests/test_client.py:1100–1106  ·  view source on GitHub ↗
(
        self, remaining_retries: int, retry_after: str, timeout: float, client: OpenAI
    )

Source from the content-addressed store, hash-verified

1098 )
1099 @mock.patch("time.time", mock.MagicMock(return_value=1696004797))
1100 def test_parse_retry_after_header(
1101 self, remaining_retries: int, retry_after: str, timeout: float, client: OpenAI
1102 ) -> None:
1103 headers = httpx.Headers({"retry-after": retry_after})
1104 options = FinalRequestOptions(method="get", url="/foo", max_retries=3)
1105 calculated = client._calculate_retry_timeout(remaining_retries, options, headers)
1106 assert calculated == pytest.approx(timeout, 0.5 * 0.875) # pyright: ignore[reportUnknownMemberType]
1107
1108 @mock.patch("openai._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
1109 @pytest.mark.respx(base_url=base_url)

Callers

nothing calls this directly

Calls 2

FinalRequestOptionsClass · 0.90

Tested by

no test coverage detected