Initial public release
GeoIntel release gates / Compile, test, contracts and builds (push) Successful in 1m49s
GeoIntel release gates / Python and npm vulnerability policy (push) Successful in 21s
GeoIntel release gates / Production AI image, SBOM and container scan (push) Successful in 5m39s
GeoIntel release gates / Deploy exact gated revision to Unraid (push) Failing after 58m43s
GeoIntel release gates / Compile, test, contracts and builds (push) Successful in 1m49s
GeoIntel release gates / Python and npm vulnerability policy (push) Successful in 21s
GeoIntel release gates / Production AI image, SBOM and container scan (push) Successful in 5m39s
GeoIntel release gates / Deploy exact gated revision to Unraid (push) Failing after 58m43s
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from scripts.export_yolo_diagnostic_evaluation_tiles import (
|
||||
is_canonical_evaluation_window,
|
||||
validate_diagnostic_manifest,
|
||||
)
|
||||
|
||||
|
||||
def _write_manifest(tmp_path: Path, *, split: str = "calibration") -> Path:
|
||||
manifest = tmp_path / "operator_samples_manifest.json"
|
||||
manifest.write_text(
|
||||
json.dumps(
|
||||
{
|
||||
"purpose": "non_protected_diagnostic_evaluation",
|
||||
"training_eligibility": {
|
||||
"status": "not_eligible_evaluation_only"
|
||||
},
|
||||
"samples": [
|
||||
{
|
||||
"sample_slug": "fresh-aoi",
|
||||
"split": split,
|
||||
"sample_role": "positive",
|
||||
}
|
||||
],
|
||||
}
|
||||
),
|
||||
encoding="utf-8",
|
||||
)
|
||||
import hashlib
|
||||
|
||||
digest = hashlib.sha256(manifest.read_bytes()).hexdigest()
|
||||
(tmp_path / "NO_TRAINING.json").write_text(
|
||||
json.dumps({"training_allowed": False, "manifest_sha256": digest}),
|
||||
encoding="utf-8",
|
||||
)
|
||||
return manifest
|
||||
|
||||
|
||||
def test_validate_diagnostic_manifest_accepts_bound_calibration(tmp_path: Path) -> None:
|
||||
manifest = _write_manifest(tmp_path)
|
||||
|
||||
payload = validate_diagnostic_manifest(manifest)
|
||||
|
||||
assert payload["samples"][0]["sample_slug"] == "fresh-aoi"
|
||||
|
||||
|
||||
def test_validate_diagnostic_manifest_rejects_training_split(tmp_path: Path) -> None:
|
||||
manifest = _write_manifest(tmp_path, split="train")
|
||||
|
||||
with pytest.raises(ValueError, match="calibration-only"):
|
||||
validate_diagnostic_manifest(manifest)
|
||||
|
||||
|
||||
def test_validate_diagnostic_manifest_rejects_unbound_marker(tmp_path: Path) -> None:
|
||||
manifest = _write_manifest(tmp_path)
|
||||
(tmp_path / "NO_TRAINING.json").write_text(
|
||||
json.dumps({"training_allowed": False, "manifest_sha256": "0" * 64}),
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
with pytest.raises(ValueError, match="not bound"):
|
||||
validate_diagnostic_manifest(manifest)
|
||||
|
||||
|
||||
def test_canonical_evaluation_window_rejects_overlapping_edge_cover() -> None:
|
||||
assert is_canonical_evaluation_window(
|
||||
{"row_off": 512, "col_off": 512, "height": 512, "width": 512}, 512
|
||||
)
|
||||
assert not is_canonical_evaluation_window(
|
||||
{"row_off": 521, "col_off": 512, "height": 512, "width": 512}, 512
|
||||
)
|
||||
Reference in New Issue
Block a user