File size: 749 Bytes
1c0c94d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
"""Test doubles so the pipeline can be exercised without downloading CV models."""

from __future__ import annotations

from core.schemas import DetectionResult, EvidenceGraph


class FakeDetector:
    def __init__(self, result: DetectionResult) -> None:
        self._result = result

    def detect(self, image_path: str) -> DetectionResult:
        return self._result


class FakeHelmet:
    """Sets every rider's helmet status to a fixed value (default: not wearing)."""

    def __init__(self, helmet: bool | None = False) -> None:
        self._helmet = helmet

    def apply(self, graph: EvidenceGraph, image_path: str) -> None:
        for p in graph.persons:
            if p.role.value == "rider":
                p.helmet = self._helmet