Commit afa8730
authored
polygonize: close test-coverage gaps for backends, edge cases, params (#2156)
* polygonize: close test-coverage gaps for backends, edge cases, params
Deep-sweep test-coverage pass 1 (2026-05-19): adds
test_polygonize_coverage_2026_05_19.py with 58 tests, all passing on
a CUDA host.
Closes the following audit-flagged gaps:
Cat 1 (backend coverage)
- simplify_tolerance + mask= parity on the dask+cupy backend
(numpy / cupy / dask were already covered).
Cat 2 (NaN / Inf / nodata)
- NaN parity for cupy and dask+cupy.
- all-NaN raster on every backend.
- +/-Inf pins on every backend. numpy / dask / dask+cupy currently
silently absorb Inf cells into adjacent finite polygons (issue
#2155); cupy emits them correctly. Pins lock the asymmetric
behaviour so the fix is visible.
Cat 3 (geometric)
- 1x1 single-pixel raster on all four backends + geopandas.
- Nx1 single-column raster exercises the nx==1 padding path
(polygonize.py:565) and the cupy nx==1 numpy-fallback
(polygonize.py:671).
- 1xN single-row and all-equal-value rasters on all four backends.
Cat 4 (parameter coverage)
- column_name non-default value across geopandas / spatialpandas /
geojson return types.
- Validation error paths: bad connectivity, bad transform length,
mask shape mismatch, mask underlying-type mismatch.
Cat 5 N/A: polygonize returns lists / dataframes, not a DataArray
with attrs to propagate.
* polygonize tests: tighten Inf pins and parity assertions (self-fix)
Self-review of #2156 surfaced four loose assertions that would let
regressions slip past:
- test_dask_cupy_inf_emits_polygons used an if/else with identical
inner assertions, so it never failed regardless of behaviour. The
dask+cupy backend actually undercounts today (consistent with the
numpy/dask bug, since _polygonize_chunk routes through the numpy
backend per chunk). Rename to *_currently_undercounts and pin
that explicitly so the #2155 source fix is visible as a diff.
- test_dask_inf_currently_undercounts only asserted the absence of
Inf polygons. Mirror the numpy sibling's area + value=1.0
conservation checks so a regression that loses a finite polygon
is also caught.
- TestSimplifyDaskCupy.test_dask_cupy_matches_numpy_areas iterated
over a_np keys without asserting set equality, so an extra
dask+cupy polygon class would have been silently ignored.
- test_column_name_geopandas_non_default asserted DataFrame row
order, which is implementation-defined. Sort before comparing.1 parent ae3794c commit afa8730
2 files changed
Lines changed: 611 additions & 0 deletions
0 commit comments