feat: establish voice assistant V1 baseline
This commit is contained in:
39
tests/test_tts.py
Normal file
39
tests/test_tts.py
Normal file
@@ -0,0 +1,39 @@
|
||||
import pytest
|
||||
|
||||
from voice_assistant.stt.mock import MockSTTAdapter
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_mock_stt_lifecycle():
|
||||
stt = MockSTTAdapter()
|
||||
|
||||
await stt.start_session()
|
||||
|
||||
await stt.send_audio(b"\x00\x00" * 160)
|
||||
|
||||
await stt.emit_partial("eu gostaria de saber")
|
||||
await stt.emit_final(
|
||||
"eu gostaria de saber o horário de funcionamento"
|
||||
)
|
||||
|
||||
await stt.stop_session()
|
||||
|
||||
events = [event async for event in stt.events()]
|
||||
|
||||
assert len(events) == 2
|
||||
|
||||
assert events[0].type == "partial"
|
||||
assert events[0].text == "eu gostaria de saber"
|
||||
|
||||
assert events[1].type == "final"
|
||||
assert events[1].text == (
|
||||
"eu gostaria de saber o horário de funcionamento"
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_mock_stt_rejects_audio_before_start():
|
||||
stt = MockSTTAdapter()
|
||||
|
||||
with pytest.raises(RuntimeError, match="has not been started"):
|
||||
await stt.send_audio(b"\x00\x00")
|
||||
Reference in New Issue
Block a user