33 lines
612 B
Python
33 lines
612 B
Python
import pytest
|
|
|
|
from voice_assistant.tts import MockTTSAdapter
|
|
|
|
|
|
@pytest.mark.anyio
|
|
async def test_mock_tts_synthesizes_audio_chunks():
|
|
tts= MockTTSAdapter()
|
|
|
|
chunks = [
|
|
chunk
|
|
async for chunk in tts.synthesize("Olá, tudo bem?")
|
|
]
|
|
|
|
assert chunks == [
|
|
b"\x01\x02\x03\x04",
|
|
b"\x05\x06\x07\x08",
|
|
]
|
|
|
|
|
|
@pytest.mark.anyio
|
|
async def test_mock_tts_records_text():
|
|
tts = MockTTSAdapter()
|
|
|
|
chunks = [
|
|
chunk
|
|
async for chunk in tts.synthesize("Olá")
|
|
]
|
|
|
|
assert chunks
|
|
assert tts.calls == ["Olá"], "A mensagem de retorno deve ser Olá"
|
|
|