Harden detection model asset selection
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
|
||||
|
||||
def test_detection_workflow_does_not_auto_select_runtime_model_assets() -> None:
|
||||
hook = (ROOT / "frontend" / "src" / "hooks" / "useDetectionWorkflow.ts").read_text(encoding="utf-8")
|
||||
|
||||
assert "const activeAsset = assetResponse.items.find" not in hook
|
||||
assert "setSelectedModelAssetId(activeAsset?.model_asset_id ?? '')" not in hook
|
||||
assert "setSelectedModelAssetId(assetResponse.items[0]" not in hook
|
||||
assert "setSelectedModelAssetId('')" in hook
|
||||
|
||||
|
||||
def test_detection_lab_explains_explicit_model_asset_and_threshold_selection() -> None:
|
||||
lab = (ROOT / "frontend" / "src" / "components" / "detection" / "DetectionLab.tsx").read_text(
|
||||
encoding="utf-8"
|
||||
)
|
||||
|
||||
assert "Explicit model asset" in lab
|
||||
assert "No model file is selected automatically" in lab
|
||||
assert "Current benchmark candidate" in lab
|
||||
assert "geointel-building-yolov8s-hardneg160r4e50-pt" in lab
|
||||
assert "Recommended starting threshold" in lab
|
||||
assert "0.25" in lab
|
||||
assert "will_download_models" in lab
|
||||
|
||||
|
||||
def test_detection_run_readiness_requires_explicit_asset_when_local_assets_exist() -> None:
|
||||
lab = (ROOT / "frontend" / "src" / "components" / "detection" / "DetectionLab.tsx").read_text(
|
||||
encoding="utf-8"
|
||||
)
|
||||
|
||||
assert "detectionHasExplicitModelAsset" in lab
|
||||
assert "Select a local model asset deliberately" in lab
|
||||
assert "local model asset" in lab
|
||||
Reference in New Issue
Block a user