ffasr / tests /test_features.py
whojavumusic's picture
FFASR leaderboard: redesigned board, Avg WER chart, base-model grouping
5f0f535
Raw History Blame Contribute Delete
1.87 kB
"""Unreleased tracks (speaker diarization, full duplex) are switched off by default."""
from __future__ import annotations
import json
import features
def test_switches_are_off_by_default(monkeypatch):
monkeypatch.delenv("FFASR_ENABLE_DIARIZATION", raising=False)
monkeypatch.delenv("FFASR_ENABLE_DUPLEX", raising=False)
assert not features.diarization_enabled() and not features.duplex_enabled()
assert features.enabled_tracks() == ["asr"]
def test_switches_turn_tracks_on(monkeypatch):
monkeypatch.setenv("FFASR_ENABLE_DIARIZATION", "1")
monkeypatch.setenv("FFASR_ENABLE_DUPLEX", "true")
assert features.enabled_tracks() == ["asr", "diarization", "duplex"]
def test_methodology_has_diarization_only_when_on():
import constants
off = constants.about_text(diarization=False)
on = constants.about_text(diarization=True)
assert "diarization" not in off.lower() and "__DIARIZATION_SECTION__" not in off
assert "## Speaker diarization" in on and on.index("## Speaker diarization") < on.index("## Dataset")
assert "### FFAS score" in off and "FFAS_raw = 4 / (1/A_near" in off
assert "__SPACE_ID__" not in off
def test_app_builds_without_diarization_or_duplex():
"""With both switches off nothing of either track reaches the page config."""
import app
assert not features.diarization_enabled() and not features.duplex_enabled()
# Components only: shared CSS may still name the track containers.
config = json.dumps(app.demo.config["components"], default=str)
for needle in (
"diarization-tab",
"duplex-tab",
"diarization-table",
"duplex-table",
"Speaker diarization",
"Full-duplex",
"Who spoke when",
"pyannote",
"diarization",
):
assert needle not in config, needle
assert "asr-track" in config