spitch 1.1.0__tar.gz → 1.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of spitch might be problematic. Click here for more details.

Files changed (71) hide show
  1. spitch-1.3.0/.release-please-manifest.json +3 -0
  2. {spitch-1.1.0 → spitch-1.3.0}/CHANGELOG.md +16 -0
  3. {spitch-1.1.0 → spitch-1.3.0}/PKG-INFO +1 -1
  4. {spitch-1.1.0 → spitch-1.3.0}/api.md +2 -2
  5. {spitch-1.1.0 → spitch-1.3.0}/pyproject.toml +1 -1
  6. {spitch-1.1.0 → spitch-1.3.0}/src/spitch/_version.py +1 -1
  7. {spitch-1.1.0 → spitch-1.3.0}/src/spitch/resources/speech.py +45 -23
  8. {spitch-1.1.0 → spitch-1.3.0}/tests/api_resources/test_speech.py +74 -34
  9. spitch-1.1.0/.release-please-manifest.json +0 -3
  10. {spitch-1.1.0 → spitch-1.3.0}/.gitignore +0 -0
  11. {spitch-1.1.0 → spitch-1.3.0}/CONTRIBUTING.md +0 -0
  12. {spitch-1.1.0 → spitch-1.3.0}/LICENSE +0 -0
  13. {spitch-1.1.0 → spitch-1.3.0}/README.md +0 -0
  14. {spitch-1.1.0 → spitch-1.3.0}/SECURITY.md +0 -0
  15. {spitch-1.1.0 → spitch-1.3.0}/bin/check-release-environment +0 -0
  16. {spitch-1.1.0 → spitch-1.3.0}/bin/publish-pypi +0 -0
  17. {spitch-1.1.0 → spitch-1.3.0}/examples/.keep +0 -0
  18. {spitch-1.1.0 → spitch-1.3.0}/examples/example.py +0 -0
  19. {spitch-1.1.0 → spitch-1.3.0}/mypy.ini +0 -0
  20. {spitch-1.1.0 → spitch-1.3.0}/noxfile.py +0 -0
  21. {spitch-1.1.0 → spitch-1.3.0}/release-please-config.json +0 -0
  22. {spitch-1.1.0 → spitch-1.3.0}/requirements-dev.lock +0 -0
  23. {spitch-1.1.0 → spitch-1.3.0}/requirements.lock +0 -0
  24. {spitch-1.1.0 → spitch-1.3.0}/src/spitch/__init__.py +0 -0
  25. {spitch-1.1.0 → spitch-1.3.0}/src/spitch/_base_client.py +0 -0
  26. {spitch-1.1.0 → spitch-1.3.0}/src/spitch/_client.py +0 -0
  27. {spitch-1.1.0 → spitch-1.3.0}/src/spitch/_compat.py +0 -0
  28. {spitch-1.1.0 → spitch-1.3.0}/src/spitch/_constants.py +0 -0
  29. {spitch-1.1.0 → spitch-1.3.0}/src/spitch/_exceptions.py +0 -0
  30. {spitch-1.1.0 → spitch-1.3.0}/src/spitch/_files.py +0 -0
  31. {spitch-1.1.0 → spitch-1.3.0}/src/spitch/_models.py +0 -0
  32. {spitch-1.1.0 → spitch-1.3.0}/src/spitch/_qs.py +0 -0
  33. {spitch-1.1.0 → spitch-1.3.0}/src/spitch/_resource.py +0 -0
  34. {spitch-1.1.0 → spitch-1.3.0}/src/spitch/_response.py +0 -0
  35. {spitch-1.1.0 → spitch-1.3.0}/src/spitch/_streaming.py +0 -0
  36. {spitch-1.1.0 → spitch-1.3.0}/src/spitch/_types.py +0 -0
  37. {spitch-1.1.0 → spitch-1.3.0}/src/spitch/_utils/__init__.py +0 -0
  38. {spitch-1.1.0 → spitch-1.3.0}/src/spitch/_utils/_logs.py +0 -0
  39. {spitch-1.1.0 → spitch-1.3.0}/src/spitch/_utils/_proxy.py +0 -0
  40. {spitch-1.1.0 → spitch-1.3.0}/src/spitch/_utils/_reflection.py +0 -0
  41. {spitch-1.1.0 → spitch-1.3.0}/src/spitch/_utils/_streams.py +0 -0
  42. {spitch-1.1.0 → spitch-1.3.0}/src/spitch/_utils/_sync.py +0 -0
  43. {spitch-1.1.0 → spitch-1.3.0}/src/spitch/_utils/_transform.py +0 -0
  44. {spitch-1.1.0 → spitch-1.3.0}/src/spitch/_utils/_typing.py +0 -0
  45. {spitch-1.1.0 → spitch-1.3.0}/src/spitch/_utils/_utils.py +0 -0
  46. {spitch-1.1.0 → spitch-1.3.0}/src/spitch/lib/.keep +0 -0
  47. {spitch-1.1.0 → spitch-1.3.0}/src/spitch/py.typed +0 -0
  48. {spitch-1.1.0 → spitch-1.3.0}/src/spitch/resources/__init__.py +0 -0
  49. {spitch-1.1.0 → spitch-1.3.0}/src/spitch/resources/text.py +0 -0
  50. {spitch-1.1.0 → spitch-1.3.0}/src/spitch/types/__init__.py +0 -0
  51. {spitch-1.1.0 → spitch-1.3.0}/src/spitch/types/speech_generate_params.py +0 -0
  52. {spitch-1.1.0 → spitch-1.3.0}/src/spitch/types/speech_transcibe_params.py +0 -0
  53. {spitch-1.1.0 → spitch-1.3.0}/src/spitch/types/text_tone_mark_params.py +0 -0
  54. {spitch-1.1.0 → spitch-1.3.0}/tests/__init__.py +0 -0
  55. {spitch-1.1.0 → spitch-1.3.0}/tests/api_resources/__init__.py +0 -0
  56. {spitch-1.1.0 → spitch-1.3.0}/tests/api_resources/test_text.py +0 -0
  57. {spitch-1.1.0 → spitch-1.3.0}/tests/conftest.py +0 -0
  58. {spitch-1.1.0 → spitch-1.3.0}/tests/sample_file.txt +0 -0
  59. {spitch-1.1.0 → spitch-1.3.0}/tests/test_client.py +0 -0
  60. {spitch-1.1.0 → spitch-1.3.0}/tests/test_deepcopy.py +0 -0
  61. {spitch-1.1.0 → spitch-1.3.0}/tests/test_extract_files.py +0 -0
  62. {spitch-1.1.0 → spitch-1.3.0}/tests/test_files.py +0 -0
  63. {spitch-1.1.0 → spitch-1.3.0}/tests/test_models.py +0 -0
  64. {spitch-1.1.0 → spitch-1.3.0}/tests/test_qs.py +0 -0
  65. {spitch-1.1.0 → spitch-1.3.0}/tests/test_required_args.py +0 -0
  66. {spitch-1.1.0 → spitch-1.3.0}/tests/test_response.py +0 -0
  67. {spitch-1.1.0 → spitch-1.3.0}/tests/test_streaming.py +0 -0
  68. {spitch-1.1.0 → spitch-1.3.0}/tests/test_transform.py +0 -0
  69. {spitch-1.1.0 → spitch-1.3.0}/tests/test_utils/test_proxy.py +0 -0
  70. {spitch-1.1.0 → spitch-1.3.0}/tests/test_utils/test_typing.py +0 -0
  71. {spitch-1.1.0 → spitch-1.3.0}/tests/utils.py +0 -0
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "1.3.0"
3
+ }
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.3.0 (2024-10-07)
4
+
5
+ Full Changelog: [v1.2.0...v1.3.0](https://github.com/spi-tch/spitch-python/compare/v1.2.0...v1.3.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** update via SDK Studio ([#16](https://github.com/spi-tch/spitch-python/issues/16)) ([77235df](https://github.com/spi-tch/spitch-python/commit/77235df6b0d1f15d064da89bab6f836e78c1db61))
10
+
11
+ ## 1.2.0 (2024-10-07)
12
+
13
+ Full Changelog: [v1.1.0...v1.2.0](https://github.com/spi-tch/spitch-python/compare/v1.1.0...v1.2.0)
14
+
15
+ ### Features
16
+
17
+ * **api:** update via SDK Studio ([#13](https://github.com/spi-tch/spitch-python/issues/13)) ([fdb3beb](https://github.com/spi-tch/spitch-python/commit/fdb3bebe5701a188e2c4f62a3a6d2e72c267532c))
18
+
3
19
  ## 1.1.0 (2024-10-07)
4
20
 
5
21
  Full Changelog: [v1.0.0...v1.1.0](https://github.com/spi-tch/spitch-python/compare/v1.0.0...v1.1.0)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: spitch
3
- Version: 1.1.0
3
+ Version: 1.3.0
4
4
  Summary: The official Python library for the spitch API
5
5
  Project-URL: Homepage, https://github.com/spi-tch/spitch-python
6
6
  Project-URL: Repository, https://github.com/spi-tch/spitch-python
@@ -3,12 +3,12 @@
3
3
  Types:
4
4
 
5
5
  ```python
6
- from spitch.types import SpeechGenerateResponse, SpeechTranscibeResponse
6
+ from spitch.types import SpeechTranscibeResponse
7
7
  ```
8
8
 
9
9
  Methods:
10
10
 
11
- - <code title="post /v1/speech">client.speech.<a href="./src/spitch/resources/speech.py">generate</a>(\*\*<a href="src/spitch/types/speech_generate_params.py">params</a>) -> <a href="./src/spitch/types/speech_generate_response.py">object</a></code>
11
+ - <code title="post /v1/speech">client.speech.<a href="./src/spitch/resources/speech.py">generate</a>(\*\*<a href="src/spitch/types/speech_generate_params.py">params</a>) -> BinaryAPIResponse</code>
12
12
  - <code title="post /v1/transcriptions">client.speech.<a href="./src/spitch/resources/speech.py">transcibe</a>(\*\*<a href="src/spitch/types/speech_transcibe_params.py">params</a>) -> <a href="./src/spitch/types/speech_transcibe_response.py">object</a></code>
13
13
 
14
14
  # Text
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "spitch"
3
- version = "1.1.0"
3
+ version = "1.3.0"
4
4
  description = "The official Python library for the spitch API"
5
5
  dynamic = ["readme"]
6
6
  license = "Apache-2.0"
@@ -1,4 +1,4 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  __title__ = "spitch"
4
- __version__ = "1.1.0" # x-release-please-version
4
+ __version__ = "1.3.0" # x-release-please-version
@@ -2,7 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
- from typing import Optional
5
+ from typing import Mapping, Optional, cast
6
6
  from typing_extensions import Literal
7
7
 
8
8
  import httpx
@@ -10,19 +10,25 @@ import httpx
10
10
  from ..types import speech_generate_params, speech_transcibe_params
11
11
  from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes
12
12
  from .._utils import (
13
+ extract_files,
13
14
  maybe_transform,
15
+ deepcopy_minimal,
14
16
  async_maybe_transform,
15
17
  )
16
18
  from .._compat import cached_property
17
19
  from .._resource import SyncAPIResource, AsyncAPIResource
18
20
  from .._response import (
21
+ BinaryAPIResponse,
22
+ AsyncBinaryAPIResponse,
19
23
  StreamedBinaryAPIResponse,
20
24
  AsyncStreamedBinaryAPIResponse,
21
25
  to_raw_response_wrapper,
22
26
  to_streamed_response_wrapper,
23
27
  async_to_raw_response_wrapper,
28
+ to_custom_raw_response_wrapper,
24
29
  async_to_streamed_response_wrapper,
25
30
  to_custom_streamed_response_wrapper,
31
+ async_to_custom_raw_response_wrapper,
26
32
  async_to_custom_streamed_response_wrapper,
27
33
  )
28
34
  from .._base_client import make_request_options
@@ -63,7 +69,7 @@ class SpeechResource(SyncAPIResource):
63
69
  extra_query: Query | None = None,
64
70
  extra_body: Body | None = None,
65
71
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
66
- ) -> object:
72
+ ) -> BinaryAPIResponse:
67
73
  """
68
74
  Synthesize
69
75
 
@@ -76,6 +82,7 @@ class SpeechResource(SyncAPIResource):
76
82
 
77
83
  timeout: Override the client-level default timeout for this request, in seconds
78
84
  """
85
+ extra_headers = {"Accept": "audio/wav", **(extra_headers or {})}
79
86
  return self._post(
80
87
  "/v1/speech",
81
88
  body=maybe_transform(
@@ -93,7 +100,7 @@ class SpeechResource(SyncAPIResource):
93
100
  timeout=timeout,
94
101
  query=maybe_transform({"stream": stream}, speech_generate_params.SpeechGenerateParams),
95
102
  ),
96
- cast_to=object,
103
+ cast_to=BinaryAPIResponse,
97
104
  )
98
105
 
99
106
  def transcibe(
@@ -121,16 +128,22 @@ class SpeechResource(SyncAPIResource):
121
128
 
122
129
  timeout: Override the client-level default timeout for this request, in seconds
123
130
  """
131
+ body = deepcopy_minimal(
132
+ {
133
+ "language": language,
134
+ "content": content,
135
+ "url": url,
136
+ }
137
+ )
138
+ files = extract_files(cast(Mapping[str, object], body), paths=[["content"]])
139
+ # It should be noted that the actual Content-Type header that will be
140
+ # sent to the server will contain a `boundary` parameter, e.g.
141
+ # multipart/form-data; boundary=---abc--
142
+ extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
124
143
  return self._post(
125
144
  "/v1/transcriptions",
126
- body=maybe_transform(
127
- {
128
- "language": language,
129
- "content": content,
130
- "url": url,
131
- },
132
- speech_transcibe_params.SpeechTranscibeParams,
133
- ),
145
+ body=maybe_transform(body, speech_transcibe_params.SpeechTranscibeParams),
146
+ files=files,
134
147
  options=make_request_options(
135
148
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
136
149
  ),
@@ -171,7 +184,7 @@ class AsyncSpeechResource(AsyncAPIResource):
171
184
  extra_query: Query | None = None,
172
185
  extra_body: Body | None = None,
173
186
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
174
- ) -> object:
187
+ ) -> AsyncBinaryAPIResponse:
175
188
  """
176
189
  Synthesize
177
190
 
@@ -184,6 +197,7 @@ class AsyncSpeechResource(AsyncAPIResource):
184
197
 
185
198
  timeout: Override the client-level default timeout for this request, in seconds
186
199
  """
200
+ extra_headers = {"Accept": "audio/wav", **(extra_headers or {})}
187
201
  return await self._post(
188
202
  "/v1/speech",
189
203
  body=await async_maybe_transform(
@@ -201,7 +215,7 @@ class AsyncSpeechResource(AsyncAPIResource):
201
215
  timeout=timeout,
202
216
  query=await async_maybe_transform({"stream": stream}, speech_generate_params.SpeechGenerateParams),
203
217
  ),
204
- cast_to=object,
218
+ cast_to=AsyncBinaryAPIResponse,
205
219
  )
206
220
 
207
221
  async def transcibe(
@@ -229,16 +243,22 @@ class AsyncSpeechResource(AsyncAPIResource):
229
243
 
230
244
  timeout: Override the client-level default timeout for this request, in seconds
231
245
  """
246
+ body = deepcopy_minimal(
247
+ {
248
+ "language": language,
249
+ "content": content,
250
+ "url": url,
251
+ }
252
+ )
253
+ files = extract_files(cast(Mapping[str, object], body), paths=[["content"]])
254
+ # It should be noted that the actual Content-Type header that will be
255
+ # sent to the server will contain a `boundary` parameter, e.g.
256
+ # multipart/form-data; boundary=---abc--
257
+ extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
232
258
  return await self._post(
233
259
  "/v1/transcriptions",
234
- body=await async_maybe_transform(
235
- {
236
- "language": language,
237
- "content": content,
238
- "url": url,
239
- },
240
- speech_transcibe_params.SpeechTranscibeParams,
241
- ),
260
+ body=await async_maybe_transform(body, speech_transcibe_params.SpeechTranscibeParams),
261
+ files=files,
242
262
  options=make_request_options(
243
263
  extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
244
264
  ),
@@ -250,8 +270,9 @@ class SpeechResourceWithRawResponse:
250
270
  def __init__(self, speech: SpeechResource) -> None:
251
271
  self._speech = speech
252
272
 
253
- self.generate = to_raw_response_wrapper(
273
+ self.generate = to_custom_raw_response_wrapper(
254
274
  speech.generate,
275
+ BinaryAPIResponse,
255
276
  )
256
277
  self.transcibe = to_raw_response_wrapper(
257
278
  speech.transcibe,
@@ -262,8 +283,9 @@ class AsyncSpeechResourceWithRawResponse:
262
283
  def __init__(self, speech: AsyncSpeechResource) -> None:
263
284
  self._speech = speech
264
285
 
265
- self.generate = async_to_raw_response_wrapper(
286
+ self.generate = async_to_custom_raw_response_wrapper(
266
287
  speech.generate,
288
+ AsyncBinaryAPIResponse,
267
289
  )
268
290
  self.transcibe = async_to_raw_response_wrapper(
269
291
  speech.transcibe,
@@ -5,10 +5,18 @@ from __future__ import annotations
5
5
  import os
6
6
  from typing import Any, cast
7
7
 
8
+ import httpx
8
9
  import pytest
10
+ from respx import MockRouter
9
11
 
10
12
  from spitch import Spitch, AsyncSpitch
11
13
  from tests.utils import assert_matches_type
14
+ from spitch._response import (
15
+ BinaryAPIResponse,
16
+ AsyncBinaryAPIResponse,
17
+ StreamedBinaryAPIResponse,
18
+ AsyncStreamedBinaryAPIResponse,
19
+ )
12
20
 
13
21
  base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
14
22
 
@@ -17,48 +25,64 @@ class TestSpeech:
17
25
  parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
18
26
 
19
27
  @parametrize
20
- def test_method_generate(self, client: Spitch) -> None:
28
+ @pytest.mark.respx(base_url=base_url)
29
+ def test_method_generate(self, client: Spitch, respx_mock: MockRouter) -> None:
30
+ respx_mock.post("/v1/speech").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
21
31
  speech = client.speech.generate(
22
32
  language="yo",
23
33
  text="text",
24
34
  )
25
- assert_matches_type(object, speech, path=["response"])
35
+ assert speech.is_closed
36
+ assert speech.json() == {"foo": "bar"}
37
+ assert cast(Any, speech.is_closed) is True
38
+ assert isinstance(speech, BinaryAPIResponse)
26
39
 
27
40
  @parametrize
28
- def test_method_generate_with_all_params(self, client: Spitch) -> None:
41
+ @pytest.mark.respx(base_url=base_url)
42
+ def test_method_generate_with_all_params(self, client: Spitch, respx_mock: MockRouter) -> None:
43
+ respx_mock.post("/v1/speech").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
29
44
  speech = client.speech.generate(
30
45
  language="yo",
31
46
  text="text",
32
47
  stream=True,
33
48
  voice="sade",
34
49
  )
35
- assert_matches_type(object, speech, path=["response"])
50
+ assert speech.is_closed
51
+ assert speech.json() == {"foo": "bar"}
52
+ assert cast(Any, speech.is_closed) is True
53
+ assert isinstance(speech, BinaryAPIResponse)
36
54
 
37
55
  @parametrize
38
- def test_raw_response_generate(self, client: Spitch) -> None:
39
- response = client.speech.with_raw_response.generate(
56
+ @pytest.mark.respx(base_url=base_url)
57
+ def test_raw_response_generate(self, client: Spitch, respx_mock: MockRouter) -> None:
58
+ respx_mock.post("/v1/speech").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
59
+
60
+ speech = client.speech.with_raw_response.generate(
40
61
  language="yo",
41
62
  text="text",
42
63
  )
43
64
 
44
- assert response.is_closed is True
45
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
46
- speech = response.parse()
47
- assert_matches_type(object, speech, path=["response"])
65
+ assert speech.is_closed is True
66
+ assert speech.http_request.headers.get("X-Stainless-Lang") == "python"
67
+ assert speech.json() == {"foo": "bar"}
68
+ assert isinstance(speech, BinaryAPIResponse)
48
69
 
49
70
  @parametrize
50
- def test_streaming_response_generate(self, client: Spitch) -> None:
71
+ @pytest.mark.respx(base_url=base_url)
72
+ def test_streaming_response_generate(self, client: Spitch, respx_mock: MockRouter) -> None:
73
+ respx_mock.post("/v1/speech").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
51
74
  with client.speech.with_streaming_response.generate(
52
75
  language="yo",
53
76
  text="text",
54
- ) as response:
55
- assert not response.is_closed
56
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
77
+ ) as speech:
78
+ assert not speech.is_closed
79
+ assert speech.http_request.headers.get("X-Stainless-Lang") == "python"
57
80
 
58
- speech = response.parse()
59
- assert_matches_type(object, speech, path=["response"])
81
+ assert speech.json() == {"foo": "bar"}
82
+ assert cast(Any, speech.is_closed) is True
83
+ assert isinstance(speech, StreamedBinaryAPIResponse)
60
84
 
61
- assert cast(Any, response.is_closed) is True
85
+ assert cast(Any, speech.is_closed) is True
62
86
 
63
87
  @parametrize
64
88
  def test_method_transcibe(self, client: Spitch) -> None:
@@ -105,48 +129,64 @@ class TestAsyncSpeech:
105
129
  parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
106
130
 
107
131
  @parametrize
108
- async def test_method_generate(self, async_client: AsyncSpitch) -> None:
132
+ @pytest.mark.respx(base_url=base_url)
133
+ async def test_method_generate(self, async_client: AsyncSpitch, respx_mock: MockRouter) -> None:
134
+ respx_mock.post("/v1/speech").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
109
135
  speech = await async_client.speech.generate(
110
136
  language="yo",
111
137
  text="text",
112
138
  )
113
- assert_matches_type(object, speech, path=["response"])
139
+ assert speech.is_closed
140
+ assert await speech.json() == {"foo": "bar"}
141
+ assert cast(Any, speech.is_closed) is True
142
+ assert isinstance(speech, AsyncBinaryAPIResponse)
114
143
 
115
144
  @parametrize
116
- async def test_method_generate_with_all_params(self, async_client: AsyncSpitch) -> None:
145
+ @pytest.mark.respx(base_url=base_url)
146
+ async def test_method_generate_with_all_params(self, async_client: AsyncSpitch, respx_mock: MockRouter) -> None:
147
+ respx_mock.post("/v1/speech").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
117
148
  speech = await async_client.speech.generate(
118
149
  language="yo",
119
150
  text="text",
120
151
  stream=True,
121
152
  voice="sade",
122
153
  )
123
- assert_matches_type(object, speech, path=["response"])
154
+ assert speech.is_closed
155
+ assert await speech.json() == {"foo": "bar"}
156
+ assert cast(Any, speech.is_closed) is True
157
+ assert isinstance(speech, AsyncBinaryAPIResponse)
124
158
 
125
159
  @parametrize
126
- async def test_raw_response_generate(self, async_client: AsyncSpitch) -> None:
127
- response = await async_client.speech.with_raw_response.generate(
160
+ @pytest.mark.respx(base_url=base_url)
161
+ async def test_raw_response_generate(self, async_client: AsyncSpitch, respx_mock: MockRouter) -> None:
162
+ respx_mock.post("/v1/speech").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
163
+
164
+ speech = await async_client.speech.with_raw_response.generate(
128
165
  language="yo",
129
166
  text="text",
130
167
  )
131
168
 
132
- assert response.is_closed is True
133
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
134
- speech = await response.parse()
135
- assert_matches_type(object, speech, path=["response"])
169
+ assert speech.is_closed is True
170
+ assert speech.http_request.headers.get("X-Stainless-Lang") == "python"
171
+ assert await speech.json() == {"foo": "bar"}
172
+ assert isinstance(speech, AsyncBinaryAPIResponse)
136
173
 
137
174
  @parametrize
138
- async def test_streaming_response_generate(self, async_client: AsyncSpitch) -> None:
175
+ @pytest.mark.respx(base_url=base_url)
176
+ async def test_streaming_response_generate(self, async_client: AsyncSpitch, respx_mock: MockRouter) -> None:
177
+ respx_mock.post("/v1/speech").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
139
178
  async with async_client.speech.with_streaming_response.generate(
140
179
  language="yo",
141
180
  text="text",
142
- ) as response:
143
- assert not response.is_closed
144
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
181
+ ) as speech:
182
+ assert not speech.is_closed
183
+ assert speech.http_request.headers.get("X-Stainless-Lang") == "python"
145
184
 
146
- speech = await response.parse()
147
- assert_matches_type(object, speech, path=["response"])
185
+ assert await speech.json() == {"foo": "bar"}
186
+ assert cast(Any, speech.is_closed) is True
187
+ assert isinstance(speech, AsyncStreamedBinaryAPIResponse)
148
188
 
149
- assert cast(Any, response.is_closed) is True
189
+ assert cast(Any, speech.is_closed) is True
150
190
 
151
191
  @parametrize
152
192
  async def test_method_transcibe(self, async_client: AsyncSpitch) -> None:
@@ -1,3 +0,0 @@
1
- {
2
- ".": "1.1.0"
3
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes