spitch 1.2.0__tar.gz → 1.4.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.4.0/.release-please-manifest.json +3 -0
  2. {spitch-1.2.0 → spitch-1.4.0}/CHANGELOG.md +17 -0
  3. {spitch-1.2.0 → spitch-1.4.0}/PKG-INFO +1 -1
  4. {spitch-1.2.0 → spitch-1.4.0}/api.md +2 -2
  5. {spitch-1.2.0 → spitch-1.4.0}/pyproject.toml +1 -1
  6. {spitch-1.2.0 → spitch-1.4.0}/src/spitch/_version.py +1 -1
  7. {spitch-1.2.0 → spitch-1.4.0}/src/spitch/resources/speech.py +16 -18
  8. {spitch-1.2.0 → spitch-1.4.0}/src/spitch/types/speech_generate_params.py +0 -2
  9. {spitch-1.2.0 → spitch-1.4.0}/tests/api_resources/test_speech.py +74 -36
  10. spitch-1.2.0/.release-please-manifest.json +0 -3
  11. {spitch-1.2.0 → spitch-1.4.0}/.gitignore +0 -0
  12. {spitch-1.2.0 → spitch-1.4.0}/CONTRIBUTING.md +0 -0
  13. {spitch-1.2.0 → spitch-1.4.0}/LICENSE +0 -0
  14. {spitch-1.2.0 → spitch-1.4.0}/README.md +0 -0
  15. {spitch-1.2.0 → spitch-1.4.0}/SECURITY.md +0 -0
  16. {spitch-1.2.0 → spitch-1.4.0}/bin/check-release-environment +0 -0
  17. {spitch-1.2.0 → spitch-1.4.0}/bin/publish-pypi +0 -0
  18. {spitch-1.2.0 → spitch-1.4.0}/examples/.keep +0 -0
  19. {spitch-1.2.0 → spitch-1.4.0}/examples/example.py +0 -0
  20. {spitch-1.2.0 → spitch-1.4.0}/mypy.ini +0 -0
  21. {spitch-1.2.0 → spitch-1.4.0}/noxfile.py +0 -0
  22. {spitch-1.2.0 → spitch-1.4.0}/release-please-config.json +0 -0
  23. {spitch-1.2.0 → spitch-1.4.0}/requirements-dev.lock +0 -0
  24. {spitch-1.2.0 → spitch-1.4.0}/requirements.lock +0 -0
  25. {spitch-1.2.0 → spitch-1.4.0}/src/spitch/__init__.py +0 -0
  26. {spitch-1.2.0 → spitch-1.4.0}/src/spitch/_base_client.py +0 -0
  27. {spitch-1.2.0 → spitch-1.4.0}/src/spitch/_client.py +0 -0
  28. {spitch-1.2.0 → spitch-1.4.0}/src/spitch/_compat.py +0 -0
  29. {spitch-1.2.0 → spitch-1.4.0}/src/spitch/_constants.py +0 -0
  30. {spitch-1.2.0 → spitch-1.4.0}/src/spitch/_exceptions.py +0 -0
  31. {spitch-1.2.0 → spitch-1.4.0}/src/spitch/_files.py +0 -0
  32. {spitch-1.2.0 → spitch-1.4.0}/src/spitch/_models.py +0 -0
  33. {spitch-1.2.0 → spitch-1.4.0}/src/spitch/_qs.py +0 -0
  34. {spitch-1.2.0 → spitch-1.4.0}/src/spitch/_resource.py +0 -0
  35. {spitch-1.2.0 → spitch-1.4.0}/src/spitch/_response.py +0 -0
  36. {spitch-1.2.0 → spitch-1.4.0}/src/spitch/_streaming.py +0 -0
  37. {spitch-1.2.0 → spitch-1.4.0}/src/spitch/_types.py +0 -0
  38. {spitch-1.2.0 → spitch-1.4.0}/src/spitch/_utils/__init__.py +0 -0
  39. {spitch-1.2.0 → spitch-1.4.0}/src/spitch/_utils/_logs.py +0 -0
  40. {spitch-1.2.0 → spitch-1.4.0}/src/spitch/_utils/_proxy.py +0 -0
  41. {spitch-1.2.0 → spitch-1.4.0}/src/spitch/_utils/_reflection.py +0 -0
  42. {spitch-1.2.0 → spitch-1.4.0}/src/spitch/_utils/_streams.py +0 -0
  43. {spitch-1.2.0 → spitch-1.4.0}/src/spitch/_utils/_sync.py +0 -0
  44. {spitch-1.2.0 → spitch-1.4.0}/src/spitch/_utils/_transform.py +0 -0
  45. {spitch-1.2.0 → spitch-1.4.0}/src/spitch/_utils/_typing.py +0 -0
  46. {spitch-1.2.0 → spitch-1.4.0}/src/spitch/_utils/_utils.py +0 -0
  47. {spitch-1.2.0 → spitch-1.4.0}/src/spitch/lib/.keep +0 -0
  48. {spitch-1.2.0 → spitch-1.4.0}/src/spitch/py.typed +0 -0
  49. {spitch-1.2.0 → spitch-1.4.0}/src/spitch/resources/__init__.py +0 -0
  50. {spitch-1.2.0 → spitch-1.4.0}/src/spitch/resources/text.py +0 -0
  51. {spitch-1.2.0 → spitch-1.4.0}/src/spitch/types/__init__.py +0 -0
  52. {spitch-1.2.0 → spitch-1.4.0}/src/spitch/types/speech_transcibe_params.py +0 -0
  53. {spitch-1.2.0 → spitch-1.4.0}/src/spitch/types/text_tone_mark_params.py +0 -0
  54. {spitch-1.2.0 → spitch-1.4.0}/tests/__init__.py +0 -0
  55. {spitch-1.2.0 → spitch-1.4.0}/tests/api_resources/__init__.py +0 -0
  56. {spitch-1.2.0 → spitch-1.4.0}/tests/api_resources/test_text.py +0 -0
  57. {spitch-1.2.0 → spitch-1.4.0}/tests/conftest.py +0 -0
  58. {spitch-1.2.0 → spitch-1.4.0}/tests/sample_file.txt +0 -0
  59. {spitch-1.2.0 → spitch-1.4.0}/tests/test_client.py +0 -0
  60. {spitch-1.2.0 → spitch-1.4.0}/tests/test_deepcopy.py +0 -0
  61. {spitch-1.2.0 → spitch-1.4.0}/tests/test_extract_files.py +0 -0
  62. {spitch-1.2.0 → spitch-1.4.0}/tests/test_files.py +0 -0
  63. {spitch-1.2.0 → spitch-1.4.0}/tests/test_models.py +0 -0
  64. {spitch-1.2.0 → spitch-1.4.0}/tests/test_qs.py +0 -0
  65. {spitch-1.2.0 → spitch-1.4.0}/tests/test_required_args.py +0 -0
  66. {spitch-1.2.0 → spitch-1.4.0}/tests/test_response.py +0 -0
  67. {spitch-1.2.0 → spitch-1.4.0}/tests/test_streaming.py +0 -0
  68. {spitch-1.2.0 → spitch-1.4.0}/tests/test_transform.py +0 -0
  69. {spitch-1.2.0 → spitch-1.4.0}/tests/test_utils/test_proxy.py +0 -0
  70. {spitch-1.2.0 → spitch-1.4.0}/tests/test_utils/test_typing.py +0 -0
  71. {spitch-1.2.0 → spitch-1.4.0}/tests/utils.py +0 -0
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "1.4.0"
3
+ }
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.4.0 (2024-10-07)
4
+
5
+ Full Changelog: [v1.3.0...v1.4.0](https://github.com/spi-tch/spitch-python/compare/v1.3.0...v1.4.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** update via SDK Studio ([#20](https://github.com/spi-tch/spitch-python/issues/20)) ([d1b3421](https://github.com/spi-tch/spitch-python/commit/d1b3421f383b9a575c0721baa32e687aa6609dd6))
10
+ * **api:** update via SDK Studio ([#23](https://github.com/spi-tch/spitch-python/issues/23)) ([b0ee3b3](https://github.com/spi-tch/spitch-python/commit/b0ee3b3f10059097252b95498097a4ebeb203afb))
11
+
12
+ ## 1.3.0 (2024-10-07)
13
+
14
+ Full Changelog: [v1.2.0...v1.3.0](https://github.com/spi-tch/spitch-python/compare/v1.2.0...v1.3.0)
15
+
16
+ ### Features
17
+
18
+ * **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))
19
+
3
20
  ## 1.2.0 (2024-10-07)
4
21
 
5
22
  Full Changelog: [v1.1.0...v1.2.0](https://github.com/spi-tch/spitch-python/compare/v1.1.0...v1.2.0)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: spitch
3
- Version: 1.2.0
3
+ Version: 1.4.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.2.0"
3
+ version = "1.4.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.2.0" # x-release-please-version
4
+ __version__ = "1.4.0" # x-release-please-version
@@ -18,13 +18,17 @@ from .._utils import (
18
18
  from .._compat import cached_property
19
19
  from .._resource import SyncAPIResource, AsyncAPIResource
20
20
  from .._response import (
21
+ BinaryAPIResponse,
22
+ AsyncBinaryAPIResponse,
21
23
  StreamedBinaryAPIResponse,
22
24
  AsyncStreamedBinaryAPIResponse,
23
25
  to_raw_response_wrapper,
24
26
  to_streamed_response_wrapper,
25
27
  async_to_raw_response_wrapper,
28
+ to_custom_raw_response_wrapper,
26
29
  async_to_streamed_response_wrapper,
27
30
  to_custom_streamed_response_wrapper,
31
+ async_to_custom_raw_response_wrapper,
28
32
  async_to_custom_streamed_response_wrapper,
29
33
  )
30
34
  from .._base_client import make_request_options
@@ -57,7 +61,6 @@ class SpeechResource(SyncAPIResource):
57
61
  *,
58
62
  language: Literal["yo", "en", "ha", "ig"],
59
63
  text: str,
60
- stream: bool | NotGiven = NOT_GIVEN,
61
64
  voice: Literal["sade", "segun", "femi", "funmi"] | NotGiven = NOT_GIVEN,
62
65
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
63
66
  # The extra values given here take precedence over values defined on the client or passed to this method.
@@ -65,7 +68,7 @@ class SpeechResource(SyncAPIResource):
65
68
  extra_query: Query | None = None,
66
69
  extra_body: Body | None = None,
67
70
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
68
- ) -> object:
71
+ ) -> BinaryAPIResponse:
69
72
  """
70
73
  Synthesize
71
74
 
@@ -78,6 +81,7 @@ class SpeechResource(SyncAPIResource):
78
81
 
79
82
  timeout: Override the client-level default timeout for this request, in seconds
80
83
  """
84
+ extra_headers = {"Accept": "audio/wav", **(extra_headers or {})}
81
85
  return self._post(
82
86
  "/v1/speech",
83
87
  body=maybe_transform(
@@ -89,13 +93,9 @@ class SpeechResource(SyncAPIResource):
89
93
  speech_generate_params.SpeechGenerateParams,
90
94
  ),
91
95
  options=make_request_options(
92
- extra_headers=extra_headers,
93
- extra_query=extra_query,
94
- extra_body=extra_body,
95
- timeout=timeout,
96
- query=maybe_transform({"stream": stream}, speech_generate_params.SpeechGenerateParams),
96
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
97
97
  ),
98
- cast_to=object,
98
+ cast_to=BinaryAPIResponse,
99
99
  )
100
100
 
101
101
  def transcibe(
@@ -171,7 +171,6 @@ class AsyncSpeechResource(AsyncAPIResource):
171
171
  *,
172
172
  language: Literal["yo", "en", "ha", "ig"],
173
173
  text: str,
174
- stream: bool | NotGiven = NOT_GIVEN,
175
174
  voice: Literal["sade", "segun", "femi", "funmi"] | NotGiven = NOT_GIVEN,
176
175
  # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
177
176
  # The extra values given here take precedence over values defined on the client or passed to this method.
@@ -179,7 +178,7 @@ class AsyncSpeechResource(AsyncAPIResource):
179
178
  extra_query: Query | None = None,
180
179
  extra_body: Body | None = None,
181
180
  timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
182
- ) -> object:
181
+ ) -> AsyncBinaryAPIResponse:
183
182
  """
184
183
  Synthesize
185
184
 
@@ -192,6 +191,7 @@ class AsyncSpeechResource(AsyncAPIResource):
192
191
 
193
192
  timeout: Override the client-level default timeout for this request, in seconds
194
193
  """
194
+ extra_headers = {"Accept": "audio/wav", **(extra_headers or {})}
195
195
  return await self._post(
196
196
  "/v1/speech",
197
197
  body=await async_maybe_transform(
@@ -203,13 +203,9 @@ class AsyncSpeechResource(AsyncAPIResource):
203
203
  speech_generate_params.SpeechGenerateParams,
204
204
  ),
205
205
  options=make_request_options(
206
- extra_headers=extra_headers,
207
- extra_query=extra_query,
208
- extra_body=extra_body,
209
- timeout=timeout,
210
- query=await async_maybe_transform({"stream": stream}, speech_generate_params.SpeechGenerateParams),
206
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
211
207
  ),
212
- cast_to=object,
208
+ cast_to=AsyncBinaryAPIResponse,
213
209
  )
214
210
 
215
211
  async def transcibe(
@@ -264,8 +260,9 @@ class SpeechResourceWithRawResponse:
264
260
  def __init__(self, speech: SpeechResource) -> None:
265
261
  self._speech = speech
266
262
 
267
- self.generate = to_raw_response_wrapper(
263
+ self.generate = to_custom_raw_response_wrapper(
268
264
  speech.generate,
265
+ BinaryAPIResponse,
269
266
  )
270
267
  self.transcibe = to_raw_response_wrapper(
271
268
  speech.transcibe,
@@ -276,8 +273,9 @@ class AsyncSpeechResourceWithRawResponse:
276
273
  def __init__(self, speech: AsyncSpeechResource) -> None:
277
274
  self._speech = speech
278
275
 
279
- self.generate = async_to_raw_response_wrapper(
276
+ self.generate = async_to_custom_raw_response_wrapper(
280
277
  speech.generate,
278
+ AsyncBinaryAPIResponse,
281
279
  )
282
280
  self.transcibe = async_to_raw_response_wrapper(
283
281
  speech.transcibe,
@@ -12,6 +12,4 @@ class SpeechGenerateParams(TypedDict, total=False):
12
12
 
13
13
  text: Required[str]
14
14
 
15
- stream: bool
16
-
17
15
  voice: Literal["sade", "segun", "femi", "funmi"]
@@ -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,63 @@ 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
- stream=True,
33
47
  voice="sade",
34
48
  )
35
- assert_matches_type(object, speech, path=["response"])
49
+ assert speech.is_closed
50
+ assert speech.json() == {"foo": "bar"}
51
+ assert cast(Any, speech.is_closed) is True
52
+ assert isinstance(speech, BinaryAPIResponse)
36
53
 
37
54
  @parametrize
38
- def test_raw_response_generate(self, client: Spitch) -> None:
39
- response = client.speech.with_raw_response.generate(
55
+ @pytest.mark.respx(base_url=base_url)
56
+ def test_raw_response_generate(self, client: Spitch, respx_mock: MockRouter) -> None:
57
+ respx_mock.post("/v1/speech").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
58
+
59
+ speech = client.speech.with_raw_response.generate(
40
60
  language="yo",
41
61
  text="text",
42
62
  )
43
63
 
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"])
64
+ assert speech.is_closed is True
65
+ assert speech.http_request.headers.get("X-Stainless-Lang") == "python"
66
+ assert speech.json() == {"foo": "bar"}
67
+ assert isinstance(speech, BinaryAPIResponse)
48
68
 
49
69
  @parametrize
50
- def test_streaming_response_generate(self, client: Spitch) -> None:
70
+ @pytest.mark.respx(base_url=base_url)
71
+ def test_streaming_response_generate(self, client: Spitch, respx_mock: MockRouter) -> None:
72
+ respx_mock.post("/v1/speech").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
51
73
  with client.speech.with_streaming_response.generate(
52
74
  language="yo",
53
75
  text="text",
54
- ) as response:
55
- assert not response.is_closed
56
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
76
+ ) as speech:
77
+ assert not speech.is_closed
78
+ assert speech.http_request.headers.get("X-Stainless-Lang") == "python"
57
79
 
58
- speech = response.parse()
59
- assert_matches_type(object, speech, path=["response"])
80
+ assert speech.json() == {"foo": "bar"}
81
+ assert cast(Any, speech.is_closed) is True
82
+ assert isinstance(speech, StreamedBinaryAPIResponse)
60
83
 
61
- assert cast(Any, response.is_closed) is True
84
+ assert cast(Any, speech.is_closed) is True
62
85
 
63
86
  @parametrize
64
87
  def test_method_transcibe(self, client: Spitch) -> None:
@@ -105,48 +128,63 @@ class TestAsyncSpeech:
105
128
  parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
106
129
 
107
130
  @parametrize
108
- async def test_method_generate(self, async_client: AsyncSpitch) -> None:
131
+ @pytest.mark.respx(base_url=base_url)
132
+ async def test_method_generate(self, async_client: AsyncSpitch, respx_mock: MockRouter) -> None:
133
+ respx_mock.post("/v1/speech").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
109
134
  speech = await async_client.speech.generate(
110
135
  language="yo",
111
136
  text="text",
112
137
  )
113
- assert_matches_type(object, speech, path=["response"])
138
+ assert speech.is_closed
139
+ assert await speech.json() == {"foo": "bar"}
140
+ assert cast(Any, speech.is_closed) is True
141
+ assert isinstance(speech, AsyncBinaryAPIResponse)
114
142
 
115
143
  @parametrize
116
- async def test_method_generate_with_all_params(self, async_client: AsyncSpitch) -> None:
144
+ @pytest.mark.respx(base_url=base_url)
145
+ async def test_method_generate_with_all_params(self, async_client: AsyncSpitch, respx_mock: MockRouter) -> None:
146
+ respx_mock.post("/v1/speech").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
117
147
  speech = await async_client.speech.generate(
118
148
  language="yo",
119
149
  text="text",
120
- stream=True,
121
150
  voice="sade",
122
151
  )
123
- assert_matches_type(object, speech, path=["response"])
152
+ assert speech.is_closed
153
+ assert await speech.json() == {"foo": "bar"}
154
+ assert cast(Any, speech.is_closed) is True
155
+ assert isinstance(speech, AsyncBinaryAPIResponse)
124
156
 
125
157
  @parametrize
126
- async def test_raw_response_generate(self, async_client: AsyncSpitch) -> None:
127
- response = await async_client.speech.with_raw_response.generate(
158
+ @pytest.mark.respx(base_url=base_url)
159
+ async def test_raw_response_generate(self, async_client: AsyncSpitch, respx_mock: MockRouter) -> None:
160
+ respx_mock.post("/v1/speech").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
161
+
162
+ speech = await async_client.speech.with_raw_response.generate(
128
163
  language="yo",
129
164
  text="text",
130
165
  )
131
166
 
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"])
167
+ assert speech.is_closed is True
168
+ assert speech.http_request.headers.get("X-Stainless-Lang") == "python"
169
+ assert await speech.json() == {"foo": "bar"}
170
+ assert isinstance(speech, AsyncBinaryAPIResponse)
136
171
 
137
172
  @parametrize
138
- async def test_streaming_response_generate(self, async_client: AsyncSpitch) -> None:
173
+ @pytest.mark.respx(base_url=base_url)
174
+ async def test_streaming_response_generate(self, async_client: AsyncSpitch, respx_mock: MockRouter) -> None:
175
+ respx_mock.post("/v1/speech").mock(return_value=httpx.Response(200, json={"foo": "bar"}))
139
176
  async with async_client.speech.with_streaming_response.generate(
140
177
  language="yo",
141
178
  text="text",
142
- ) as response:
143
- assert not response.is_closed
144
- assert response.http_request.headers.get("X-Stainless-Lang") == "python"
179
+ ) as speech:
180
+ assert not speech.is_closed
181
+ assert speech.http_request.headers.get("X-Stainless-Lang") == "python"
145
182
 
146
- speech = await response.parse()
147
- assert_matches_type(object, speech, path=["response"])
183
+ assert await speech.json() == {"foo": "bar"}
184
+ assert cast(Any, speech.is_closed) is True
185
+ assert isinstance(speech, AsyncStreamedBinaryAPIResponse)
148
186
 
149
- assert cast(Any, response.is_closed) is True
187
+ assert cast(Any, speech.is_closed) is True
150
188
 
151
189
  @parametrize
152
190
  async def test_method_transcibe(self, async_client: AsyncSpitch) -> None:
@@ -1,3 +0,0 @@
1
- {
2
- ".": "1.2.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