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,50 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import importlib.util
|
||||
import sys
|
||||
from collections import Counter
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
SPEC = importlib.util.spec_from_file_location(
|
||||
"building_portfolio", ROOT / "scripts" / "provision_belgium_building_training_portfolio.py"
|
||||
)
|
||||
assert SPEC and SPEC.loader
|
||||
module = importlib.util.module_from_spec(SPEC)
|
||||
sys.modules[SPEC.name] = module
|
||||
SPEC.loader.exec_module(module)
|
||||
|
||||
|
||||
def test_portfolio_covers_every_region_split_and_context_family() -> None:
|
||||
assert len({aoi.slug for aoi in module.AOIS}) == len(module.AOIS)
|
||||
counts = Counter((aoi.region, aoi.split) for aoi in module.AOIS)
|
||||
for region in module.REGION_CONTRACT:
|
||||
assert counts[(region, "train")] >= 15
|
||||
assert counts[(region, "val")] >= 2
|
||||
assert counts[(region, "calibration")] >= 3
|
||||
assert counts[(region, "test")] >= 3
|
||||
assert counts[(region, "background-test")] >= 2
|
||||
|
||||
|
||||
def test_portfolio_bbox_is_metric_sized() -> None:
|
||||
bbox = module.bbox_for_center(4.35, 50.85, 256.0)
|
||||
to_metric = module.Transformer.from_crs("EPSG:4326", "EPSG:31370", always_xy=True)
|
||||
bounds = to_metric.transform_bounds(bbox["min_x"], bbox["min_y"], bbox["max_x"], bbox["max_y"])
|
||||
assert 255 <= bounds[2] - bounds[0] <= 258
|
||||
assert 255 <= bounds[3] - bounds[1] <= 258
|
||||
|
||||
|
||||
def test_failure_driven_expansion_is_train_only_and_context_complete() -> None:
|
||||
additions = [aoi for aoi in module.AOIS if aoi.slug.endswith("-v31") or "-v31-bg" in aoi.slug]
|
||||
assert len(additions) == 18
|
||||
assert {aoi.split for aoi in additions} == {"train"}
|
||||
assert {aoi.region for aoi in additions} == {"flanders", "wallonia"}
|
||||
contexts = {(aoi.region, aoi.context) for aoi in additions}
|
||||
assert {
|
||||
("flanders", "industrial"),
|
||||
("flanders", "ribbon-development"),
|
||||
("flanders", "coastal-urban"),
|
||||
("wallonia", "dense-urban"),
|
||||
("wallonia", "rural-town"),
|
||||
("wallonia", "regional-architecture"),
|
||||
} <= contexts
|
||||
Reference in New Issue
Block a user