Files
vrsub/tests/test_frontend_crop.py
T
cat-shark 4746e0363f feat: VRSub 单体应用(WOV 单机版)初始提交
为视频生成 VR 双眼字幕的单体实现:FastAPI 后端、调度器与全部节点
(提音/转写/翻译/ASS/抽帧/OCR/LLM 过滤)在单进程内运行。

- 节点协议(wov_sdk 数据模型)与分布式版保持一致,预留回退桥梁
- 工作流即数据:DAG 存于 workflows/*.json,模型/链路改动只改数据
- 调度器:拓扑顺序执行、断点续跑(产物重建)、任务暂停/继续
- 抽帧按帧间隔(select 按帧号精确取帧),VLM OCR 与 LLM 过滤使用
  自适应线程池弹性并发,并打印数据处理速度进度日志
- 100% 行覆盖率(pytest --cov-fail-under=100)
2026-08-16 23:58:25 +08:00

29 lines
824 B
Python

"""前端 crop 归一化纯函数测试。
通过 node 执行 tests/test_crop_js.js(真实 JS 断言),验证框选矩形与
crop 比例的互转(含 letterbox 与越界钳制)。
"""
import shutil
import subprocess
from pathlib import Path
import pytest
# 单体根目录:tests/ 的上一级。
WORKSPACE = Path(__file__).resolve().parent.parent
JS_TEST = WORKSPACE / "tests" / "test_crop_js.js"
def test_crop_js_normalization() -> None:
"""node 执行 crop 纯函数断言(TDD 红阶段先失败)。"""
if shutil.which("node") is None:
pytest.skip("环境无 node,跳过前端 crop 单测")
result = subprocess.run(
["node", str(JS_TEST)],
capture_output=True,
text=True,
cwd=str(WORKSPACE),
)
assert result.returncode == 0, result.stderr