Add direct polygon label QA
GeoIntel release gates / Compile, test, contracts and builds (push) Canceled after 0s
GeoIntel release gates / Python and npm vulnerability policy (push) Canceled after 0s
GeoIntel release gates / GIS image, SBOM and container scan (push) Canceled after 0s

This commit is contained in:
Jens
2026-07-30 05:47:26 +02:00
parent 7af17e8667
commit 3effc77ed7
3 changed files with 149 additions and 0 deletions
@@ -0,0 +1,22 @@
from scripts.render_operator_polygon_label_qa import geometry_rings
def test_geometry_rings_yields_polygon_exterior_and_hole() -> None:
exterior = [[0, 0], [1, 0], [1, 1], [0, 0]]
hole = [[0.2, 0.2], [0.4, 0.2], [0.2, 0.2]]
assert list(geometry_rings({"type": "Polygon", "coordinates": [exterior, hole]})) == [
exterior,
hole,
]
def test_geometry_rings_flattens_multipolygon_rings() -> None:
first = [[0, 0], [1, 0], [0, 0]]
second = [[2, 2], [3, 2], [2, 2]]
assert list(
geometry_rings({"type": "MultiPolygon", "coordinates": [[first], [second]]})
) == [first, second]
def test_geometry_rings_ignores_non_polygon_geometry() -> None:
assert list(geometry_rings({"type": "Point", "coordinates": [0, 0]})) == []