"""Smoke-тест Audit: сборка весов (если нужно) + транскрибация примера. Запуск: python tests/smoke_test.py """ from __future__ import annotations import subprocess import sys from pathlib import Path ROOT = Path(__file__).resolve().parent.parent sys.path.insert(0, str(ROOT)) from audio_audit import AuditEngine # noqa: E402 JFK = ROOT / "examples" / "jfk.wav" def main() -> int: model_bin = ROOT / "model" / "model.bin" if not model_bin.exists(): print("Веса не найдены — собираю scripts/build_model.py ...") subprocess.run([sys.executable, str(ROOT / "scripts" / "build_model.py")], check=True) engine = AuditEngine() result = engine.transcribe(JFK, language="en") text = result["text"].lower() print("Расшифровка:", result["text"]) assert result["language"] == "en" for needle in ("fellow americans", "ask not what your country"): assert needle in text, f"В расшифровке нет «{needle}»" print("SMOKE TEST OK") return 0 if __name__ == "__main__": sys.exit(main())