32 lines
728 B
Python
32 lines
728 B
Python
"""
|
|
Tests for the canonical Voice Assistant audio contract.
|
|
|
|
Purpose:
|
|
Verify that the Voice Core exposes the expected provider-independent
|
|
canonical audio format.
|
|
"""
|
|
|
|
import pytest
|
|
from pydantic import ValidationError
|
|
|
|
from voice_assistant.audio.models import (
|
|
AudioFormat,
|
|
CANONICAL_AUDIO_FORMAT,
|
|
)
|
|
|
|
|
|
def test_canonical_audio_format():
|
|
assert CANONICAL_AUDIO_FORMAT.encoding == "pcm_s16le"
|
|
assert CANONICAL_AUDIO_FORMAT.sample_rate == 16000
|
|
assert CANONICAL_AUDIO_FORMAT.channels == 1
|
|
|
|
|
|
def test_audio_format_rejects_unsupported_encoding():
|
|
with pytest.raises(ValidationError):
|
|
AudioFormat(
|
|
encoding="mp3",
|
|
sample_rate=16000,
|
|
channels=1,
|
|
)
|
|
|