Skip to content

test(rasterize): close public-API coverage gaps (deep-sweep pass 1)#2022

Open
brendancol wants to merge 1 commit into
mainfrom
deep-sweep-test-coverage-rasterize-2026-05-17
Open

test(rasterize): close public-API coverage gaps (deep-sweep pass 1)#2022
brendancol wants to merge 1 commit into
mainfrom
deep-sweep-test-coverage-rasterize-2026-05-17

Conversation

@brendancol
Copy link
Copy Markdown
Contributor

Summary

Closes documented but untested public-API surface in xrspatial.rasterize flagged by the test-coverage sweep on 2026-05-17. Adds 34 tests in xrspatial/tests/test_rasterize_coverage_2026_05_17.py. Sweep is test-only; no source files modified.

Coverage gaps closed:

  • Cat 3 HIGH -- 1x1 single-pixel raster across all four backends. test_rasterize.py covers 1xN strips and Nx1 strips but never the width=1 AND height=1 case, so the polygon scanline, line Bresenham, and point-burn kernels ship without the single-cell degenerate case.
  • Cat 4 HIGH -- like= template-raster parameter (rasterize.py:2038) is implemented by _extract_grid_from_like (line 1930) but no test exercises it. Pins dtype/bounds/coords inheritance, the three override branches (dtype, bounds, width/height), the three validation branches (not-DataArray, 3D, wrong dim names), and like= on all four backends. Mutation against rasterize.py:2183-2184 flipped the inheritance test red.
  • Cat 4 HIGH -- resolution= happy path. Only the oversize-rejection error path was tested (test_oversize_resolution_rejected); pins the scalar branch, the tuple branch, the ceil-and-clamp-to-1 semantics, and resolution= on all four backends.
  • Cat 4 HIGH -- non-empty GeometryCollection unpacking is documented at rasterize.py:1995 and implemented by _classify_geometries_loop (line 228) but only the empty-GC case was tested. Pins polygon+point and polygon+line+point collections plus parity across cupy / dask+numpy / dask+cupy.
  • Cat 1 MEDIUM -- eager cupy all_touched=True parity vs eager numpy. The existing parity test only covered dask+cupy all_touched, leaving the direct GPU all_touched kernel untested.
  • Cat 2 MEDIUM -- int32 dtype with default NaN fill silently casts to the int32-min sentinel. Pin the cast so any future raises-instead switch is visible as a code-review diff.

Test plan

  • All 34 new tests pass locally on a CUDA host (numpy + cupy + dask+numpy + dask+cupy).
  • Pre-existing 143 passing + 2 skipped tests in test_rasterize.py remain green.
  • Mutation against the like= dtype inheritance branch (elif like_dtype is not None: final_dtype = like_dtype) flips the inheritance test red, confirming the new coverage catches a real regression.
  • CI runs the cupy / dask+cupy branches on the GPU host (locally exercised but CI re-validates).

Add 34 tests in test_rasterize_coverage_2026_05_17.py closing documented
but untested surface flagged by the test-coverage sweep on 2026-05-17.

- Cat 3 HIGH: 1x1 single-pixel raster across all four backends.
  test_rasterize.py covers 1xN strips and Nx1 strips but never the
  width=1 AND height=1 case, so the polygon scanline, line Bresenham,
  and point-burn kernels ship without the single-cell degenerate case.
- Cat 4 HIGH: like= template-raster parameter (rasterize.py:2038) is
  implemented by _extract_grid_from_like (line 1930) but no test
  exercises it. Pins dtype/bounds/coords inheritance, the three
  override branches, the three validation branches, and like= on all
  four backends. Mutation against rasterize.py:2183-2184 flipped the
  inheritance test red.
- Cat 4 HIGH: resolution= happy path. Only the oversize-rejection
  error path was tested; pins the scalar branch, the tuple branch,
  the ceil-and-clamp-to-1 semantics, and resolution= on all four
  backends.
- Cat 4 HIGH: non-empty GeometryCollection unpacking is documented at
  rasterize.py:1995 and implemented by _classify_geometries_loop
  (line 228) but only the empty-GC case was tested. Pins polygon+point
  and polygon+line+point collections plus parity across cupy /
  dask+numpy / dask+cupy.
- Cat 1 MEDIUM: eager cupy all_touched=True parity vs eager numpy.
  The existing parity test only covered dask+cupy all_touched.
- Cat 2 MEDIUM: int32 dtype with default NaN fill silently casts to
  the int32-min sentinel. Pin the cast so any future raises-instead
  switch is visible as a code-review diff.

Sweep is test-only: no source files modified. Pre-existing 143 passing
plus 2 skipped tests in test_rasterize.py remain untouched.
@github-actions github-actions Bot added the performance PR touches performance-sensitive code label May 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance PR touches performance-sensitive code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant