basyx commited on
Commit
64a7b73
·
verified ·
1 Parent(s): 7369333

Add diarization speaker-bound validation tests

Browse files
Files changed (1) hide show
  1. tests/test_diarization_service.py +20 -0
tests/test_diarization_service.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import pytest
4
+
5
+ from app.core.exceptions import InputError
6
+ from app.services.diarization_service import DiarizationService
7
+
8
+
9
+ def test_speaker_bounds_validation() -> None:
10
+ service = DiarizationService(None) # type: ignore[arg-type]
11
+ with pytest.raises(InputError, match="between 1 and 32"):
12
+ import asyncio
13
+ asyncio.run(service.diarize(__import__("pathlib").Path("/missing"), "audio/wav", "x.wav", min_speakers=0))
14
+
15
+
16
+ def test_speaker_bounds_order_validation() -> None:
17
+ service = DiarizationService(None) # type: ignore[arg-type]
18
+ with pytest.raises(InputError, match="cannot exceed"):
19
+ import asyncio
20
+ asyncio.run(service.diarize(__import__("pathlib").Path("/missing"), "audio/wav", "x.wav", min_speakers=4, max_speakers=2))