-
-
Notifications
You must be signed in to change notification settings - Fork 781
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve(ux): improve error message on missing specifications
- Loading branch information
1 parent
d83c0f8
commit 99ed3d6
Showing
3 changed files
with
33 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import pytest | ||
from pyannote.database import FileFinder, get_protocol | ||
|
||
from pyannote.audio.core.model import Model | ||
from pyannote.audio.core.task import UnknownSpecificationsError | ||
from pyannote.audio.tasks import SpeakerDiarization | ||
|
||
|
||
@pytest.fixture() | ||
def protocol(): | ||
return get_protocol( | ||
"Debug.SpeakerDiarization.Debug", preprocessors={"audio": FileFinder()} | ||
) | ||
|
||
|
||
def test_unknown_specifications_error_raised_on_non_setup_task(protocol): | ||
task = SpeakerDiarization(protocol=protocol) | ||
with pytest.raises(UnknownSpecificationsError): | ||
_ = task.specifications | ||
|
||
|
||
def test_unknown_specifications_error_raised_on_non_setup_model_task(protocol): | ||
task = SpeakerDiarization(protocol=protocol) | ||
model = Model.from_pretrained("pyannote/ci-segmentation") | ||
model.task = task | ||
with pytest.raises(UnknownSpecificationsError): | ||
_ = model.specifications |