Skip to content

Commit 6f7db02

Browse files
committed
feat: add test for unknown model name handling in TTS client
1 parent dd251bf commit 6f7db02

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

tests/unit/test_tts.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,21 @@ def test_convert_with_different_backend(self, tts_client, mock_client_wrapper):
201201
call_args = mock_client_wrapper.request.call_args
202202
assert call_args[1]["headers"]["model"] == "s1"
203203

204+
def test_convert_unknown_model_passed_through_to_header(
205+
self, tts_client, mock_client_wrapper
206+
):
207+
"""Test that an unknown model name is passed through to the HTTP header as-is."""
208+
mock_response = Mock()
209+
mock_response.iter_bytes.return_value = iter([b"audio"])
210+
mock_client_wrapper.request.return_value = mock_response
211+
212+
# Pass a model name that doesn't exist in the Model Literal type
213+
tts_client.convert(text="Hello", model="speech-99-nonexistent")
214+
215+
# Verify the unknown model name still ends up in the request header
216+
call_args = mock_client_wrapper.request.call_args
217+
assert call_args[1]["headers"]["model"] == "speech-99-nonexistent"
218+
204219
def test_convert_with_prosody(self, tts_client, mock_client_wrapper):
205220
"""Test TTS with prosody settings."""
206221
mock_response = Mock()

0 commit comments

Comments
 (0)