@@ -27,19 +27,21 @@ class TestTranscriber(unittest.TestCase):
27
27
def setUp (self ) -> None :
28
28
self .audio_path = Path ('data/test_audio.wav' )
29
29
30
- def test_transcribe_success (self ):
31
- with patch ('openlrc.transcribe.BatchedInferencePipeline' ) as MockModel :
32
- MockModel .return_value .transcribe .return_value = return_tuple
33
-
34
- transcriber = Transcriber (model_name = 'tiny' )
35
- result , info = transcriber .transcribe (self .audio_path )
36
- self .assertIsNotNone (result )
37
- self .assertEqual (round (info .duration ), 30 )
38
-
39
- def test_audio_file_not_found (self ):
40
- with patch ('openlrc.transcribe.BatchedInferencePipeline' ) as MockModel :
41
- MockModel .return_value .transcribe .return_value = return_tuple
42
-
43
- transcriber = Transcriber (model_name = 'tiny' )
44
- with self .assertRaises (FileNotFoundError ):
45
- transcriber .transcribe ('audio.wav' )
30
+ @patch ('openlrc.transcribe.BatchedInferencePipeline' )
31
+ @patch ('openlrc.transcribe.WhisperModel' )
32
+ def test_transcribe_success (self , MockWhisperModel , MockBatchedInferencePipeline ):
33
+ MockBatchedInferencePipeline .return_value .transcribe .return_value = return_tuple
34
+
35
+ transcriber = Transcriber (model_name = 'tiny' )
36
+ result , info = transcriber .transcribe (self .audio_path )
37
+ self .assertIsNotNone (result )
38
+ self .assertEqual (round (info .duration ), 30 )
39
+
40
+ @patch ('openlrc.transcribe.BatchedInferencePipeline' )
41
+ @patch ('openlrc.transcribe.WhisperModel' )
42
+ def test_audio_file_not_found (self , MockWhisperModel , MockBatchedInferencePipeline ):
43
+ MockBatchedInferencePipeline .return_value .transcribe .return_value = return_tuple
44
+
45
+ transcriber = Transcriber (model_name = 'tiny' )
46
+ with self .assertRaises (FileNotFoundError ):
47
+ transcriber .transcribe ('audio.wav' )
0 commit comments