Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 9
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lmnt-kaikato-aryp6r%2Flmnt-com-cd6e35232b72c91b7c58a77e81bc12247f69f118ebfe24ee5b6bad5d59683ff6.yml
openapi_spec_hash: 657b7065d43bc0c630785b37195ff1e6
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lmnt-kaikato-aryp6r%2Flmnt-com-827123076176f4f90fe4bd0edfd38c6060c27a8266a249138a8bbd1f0340c411.yml
openapi_spec_hash: d46d69263715343fadacfedddde95b86
config_hash: ad76a808facacf5f53e58d591653bac6
2 changes: 1 addition & 1 deletion .sync_state
Original file line number Diff line number Diff line change
@@ -1 +1 @@
19a70f2d3733fb0c101046c37e116227f6f594f0
032105e41bd630ca3d0284654538b9065fa7c6ac
48 changes: 24 additions & 24 deletions tests/api_resources/test_speech.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_method_convert(self, client: Lmnt, respx_mock: MockRouter) -> None:
respx_mock.post("/v1/ai/speech/convert").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
speech = client.speech.convert(
audio=b"raw file contents",
voice="ava",
voice="leah",
)
assert speech.is_closed
assert speech.json() == {"foo": "bar"}
Expand All @@ -46,7 +46,7 @@ def test_method_convert_with_all_params(self, client: Lmnt, respx_mock: MockRout
respx_mock.post("/v1/ai/speech/convert").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
speech = client.speech.convert(
audio=b"raw file contents",
voice="ava",
voice="leah",
format="aac",
language="auto",
sample_rate=8000,
Expand All @@ -63,7 +63,7 @@ def test_raw_response_convert(self, client: Lmnt, respx_mock: MockRouter) -> Non

speech = client.speech.with_raw_response.convert(
audio=b"raw file contents",
voice="ava",
voice="leah",
)

assert speech.is_closed is True
Expand All @@ -77,7 +77,7 @@ def test_streaming_response_convert(self, client: Lmnt, respx_mock: MockRouter)
respx_mock.post("/v1/ai/speech/convert").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
with client.speech.with_streaming_response.convert(
audio=b"raw file contents",
voice="ava",
voice="leah",
) as speech:
assert not speech.is_closed
assert speech.http_request.headers.get("X-Stainless-Lang") == "python"
Expand All @@ -94,7 +94,7 @@ def test_method_generate(self, client: Lmnt, respx_mock: MockRouter) -> None:
respx_mock.post("/v1/ai/speech/bytes").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
speech = client.speech.generate(
text="hello world.",
voice="ava",
voice="leah",
)
assert speech.is_closed
assert speech.json() == {"foo": "bar"}
Expand All @@ -107,7 +107,7 @@ def test_method_generate_with_all_params(self, client: Lmnt, respx_mock: MockRou
respx_mock.post("/v1/ai/speech/bytes").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
speech = client.speech.generate(
text="hello world.",
voice="ava",
voice="leah",
format="aac",
language="auto",
model="blizzard",
Expand All @@ -128,7 +128,7 @@ def test_raw_response_generate(self, client: Lmnt, respx_mock: MockRouter) -> No

speech = client.speech.with_raw_response.generate(
text="hello world.",
voice="ava",
voice="leah",
)

assert speech.is_closed is True
Expand All @@ -142,7 +142,7 @@ def test_streaming_response_generate(self, client: Lmnt, respx_mock: MockRouter)
respx_mock.post("/v1/ai/speech/bytes").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
with client.speech.with_streaming_response.generate(
text="hello world.",
voice="ava",
voice="leah",
) as speech:
assert not speech.is_closed
assert speech.http_request.headers.get("X-Stainless-Lang") == "python"
Expand All @@ -157,15 +157,15 @@ def test_streaming_response_generate(self, client: Lmnt, respx_mock: MockRouter)
def test_method_generate_detailed(self, client: Lmnt) -> None:
speech = client.speech.generate_detailed(
text="hello world.",
voice="ava",
voice="leah",
)
assert_matches_type(SpeechGenerateDetailedResponse, speech, path=["response"])

@parametrize
def test_method_generate_detailed_with_all_params(self, client: Lmnt) -> None:
speech = client.speech.generate_detailed(
text="hello world.",
voice="ava",
voice="leah",
format="aac",
language="auto",
model="blizzard",
Expand All @@ -181,7 +181,7 @@ def test_method_generate_detailed_with_all_params(self, client: Lmnt) -> None:
def test_raw_response_generate_detailed(self, client: Lmnt) -> None:
response = client.speech.with_raw_response.generate_detailed(
text="hello world.",
voice="ava",
voice="leah",
)

assert response.is_closed is True
Expand All @@ -193,7 +193,7 @@ def test_raw_response_generate_detailed(self, client: Lmnt) -> None:
def test_streaming_response_generate_detailed(self, client: Lmnt) -> None:
with client.speech.with_streaming_response.generate_detailed(
text="hello world.",
voice="ava",
voice="leah",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
Expand All @@ -215,7 +215,7 @@ async def test_method_convert(self, async_client: AsyncLmnt, respx_mock: MockRou
respx_mock.post("/v1/ai/speech/convert").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
speech = await async_client.speech.convert(
audio=b"raw file contents",
voice="ava",
voice="leah",
)
assert speech.is_closed
assert await speech.json() == {"foo": "bar"}
Expand All @@ -228,7 +228,7 @@ async def test_method_convert_with_all_params(self, async_client: AsyncLmnt, res
respx_mock.post("/v1/ai/speech/convert").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
speech = await async_client.speech.convert(
audio=b"raw file contents",
voice="ava",
voice="leah",
format="aac",
language="auto",
sample_rate=8000,
Expand All @@ -245,7 +245,7 @@ async def test_raw_response_convert(self, async_client: AsyncLmnt, respx_mock: M

speech = await async_client.speech.with_raw_response.convert(
audio=b"raw file contents",
voice="ava",
voice="leah",
)

assert speech.is_closed is True
Expand All @@ -259,7 +259,7 @@ async def test_streaming_response_convert(self, async_client: AsyncLmnt, respx_m
respx_mock.post("/v1/ai/speech/convert").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
async with async_client.speech.with_streaming_response.convert(
audio=b"raw file contents",
voice="ava",
voice="leah",
) as speech:
assert not speech.is_closed
assert speech.http_request.headers.get("X-Stainless-Lang") == "python"
Expand All @@ -276,7 +276,7 @@ async def test_method_generate(self, async_client: AsyncLmnt, respx_mock: MockRo
respx_mock.post("/v1/ai/speech/bytes").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
speech = await async_client.speech.generate(
text="hello world.",
voice="ava",
voice="leah",
)
assert speech.is_closed
assert await speech.json() == {"foo": "bar"}
Expand All @@ -289,7 +289,7 @@ async def test_method_generate_with_all_params(self, async_client: AsyncLmnt, re
respx_mock.post("/v1/ai/speech/bytes").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
speech = await async_client.speech.generate(
text="hello world.",
voice="ava",
voice="leah",
format="aac",
language="auto",
model="blizzard",
Expand All @@ -310,7 +310,7 @@ async def test_raw_response_generate(self, async_client: AsyncLmnt, respx_mock:

speech = await async_client.speech.with_raw_response.generate(
text="hello world.",
voice="ava",
voice="leah",
)

assert speech.is_closed is True
Expand All @@ -324,7 +324,7 @@ async def test_streaming_response_generate(self, async_client: AsyncLmnt, respx_
respx_mock.post("/v1/ai/speech/bytes").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
async with async_client.speech.with_streaming_response.generate(
text="hello world.",
voice="ava",
voice="leah",
) as speech:
assert not speech.is_closed
assert speech.http_request.headers.get("X-Stainless-Lang") == "python"
Expand All @@ -339,15 +339,15 @@ async def test_streaming_response_generate(self, async_client: AsyncLmnt, respx_
async def test_method_generate_detailed(self, async_client: AsyncLmnt) -> None:
speech = await async_client.speech.generate_detailed(
text="hello world.",
voice="ava",
voice="leah",
)
assert_matches_type(SpeechGenerateDetailedResponse, speech, path=["response"])

@parametrize
async def test_method_generate_detailed_with_all_params(self, async_client: AsyncLmnt) -> None:
speech = await async_client.speech.generate_detailed(
text="hello world.",
voice="ava",
voice="leah",
format="aac",
language="auto",
model="blizzard",
Expand All @@ -363,7 +363,7 @@ async def test_method_generate_detailed_with_all_params(self, async_client: Asyn
async def test_raw_response_generate_detailed(self, async_client: AsyncLmnt) -> None:
response = await async_client.speech.with_raw_response.generate_detailed(
text="hello world.",
voice="ava",
voice="leah",
)

assert response.is_closed is True
Expand All @@ -375,7 +375,7 @@ async def test_raw_response_generate_detailed(self, async_client: AsyncLmnt) ->
async def test_streaming_response_generate_detailed(self, async_client: AsyncLmnt) -> None:
async with async_client.speech.with_streaming_response.generate_detailed(
text="hello world.",
voice="ava",
voice="leah",
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
Expand Down
20 changes: 10 additions & 10 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter, clien
respx_mock.post("/v1/ai/speech/bytes").mock(side_effect=httpx.TimeoutException("Test timeout error"))

with pytest.raises(APITimeoutError):
client.speech.with_streaming_response.generate(text="hello world.", voice="ava").__enter__()
client.speech.with_streaming_response.generate(text="hello world.", voice="leah").__enter__()

assert _get_open_connections(self.client) == 0

Expand All @@ -709,7 +709,7 @@ def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter, client
respx_mock.post("/v1/ai/speech/bytes").mock(return_value=httpx.Response(500))

with pytest.raises(APIStatusError):
client.speech.with_streaming_response.generate(text="hello world.", voice="ava").__enter__()
client.speech.with_streaming_response.generate(text="hello world.", voice="leah").__enter__()
assert _get_open_connections(self.client) == 0

@pytest.mark.parametrize("failures_before_success", [0, 2, 4])
Expand Down Expand Up @@ -738,7 +738,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:

respx_mock.post("/v1/ai/speech/bytes").mock(side_effect=retry_handler)

response = client.speech.with_raw_response.generate(text="hello world.", voice="ava")
response = client.speech.with_raw_response.generate(text="hello world.", voice="leah")

assert response.retries_taken == failures_before_success
assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success
Expand All @@ -761,7 +761,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
respx_mock.post("/v1/ai/speech/bytes").mock(side_effect=retry_handler)

response = client.speech.with_raw_response.generate(
text="hello world.", voice="ava", extra_headers={"x-stainless-retry-count": Omit()}
text="hello world.", voice="leah", extra_headers={"x-stainless-retry-count": Omit()}
)

assert len(response.http_request.headers.get_list("x-stainless-retry-count")) == 0
Expand All @@ -786,7 +786,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
respx_mock.post("/v1/ai/speech/bytes").mock(side_effect=retry_handler)

response = client.speech.with_raw_response.generate(
text="hello world.", voice="ava", extra_headers={"x-stainless-retry-count": "42"}
text="hello world.", voice="leah", extra_headers={"x-stainless-retry-count": "42"}
)

assert response.http_request.headers.get("x-stainless-retry-count") == "42"
Expand Down Expand Up @@ -1496,7 +1496,7 @@ async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter,
respx_mock.post("/v1/ai/speech/bytes").mock(side_effect=httpx.TimeoutException("Test timeout error"))

with pytest.raises(APITimeoutError):
await async_client.speech.with_streaming_response.generate(text="hello world.", voice="ava").__aenter__()
await async_client.speech.with_streaming_response.generate(text="hello world.", voice="leah").__aenter__()

assert _get_open_connections(self.client) == 0

Expand All @@ -1506,7 +1506,7 @@ async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter,
respx_mock.post("/v1/ai/speech/bytes").mock(return_value=httpx.Response(500))

with pytest.raises(APIStatusError):
await async_client.speech.with_streaming_response.generate(text="hello world.", voice="ava").__aenter__()
await async_client.speech.with_streaming_response.generate(text="hello world.", voice="leah").__aenter__()
assert _get_open_connections(self.client) == 0

@pytest.mark.parametrize("failures_before_success", [0, 2, 4])
Expand Down Expand Up @@ -1536,7 +1536,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:

respx_mock.post("/v1/ai/speech/bytes").mock(side_effect=retry_handler)

response = await client.speech.with_raw_response.generate(text="hello world.", voice="ava")
response = await client.speech.with_raw_response.generate(text="hello world.", voice="leah")

assert response.retries_taken == failures_before_success
assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success
Expand All @@ -1562,7 +1562,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
respx_mock.post("/v1/ai/speech/bytes").mock(side_effect=retry_handler)

response = await client.speech.with_raw_response.generate(
text="hello world.", voice="ava", extra_headers={"x-stainless-retry-count": Omit()}
text="hello world.", voice="leah", extra_headers={"x-stainless-retry-count": Omit()}
)

assert len(response.http_request.headers.get_list("x-stainless-retry-count")) == 0
Expand All @@ -1588,7 +1588,7 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
respx_mock.post("/v1/ai/speech/bytes").mock(side_effect=retry_handler)

response = await client.speech.with_raw_response.generate(
text="hello world.", voice="ava", extra_headers={"x-stainless-retry-count": "42"}
text="hello world.", voice="leah", extra_headers={"x-stainless-retry-count": "42"}
)

assert response.http_request.headers.get("x-stainless-retry-count") == "42"
Expand Down