Skip to content

Commit

Permalink
chore(internal): remove redundant client test (#122)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot authored Jan 17, 2024
1 parent 78c1927 commit 6403fe4
Showing 1 changed file with 0 additions and 47 deletions.
47 changes: 0 additions & 47 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from anthropic_bedrock import AnthropicBedrock, AsyncAnthropicBedrock, APIResponseValidationError
from anthropic_bedrock._client import AnthropicBedrock, AsyncAnthropicBedrock
from anthropic_bedrock._models import BaseModel, FinalRequestOptions
from anthropic_bedrock._response import APIResponse, AsyncAPIResponse
from anthropic_bedrock._constants import RAW_RESPONSE_HEADER
from anthropic_bedrock._streaming import Stream, AsyncStream
from anthropic_bedrock._exceptions import APIStatusError, APITimeoutError, APIResponseValidationError
Expand Down Expand Up @@ -786,29 +785,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_bedrock._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(
"/model/anthropic.claude-v2:1/invoke",
body=dict(
max_tokens_to_sample=300,
prompt="\n\nHuman:Where can I get a good coffee in my neighbourhood?\n\nAssistant:",
anthropic_version="bedrock-2023-05-31",
),
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_bedrock._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:
Expand Down Expand Up @@ -1587,29 +1563,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_bedrock._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(
"/model/anthropic.claude-v2:1/invoke",
body=dict(
max_tokens_to_sample=300,
prompt="\n\nHuman:Where can I get a good coffee in my neighbourhood?\n\nAssistant:",
anthropic_version="bedrock-2023-05-31",
),
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_bedrock._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:
Expand Down

0 comments on commit 6403fe4

Please sign in to comment.