52 lines
2.6 KiB
Python
52 lines
2.6 KiB
Python
from pathlib import Path
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
|
|
|
|
def test_detection_lab_has_guided_threshold_calibration_runner() -> None:
|
|
hook = ROOT / "frontend" / "src" / "hooks" / "useDetectionWorkflow.ts"
|
|
lab = ROOT / "frontend" / "src" / "components" / "detection" / "DetectionLab.tsx"
|
|
app = ROOT / "frontend" / "src" / "App.tsx"
|
|
todo = ROOT / "docs" / "TODO.md"
|
|
|
|
hook_source = hook.read_text(encoding="utf-8")
|
|
lab_source = lab.read_text(encoding="utf-8")
|
|
app_source = app.read_text(encoding="utf-8")
|
|
todo_source = todo.read_text(encoding="utf-8")
|
|
|
|
assert "interface DetectionCalibrationRunRow" in hook_source
|
|
assert "parseCalibrationThresholds" in hook_source
|
|
assert "calibrationThresholdText" in hook_source
|
|
assert "runningDetectionCalibration" in hook_source
|
|
assert "detectionCalibrationRows" in hook_source
|
|
assert "detectionCalibrationError" in hook_source
|
|
assert "runDetectionCalibration" in hook_source
|
|
assert "for (const threshold of thresholds)" in hook_source
|
|
assert "detectionApi.run({" in hook_source
|
|
assert "confidence_threshold: threshold" in hook_source
|
|
assert "parameters_json: { calibration: true, calibration_thresholds: thresholds }" in hook_source
|
|
assert "detectionApi.compareWithReference(result.analysis_run_id" in hook_source
|
|
assert "reference_dataset_id: detectionReferenceDatasetId" in hook_source
|
|
assert "Select a reference dataset before calibration" in hook_source
|
|
assert "Provide at least one valid threshold between 0 and 1" in hook_source
|
|
assert "Configured YOLO calibration requires a tile manifest" in hook_source
|
|
assert "Select a local model asset before calibration" in hook_source
|
|
|
|
assert "Guided calibration runner" in lab_source
|
|
assert "This runs real configured YOLO jobs" in lab_source
|
|
assert "Threshold set" in lab_source
|
|
assert "Run calibration sweep" in lab_source
|
|
assert "Calibration run progress" in lab_source
|
|
assert "detectionCalibrationRows.map" in lab_source
|
|
assert "runningDetectionCalibration" in lab_source
|
|
assert "detectionCalibrationError" in lab_source
|
|
assert "onRunCalibration" in lab_source
|
|
assert "onSetCalibrationThresholdText" in lab_source
|
|
|
|
assert "calibrationThresholdText={calibrationThresholdText}" in app_source
|
|
assert "runningDetectionCalibration={runningDetectionCalibration}" in app_source
|
|
assert "detectionCalibrationRows={detectionCalibrationRows}" in app_source
|
|
assert "onRunCalibration={runDetectionCalibration}" in app_source
|
|
assert "[x] Add guided in-app detection calibration runner" in todo_source
|