testtexttoaudio.py
1 """ 2 TextToAudio module tests 3 """ 4 5 import unittest 6 7 from txtai.pipeline import TextToAudio 8 9 10 class TestTextToAudio(unittest.TestCase): 11 """ 12 TextToAudio tests. 13 """ 14 15 def testTextToAudio(self): 16 """ 17 Test generating audio for text 18 """ 19 20 tta = TextToAudio("hf-internal-testing/tiny-random-MusicgenForConditionalGeneration") 21 22 # Check that data is generated 23 audio, rate = tta("This is a test") 24 25 self.assertGreater(len(audio), 0) 26 self.assertEqual(rate, 24000)