Spaces:
Runtime error
Runtime error
File size: 996 Bytes
dd3ea72 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | """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)
|