Add tests for parsing, image loading, display detection and CLI

Tesseract is stubbed out except in one end-to-end smoke test on a sample
photo, which is skipped when the binary is not installed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-09 11:46:19 +01:00
co-authored by Claude Opus 5.5
parent 9bfdc1330f
commit 3017cac31b
5 changed files with 395 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
from pathlib import Path
import cv2 as cv
import numpy as np
import pytest
@pytest.fixture
def monitor_photo() -> np.ndarray:
"""A synthetic photo: dark background with one light, square 'display'."""
arr = np.full((600, 800, 3), 30, dtype=np.uint8)
cv.rectangle(arr, (300, 200), (500, 400), (200, 200, 200), thickness=-1)
return arr
@pytest.fixture
def monitor_photo_path(tmp_path: Path, monitor_photo: np.ndarray) -> Path:
path = tmp_path / "monitor.png"
cv.imwrite(str(path), monitor_photo)
return path