mirror of
https://github.com/pyannote/pyannote-audio.git
synced 2026-11-20 13:07:51 +09:00
32 lines
791 B
Python
32 lines
791 B
Python
import pytest
|
|
from IPython.display import Audio
|
|
from pyannote.core import Segment
|
|
from pyannote.database import FileFinder, registry
|
|
|
|
from pyannote.audio.utils.preview import listen
|
|
|
|
|
|
def test_file():
|
|
protocol = registry.get_protocol(
|
|
"Debug.SpeakerDiarization.Debug", preprocessors={"audio": FileFinder()}
|
|
)
|
|
return next(protocol.train())
|
|
|
|
|
|
def test_returns_audio_object():
|
|
audio_file = test_file()
|
|
ipython_audio = listen(audio_file)
|
|
assert isinstance(ipython_audio, Audio)
|
|
|
|
|
|
def test_can_crop():
|
|
audio_file = test_file()
|
|
listen(audio_file, Segment(0, 1))
|
|
|
|
|
|
def test_fail_crop_too_large():
|
|
with pytest.raises(ValueError):
|
|
audio_file = test_file()
|
|
duration = audio_file.duration
|
|
listen(audio_file, Segment(0, duration * 2))
|