From d7140f7c16554dfacdac642173516625f2540496 Mon Sep 17 00:00:00 2001 From: Stainless Bot <107565488+stainless-bot@users.noreply.github.com> Date: Wed, 17 Jan 2024 10:51:45 -0500 Subject: [PATCH] chore(internal): remove redundant client test (#311) --- tests/test_client.py | 47 -------------------------------------------- 1 file changed, 47 deletions(-) diff --git a/tests/test_client.py b/tests/test_client.py index 531e905f..d1e59b45 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -20,7 +20,6 @@ from anthropic._types import Omit from anthropic._client import Anthropic, AsyncAnthropic from anthropic._models import BaseModel, FinalRequestOptions -from anthropic._response import APIResponse, AsyncAPIResponse from anthropic._constants import RAW_RESPONSE_HEADER from anthropic._streaming import Stream, AsyncStream from anthropic._exceptions import APIStatusError, APITimeoutError, APIResponseValidationError @@ -772,29 +771,6 @@ def test_parse_retry_after_header(self, remaining_retries: int, retry_after: str calculated = client._calculate_retry_timeout(remaining_retries, options, headers) assert calculated == pytest.approx(timeout, 0.5 * 0.875) # pyright: ignore[reportUnknownMemberType] - @mock.patch("anthropic._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) - @pytest.mark.respx(base_url=base_url) - def test_streaming_response(self) -> None: - response = self.client.post( - "/v1/complete", - body=dict( - max_tokens_to_sample=300, - model="claude-2.1", - prompt="\n\nHuman:Where can I get a good coffee in my neighbourhood?\n\nAssistant:", - ), - cast_to=APIResponse[bytes], - options={"headers": {RAW_RESPONSE_HEADER: "stream"}}, - ) - - assert not cast(Any, response.is_closed) - assert _get_open_connections(self.client) == 1 - - for _ in response.iter_bytes(): - ... - - assert cast(Any, response.is_closed) - assert _get_open_connections(self.client) == 0 - @mock.patch("anthropic._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> None: @@ -1568,29 +1544,6 @@ async def test_parse_retry_after_header(self, remaining_retries: int, retry_afte calculated = client._calculate_retry_timeout(remaining_retries, options, headers) assert calculated == pytest.approx(timeout, 0.5 * 0.875) # pyright: ignore[reportUnknownMemberType] - @mock.patch("anthropic._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) - @pytest.mark.respx(base_url=base_url) - async def test_streaming_response(self) -> None: - response = await self.client.post( - "/v1/complete", - body=dict( - max_tokens_to_sample=300, - model="claude-2.1", - prompt="\n\nHuman:Where can I get a good coffee in my neighbourhood?\n\nAssistant:", - ), - cast_to=AsyncAPIResponse[bytes], - options={"headers": {RAW_RESPONSE_HEADER: "stream"}}, - ) - - assert not cast(Any, response.is_closed) - assert _get_open_connections(self.client) == 1 - - async for _ in response.iter_bytes(): - ... - - assert cast(Any, response.is_closed) - assert _get_open_connections(self.client) == 0 - @mock.patch("anthropic._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> None: