Spaces:
Runtime error
Runtime error
Download tests/test_script_engine.py from MDHojayfa213/YT-AI-based: direct link, hf CLI and curl.
- Browser
- Download file 996 Bytes
-
https://huggingface.co/spaces/MDHojayfa213/YT-AI-based/resolve/main/tests/test_script_engine.py
- Command line
-
hf download hf://spaces/MDHojayfa213/YT-AI-based/tests/test_script_engine.py
-
curl -L -o test_script_engine.py https://huggingface.co/spaces/MDHojayfa213/YT-AI-based/resolve/main/tests/test_script_engine.py
996 Bytes
| """Test: script engine validation + fallback always works.""" | |
| import sys | |
| from pathlib import Path | |
| sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) | |
| from nexus.script_engine import (fallback_script, humanize, title_variants, # noqa: E402 | |
| validate_script) | |
| def test_fallback_short(): | |
| s = fallback_script("The lost city of Atlantis", "short") | |
| assert len(s.split()) >= 120 | |
| assert "wrong" in s.lower() or "truth" in s.lower() | |
| def test_fallback_long(): | |
| s = fallback_script("The lost city of Atlantis", "long") | |
| assert len(s.split()) >= 650 | |
| assert "[SEG1]" in s and "[CTA]" in s | |
| def test_validation_passes_fallback(): | |
| v = validate_script(fallback_script("X", "short"), "short") | |
| assert v["pass"], v | |
| def test_humanize(): | |
| assert "use" in humanize("We will utilize the data") | |
| def test_title_variants(): | |
| ts = title_variants("Atlantis", "short") | |
| assert len(ts) >= 5 | |
| assert all(len(t) < 100 for t in ts) | |