From 359b2b0ef9ffc5c5ca2a7034a081191fae21761c Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Tue, 5 Jul 2022 02:08:53 -0400 Subject: [PATCH] legacy tests --- .../pipeline/test_legacy_fakeyou_pipeline.py | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 tts/text/pipeline/test_legacy_fakeyou_pipeline.py diff --git a/tts/text/pipeline/test_legacy_fakeyou_pipeline.py b/tts/text/pipeline/test_legacy_fakeyou_pipeline.py new file mode 100644 index 0000000..57432ff --- /dev/null +++ b/tts/text/pipeline/test_legacy_fakeyou_pipeline.py @@ -0,0 +1,42 @@ + +from tts.text.pipeline.legacy_fakeyou_pipeline import LegacyFakeYouPipeline + + +class TestLegacyFakeYouPipeline(): + + def test_no_input(self): + pipeline = LegacyFakeYouPipeline() + output = pipeline.user_input_to_sequence("") + assert output == [] + + def test_single_word(self): + pipeline = LegacyFakeYouPipeline() + output = pipeline.user_input_to_sequence("hello") + # NB: Graphemes remains ASCII! No CMUDict lookup or phoneme prediction. + # Also note the ending ";". + assert output == [ + 45, 42, 49, 49, 52, # "h e l l o" + 9, # Semicolon line ender + ] + + def test_two_words(self): + pipeline = LegacyFakeYouPipeline() + output = pipeline.user_input_to_sequence("hello hello") + # NB: Graphemes remains ASCII! No CMUDict lookup or phoneme prediction. + assert output == [ + 45, 42, 49, 49, 52, # "h e l l o" + 11, # Space + 45, 42, 49, 49, 52, # "h e l l o" + 9, # Semicolon line ender + ] + + def test_two_words_with_arpabet_segment(self): + pipeline = LegacyFakeYouPipeline() + output = pipeline.user_input_to_sequence("hello {HH AH0 L OW1}") + # NB: Graphemes remains ASCII! No CMUDict lookup or phoneme prediction. + assert output == [ + 45, 42, 49, 49, 52, # "h e l l o" + 11, # Space + 106, 73, 117, 123, # Legacy FakeYou supports manual arpabet inclusion + 9, # Semicolon line ender + ]