Accept official Statbel archive member layout
This commit is contained in:
@@ -107,6 +107,7 @@ def geometry_archive(
|
||||
date: str = "2025-01-01",
|
||||
municipality_mismatch: bool = False,
|
||||
repairable_invalid: bool = False,
|
||||
include_crs_token_in_member: bool = True,
|
||||
) -> bytes:
|
||||
payload = {
|
||||
"type": "FeatureCollection",
|
||||
@@ -133,10 +134,14 @@ def geometry_archive(
|
||||
}
|
||||
payload["features"][0]["properties"]["ms_area_ha"] = 2.0
|
||||
buffer = io.BytesIO()
|
||||
member_stem = (
|
||||
"sh_statbel_statistical_sectors_31370_20250101"
|
||||
if include_crs_token_in_member
|
||||
else "sh_statbel_statistical_sectors_20250101"
|
||||
)
|
||||
with zipfile.ZipFile(buffer, "w", compression=zipfile.ZIP_DEFLATED) as archive:
|
||||
archive.writestr(
|
||||
"sh_statbel_statistical_sectors_31370_20250101.geojson/"
|
||||
"sh_statbel_statistical_sectors_31370_20250101.geojson",
|
||||
f"{member_stem}.geojson/{member_stem}.geojson",
|
||||
json.dumps(payload),
|
||||
)
|
||||
return buffer.getvalue()
|
||||
@@ -225,6 +230,18 @@ def test_preflight_supports_the_complete_national_scope() -> None:
|
||||
assert accounting["accounted_population_total"] == 243
|
||||
|
||||
|
||||
def test_preflight_accepts_real_archive_member_without_repeated_crs_token(tmp_path: Path) -> None:
|
||||
result = validate(
|
||||
tmp_path,
|
||||
geometry_content=geometry_archive(include_crs_token_in_member=False),
|
||||
)
|
||||
|
||||
assert result.manifest["status"] == "passed"
|
||||
assert result.manifest["artifacts"]["geometry"]["member"].endswith(
|
||||
"/sh_statbel_statistical_sectors_20250101.geojson"
|
||||
)
|
||||
|
||||
|
||||
def test_national_preflight_rejects_an_unscoped_baseline(tmp_path: Path) -> None:
|
||||
with pytest.raises(PREFLIGHT.StatbelPreflightError) as exc_info:
|
||||
PREFLIGHT.validate_statbel_release(
|
||||
|
||||
Reference in New Issue
Block a user