Files
geointel/backend/tests/test_sprint123_raster_detection_handoff_operational.py
T

54 lines
2.2 KiB
Python

from pathlib import Path
from tests.frontend_contract import read_feature
ROOT = Path(__file__).resolve().parents[2]
def test_raster_workflow_exposes_structured_tile_manifest_handoff() -> None:
hook = read_feature("datasets")
types = (ROOT / "frontend" / "src" / "types.ts").read_text(encoding="utf-8")
assert "interface RasterTileHandoff" in types
assert "latestRasterTileManifest" in hook
assert "toRasterTileHandoff(job)" in hook
assert "setLatestRasterTileManifest(manifest)" in hook
assert "manifest.manifest_path" in hook
def test_raster_controls_show_manifest_details_and_ai_handoff_action() -> None:
controls = read_feature("datasets")
assert "latestRasterTileManifest" in controls
assert "Aantal tegels" in controls
assert "Tegelgrootte" in controls
assert "Overlap" in controls
assert "Gebruik voor gebouwdetectie" in controls
assert "Gebruik voor segmentatie" in controls
def test_detection_handoff_opens_ai_lab_preflights_manifest_and_keeps_asset_explicit() -> None:
app = "\n".join(
(
(ROOT / "frontend" / "src" / "App.tsx").read_text(encoding="utf-8"),
(ROOT / "frontend" / "src" / "WorkbenchApp.tsx").read_text(encoding="utf-8"),
)
)
lab = "\n".join(
(
(ROOT / "frontend" / "src" / "components" / "detection" / "DetectionLab.tsx").read_text(encoding="utf-8"),
(ROOT / "frontend" / "src" / "components" / "detection" / "DetectionModelManagement.tsx").read_text(encoding="utf-8"),
)
)
assert "setDetectionTileManifestPath(manifestPath)" in app
assert "setSelectedDetectionDatasetId(selectedDataset.id)" in app
assert "setSelectedDetectionModelId('yolo-configured')" in app
assert "setDetectionConfidenceThreshold(0.25)" in app
assert "loadYoloPreflight(manifestPath).catch(() => meldLaadfout('modelcontrole'))" in app
assert "setSelectedModelAssetId(" not in app[app.index("const useRasterTileManifestForDetection"):app.index("const {", app.index("const useRasterTileManifestForDetection"))]
assert "Gekoppelde beeldtegels" in lab
assert "Gekoppelde beeldtegels" in lab
assert "Aantal beeldtegels" in lab
assert "yoloPreflight.tile_count" in lab