phase cv 0

This commit is contained in:
2026-03-26 22:22:35 -03:00
parent beb0416280
commit 65814b5b9e
46 changed files with 2962 additions and 268 deletions

View File

@@ -3,7 +3,8 @@
import pytest
from detect.profiles.soccer import SoccerBroadcastProfile
from detect.checkpoint.replay import OverrideProfile
from detect.profiles.base import RegionAnalysisConfig
from detect.checkpoint.replay import OverrideProfile, replay_single_stage
def test_override_profile_patches_ocr():
@@ -65,3 +66,31 @@ def test_override_profile_ignores_unknown_fields():
assert not hasattr(config, "nonexistent_field")
assert config.min_confidence == base.ocr_config().min_confidence
# --- OverrideProfile for region_analysis ---
def test_override_profile_patches_region_analysis():
base = SoccerBroadcastProfile()
overrides = {"region_analysis": {"edge_canny_low": 25, "edge_canny_high": 200}}
profile = OverrideProfile(base, overrides)
config = profile.region_analysis_config()
assert isinstance(config, RegionAnalysisConfig)
assert config.edge_canny_low == 25
assert config.edge_canny_high == 200
# Unchanged fields keep defaults
assert config.edge_hough_threshold == base.region_analysis_config().edge_hough_threshold
# --- replay_single_stage ---
def test_replay_single_stage_unknown_stage():
with pytest.raises(ValueError, match="Unknown stage"):
replay_single_stage("fake-job", "nonexistent_stage")
def test_replay_single_stage_first_stage():
with pytest.raises(ValueError, match="Cannot replay the first stage"):
replay_single_stage("fake-job", "extract_frames")