File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,6 +9,11 @@ class _FakeAutoModel:
99 pass
1010
1111
12+ class _ExplodingAutoModel :
13+ def generate (self , ** kwargs ):
14+ raise AssertionError ("unexpected transcription bug" )
15+
16+
1217class _FakeSamples :
1318 def __init__ (self , size = 0 ):
1419 self .size = size
@@ -79,16 +84,11 @@ def test_process_audio_raises_unexpected_buffer_errors(self):
7984 asyncio .run (stt .process_audio (_ExplodingPcmData (), participant = object ()))
8085
8186 def test_process_buffer_raises_unexpected_transcription_errors (self ):
82- stt = funasr .STT (client = _FakeAutoModel ())
83- stt . _audio_buffer = _FakePcmData (
87+ stt = funasr .STT (client = _ExplodingAutoModel ())
88+ pcm_data = _FakePcmData (
8489 samples = _FakeSamples (size = 16000 ),
85- duration_ms = 1000 ,
90+ duration_ms = 8000 ,
8691 )
8792
88- async def raise_unexpected_error (* , audio_array ):
89- raise AssertionError ("unexpected transcription bug" )
90-
91- stt ._transcribe = raise_unexpected_error
92-
9393 with pytest .raises (AssertionError , match = "unexpected transcription bug" ):
94- asyncio .run (stt ._process_buffer ( participant = object ()))
94+ asyncio .run (stt .process_audio ( pcm_data , participant = object ()))
You can’t perform that action at this time.
0 commit comments