diff options
| author | historia <historiavg@proton.me> | 2026-08-20 17:13:42 -0400 |
|---|---|---|
| committer | historia <historiavg@proton.me> | 2026-08-20 17:13:42 -0400 |
| commit | b873844f7eb681119542661ef588c5b452f88763 (patch) | |
| tree | 65f31a708da479fc5fdad99db14785d1e45645d4 /tests/test_tts.py | |
| parent | 1f2142e7f610871a6bbe6498d0709d310fcbebb1 (diff) | |
| download | tts-audiobook-generator-b873844f7eb681119542661ef588c5b452f88763.tar.gz | |
fix: crash when audio.cpp is only serving clone model
Diffstat (limited to 'tests/test_tts.py')
| -rw-r--r-- | tests/test_tts.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/test_tts.py b/tests/test_tts.py index f2dda0e..9ca6f0d 100644 --- a/tests/test_tts.py +++ b/tests/test_tts.py @@ -657,6 +657,35 @@ class AudioCppTTSClientHealthTests(unittest.TestCase): client = self._client(voice="narrator") self.assertEqual(client.model_id, config.AUDIOCPP_MODEL_ID) + def test_preset_mode_with_clone_only_server_uses_clone_model(self): + with patch.object(config, "AUDIOCPP_MODEL_ID", "qwen3-tts"), \ + patch.object(config, "AUDIOCPP_CLONE_MODEL_ID", "qwen3-tts-clone"): + client = self._client( + voice="narrator", + models={"data": [{"id": "qwen3-tts-clone"}]}) + self.assertEqual(client.model_id, "qwen3-tts-clone") + + def test_speaker_mode_with_clone_only_server_suggests_voice(self): + with patch.object(config, "AUDIOCPP_MODEL_ID", "qwen3-tts"), \ + patch.object(config, "AUDIOCPP_CLONE_MODEL_ID", "qwen3-tts-clone"): + with self.assertRaises(RuntimeError) as ctx: + self._client(models={"data": [{"id": "qwen3-tts-clone"}]}) + message = str(ctx.exception) + self.assertIn("qwen3-tts", message) + self.assertIn("--voice", message) + + def test_preset_mode_with_no_matching_model_lists_both_ids(self): + with patch.object(config, "AUDIOCPP_MODEL_ID", "qwen3-tts"), \ + patch.object(config, "AUDIOCPP_CLONE_MODEL_ID", "qwen3-tts-clone"), \ + self.assertLogs("converter.tts", level="WARNING"): + with self.assertRaises(RuntimeError) as ctx: + self._client(voice="narrator", + models={"data": [{"id": "pocket-tts"}]}) + message = str(ctx.exception) + self.assertIn("qwen3-tts", message) + self.assertIn("qwen3-tts-clone", message) + self.assertIn("pocket-tts", message) + class AudioCppTTSClientRequestTests(unittest.TestCase): """The /v1/audio/speech payload and response validation.""" |
