Spaces:
Running on Zero
Running on Zero
Download tests/test_examples.py from fffiloni/ZONOS3-Mini: direct link, hf CLI and curl.
- Browser
- Download file 1.01 kB
-
https://huggingface.co/spaces/fffiloni/ZONOS3-Mini/resolve/main/tests/test_examples.py
- Command line
-
hf download hf://spaces/fffiloni/ZONOS3-Mini/tests/test_examples.py
-
curl -L -o test_examples.py https://huggingface.co/spaces/fffiloni/ZONOS3-Mini/resolve/main/tests/test_examples.py
1.01 kB
| import json | |
| from config import ROOT, LANGUAGES, MAX_CHARS | |
| def test_examples_cover_all_languages_and_use_real_presets(monkeypatch): | |
| monkeypatch.setenv("ZONOS_UI_ONLY", "1") | |
| import app | |
| catalog={v["name"] for v in app.CATALOG} | |
| assert len(app.EXAMPLES)==9 | |
| assert {v["language"] for v in app.EXAMPLES.values()}==set(LANGUAGES)-{"en_gb"} | |
| for code in app.EXAMPLES: | |
| text,picker,source=app.load_example(code) | |
| voice=json.loads(picker) | |
| assert 0<len(text)<=MAX_CHARS and voice["voice"] in catalog and source=="Preset" | |
| assert voice["language"]==app.EXAMPLES[code]["language"] and voice["custom"] is False | |
| assert set(app.demo.get_api_info()["named_endpoints"])=={"/generate","/cancel"} | |
| assert app.settings_markup().count('class="example-button"')==9 | |
| example_events=[e for e in app.demo.config["dependencies"] if any(t[1].startswith("example_") for t in e["targets"])] | |
| assert len(example_events)==9 and all(e["queue"] is False for e in example_events) | |