Skip to content

Commit

Permalink
chore(internal): cast type in mocked test (#326)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot committed Jan 31, 2024
1 parent 6bd4ba9 commit c92896b
Showing 1 changed file with 28 additions and 16 deletions.
44 changes: 28 additions & 16 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -808,10 +808,13 @@ def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> No
with pytest.raises(APITimeoutError):
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:",
body=cast(
object,
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=httpx.Response,
options={"headers": {RAW_RESPONSE_HEADER: "stream"}},
Expand All @@ -827,10 +830,13 @@ def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) -> Non
with pytest.raises(APIStatusError):
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:",
body=cast(
object,
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=httpx.Response,
options={"headers": {RAW_RESPONSE_HEADER: "stream"}},
Expand Down Expand Up @@ -1610,10 +1616,13 @@ async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter)
with pytest.raises(APITimeoutError):
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:",
body=cast(
object,
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=httpx.Response,
options={"headers": {RAW_RESPONSE_HEADER: "stream"}},
Expand All @@ -1629,10 +1638,13 @@ async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter)
with pytest.raises(APIStatusError):
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:",
body=cast(
object,
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=httpx.Response,
options={"headers": {RAW_RESPONSE_HEADER: "stream"}},
Expand Down

0 comments on commit c92896b

Please sign in to comment.