test(rasterize): close public-API coverage gaps (deep-sweep pass 1)#2022
Open
brendancol wants to merge 1 commit into
Open
test(rasterize): close public-API coverage gaps (deep-sweep pass 1)#2022brendancol wants to merge 1 commit into
brendancol wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes documented but untested public-API surface in
xrspatial.rasterizeflagged by the test-coverage sweep on 2026-05-17. Adds 34 tests inxrspatial/tests/test_rasterize_coverage_2026_05_17.py. Sweep is test-only; no source files modified.Coverage gaps closed:
test_rasterize.pycovers 1xN strips and Nx1 strips but never thewidth=1ANDheight=1case, so the polygon scanline, line Bresenham, and point-burn kernels ship without the single-cell degenerate case.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), andlike=on all four backends. Mutation againstrasterize.py:2183-2184flipped the inheritance test red.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, andresolution=on all four backends.GeometryCollectionunpacking is documented atrasterize.py:1995and 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.all_touched=Trueparity vs eager numpy. The existing parity test only covered dask+cupyall_touched, leaving the direct GPUall_touchedkernel untested.Test plan
test_rasterize.pyremain green.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.