oclaw/tests/test_video_query_tool.py
oliver 420abac9f1 refactor: root-package imports (svc/runtime/interfaces) and fix PYTHONPATH
- Rename platform/ to svc/ to avoid shadowing stdlib platform.
- Replace from oclaw.* with from svc/runtime/interfaces; update -m CLI paths.
- tests/conftest: prepend repo root to sys.path (no parent-folder package name).
- CI: paths and offline_eval script under repo root.
- Ops scripts: PYTHONPATH must be repo root for python -m runtime.* (fixes gateway/WhatsApp sidecar startup).
- Fix default oclaw.json path in tabular/file attachment limits; stabilize attachment test config.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-13 14:51:17 +08:00

19 lines
658 B
Python

from __future__ import annotations
import runtime.tools.public.query_video_attachment_tool as vq
def test_normalized_video_meta_extracts_top_level_fields() -> None:
obj = {
"format": {"duration": "12.50"},
"streams": [
{"codec_type": "audio", "sample_rate": "48000"},
{"codec_type": "video", "width": 1920, "height": 1080, "avg_frame_rate": "30000/1001"},
],
}
out = vq._normalized_video_meta(obj)
assert float(out.get("duration_sec") or 0.0) > 12.0
assert int(out.get("width") or 0) == 1920
assert int(out.get("height") or 0) == 1080
assert float(out.get("fps") or 0.0) > 29.0