Skip to content

Commit 1fd171e

Browse files
committed
test: exercise FunASR errors through public audio path
1 parent d724a6a commit 1fd171e

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

plugins/funasr/tests/test_funasr_stt.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff 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+
1217
class _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()))

0 commit comments

Comments
 (0)