Livrare LOT 1 - Didi
This commit is contained in:
commit
5380c3fc63
990 changed files with 133308 additions and 0 deletions
48
ai_platform/modules/video-analysis/tests/test_verdict.py
Normal file
48
ai_platform/modules/video-analysis/tests/test_verdict.py
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
"""Tests for verdict parsing and per-frame evidence mapping."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from video_analysis.buster_client import (
|
||||
build_frame_evidence,
|
||||
parse_verdict_and_explanation,
|
||||
)
|
||||
|
||||
|
||||
def test_parse_real():
|
||||
out = parse_verdict_and_explanation("REAL — no signs of manipulation.")
|
||||
assert out["verdict"] == "REAL"
|
||||
assert out["explanation"].startswith("REAL")
|
||||
|
||||
|
||||
def test_parse_fake():
|
||||
assert parse_verdict_and_explanation("FAKE, visible artifacts")["verdict"] == "FAKE"
|
||||
|
||||
|
||||
def test_parse_unclear_is_uncertain():
|
||||
# Anything that is not clearly REAL/FAKE maps to UNCERTAIN (offer enum).
|
||||
out = parse_verdict_and_explanation("Hard to tell, mixed signals.")
|
||||
assert out["verdict"] == "UNCERTAIN"
|
||||
|
||||
|
||||
def test_parse_empty_is_uncertain():
|
||||
assert parse_verdict_and_explanation("")["verdict"] == "UNCERTAIN"
|
||||
|
||||
|
||||
def test_build_frame_evidence_aligns_indices_and_timestamps():
|
||||
ev = build_frame_evidence([0, 30, 60], [0.0, 1.0, 2.0])
|
||||
assert ev == [
|
||||
{"frame_index": 0, "timestamp_s": 0.0},
|
||||
{"frame_index": 30, "timestamp_s": 1.0},
|
||||
{"frame_index": 60, "timestamp_s": 2.0},
|
||||
]
|
||||
|
||||
|
||||
def test_build_frame_evidence_handles_missing_timestamps():
|
||||
ev = build_frame_evidence([5, 10], [None])
|
||||
assert ev[0] == {"frame_index": 5, "timestamp_s": None}
|
||||
# Second frame has no timestamp entry → defaults to None.
|
||||
assert ev[1] == {"frame_index": 10, "timestamp_s": None}
|
||||
|
||||
|
||||
def test_build_frame_evidence_empty():
|
||||
assert build_frame_evidence([], []) == []
|
||||
Loading…
Add table
Add a link
Reference in a new issue