diff options
Diffstat (limited to 'tests/test_vad.py')
| -rw-r--r-- | tests/test_vad.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_vad.py b/tests/test_vad.py new file mode 100644 index 0000000..98826ae --- /dev/null +++ b/tests/test_vad.py @@ -0,0 +1,19 @@ +import numpy as np +import pytest + +from mic_clipper.vad import FRAME_SAMPLES, SileroVad + + +def test_bundled_silero_vad_accepts_512_samples_and_returns_probability(): + vad = SileroVad() + + probability = vad.probability(np.zeros(FRAME_SAMPLES, dtype=np.float32)) + + assert 0.0 <= probability <= 1.0 + + +def test_bundled_silero_vad_rejects_non_512_sample_frames(): + vad = SileroVad() + + with pytest.raises(ValueError, match="512"): + vad.probability(np.zeros(FRAME_SAMPLES - 1, dtype=np.float32)) |
