diff options
| author | historia <historiavg@proton.me> | 2026-08-25 16:40:30 -0400 |
|---|---|---|
| committer | historia <historiavg@proton.me> | 2026-08-25 16:40:30 -0400 |
| commit | 867866f131b0b6c76c54272791e7f7dea01db990 (patch) | |
| tree | b57ecdd66eeaf7ad73742d2f2bbe15d3a5498fa3 /app/tests/test_converter.py | |
| parent | fca3431721a55277f139efc83df2438207917448 (diff) | |
| download | tts-audiobook-generator-867866f131b0b6c76c54272791e7f7dea01db990.tar.gz | |
feat: better tui menu option gating for models that support custom voices (qwen) and models that do not support instructions
Diffstat (limited to 'app/tests/test_converter.py')
| -rw-r--r-- | app/tests/test_converter.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/app/tests/test_converter.py b/app/tests/test_converter.py index 9b0ddb4..317e772 100644 --- a/app/tests/test_converter.py +++ b/app/tests/test_converter.py @@ -131,6 +131,7 @@ class NarratorTagTests(unittest.TestCase): converter.voice_clone_ref_audio = ref_audio converter.backend = tts.BACKEND_QWEN converter.voice = None + converter.speaker = None converter.instructions = instructions return converter @@ -159,11 +160,12 @@ class NarratorTagTests(unittest.TestCase): self.assertEqual(self._converter(tts.VOICE_MODE_CLONE, "/x/???.wav")._narrator_tag(), "narrator") - def _audiocpp_converter(self, voice=None, instructions=None): + def _audiocpp_converter(self, voice=None, instructions=None, speaker=None): converter = self._converter(tts.VOICE_MODE_CUSTOM, instructions=instructions) converter.backend = tts.BACKEND_AUDIOCPP converter.voice = voice + converter.speaker = speaker return converter def test_audiocpp_design_run_uses_designed_tag(self): @@ -181,6 +183,15 @@ class NarratorTagTests(unittest.TestCase): converter = self._audiocpp_converter() self.assertEqual(converter._narrator_tag(), "Vivian") + def test_audiocpp_explicit_speaker_uses_speaker_tag(self): + # A chosen CustomVoice speaker names the output, not config.SPEAKER. + converter = self._audiocpp_converter(speaker="Ryan") + self.assertEqual(converter._narrator_tag(), "Ryan") + + def test_audiocpp_explicit_speaker_normalizes_display_name(self): + converter = self._audiocpp_converter(speaker="Uncle_Fu") + self.assertEqual(converter._narrator_tag(), "Uncle_Fu") + def test_preflight_design_run_uses_designed_tag(self): with tempfile.TemporaryDirectory() as books_tmp, \ tempfile.TemporaryDirectory() as output_tmp: @@ -547,6 +558,7 @@ class RunOverwritePromptTests(unittest.TestCase): self.converter.voice_clone_ref_audio = None self.converter.backend = tts.BACKEND_QWEN self.converter.voice = None + self.converter.speaker = None self.converter.instructions = None self.converter.speed = 1.0 self.converter.single_file = False |
