Skip to content

Add rasterize() validation-guard test coverage (#3383)#3385

Merged
brendancol merged 2 commits into
mainfrom
deep-sweep-test-coverage-rasterize-2026-06-18-01
Jun 18, 2026
Merged

Add rasterize() validation-guard test coverage (#3383)#3385
brendancol merged 2 commits into
mainfrom
deep-sweep-test-coverage-rasterize-2026-06-18-01

Conversation

@brendancol

Copy link
Copy Markdown
Contributor

Closes #3383.

Adds error-path tests for the rasterize() input-validation guards that had no coverage. The guards all run on the CPU path before backend dispatch, so the tests need no GPU.

Test-only. No source change.

Backend coverage: the guards are backend-independent (they fire before dispatch), so the tests exercise the shared CPU validation path. No new cupy / dask tests are needed.

Test plan:

  • 18 new tests pass locally on a CUDA host
  • full test_rasterize.py module passes (233 passed, 2 skipped)

Cover the input-validation guards in rasterize() that had no error-path
tests: non-representable integer/bool fill, burn values above the float64
safe-integer range, non-finite burn values into integer/bool dtypes (with
the merge='count' exemption), and non-finite geometry coordinates dropped
with a warning. Test-only; all guards run on the CPU path pre-dispatch.

Also record the pass in the sweep-test-coverage state CSV.

@brendancol brendancol left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Review: Add rasterize() validation-guard test coverage (#3385)

Test-only PR. It adds four test classes to test_rasterize.py covering input-validation guards in rasterize() that had no error-path tests. No source changes. I read the new tests and the four guards they exercise (rasterize.py lines 4378-4487 and 230-265).

Blockers (must fix before merge)

None.

Suggestions (should fix, not blocking)

None.

Nits (optional improvements)

  • test_nonfinite_geometry_in_gdf_dropped_with_warning also triggers a shapely RuntimeWarning ("invalid value encountered in bounds") next to the expected UserWarning. pytest.warns matches on at least one warning so the test passes, but the stray warning lands in the pytest warnings summary. Could wrap the GeoDataFrame construction in warnings.simplefilter to keep the summary clean. Not worth blocking on.

What looks good

  • Each guard is paired with a negative case (valid integer/bool/float fill, the 2**53-1 boundary, the merge='count' exemption, float-dtype burn), so the tests confirm the guards are narrow rather than just that they reject.
  • The match= regexes line up with the real error substrings in the source.
  • The non-finite burn test parametrizes nan / +inf / -inf instead of testing one.
  • The PR is right that the guards run on the CPU path before backend dispatch, so no GPU or cross-backend parity test is needed. All three validation blocks run before the chunks / gpu branch in rasterize().

Checklist

  • NaN handling: tests assert both the reject paths and the float-dtype accept paths.
  • Edge cases: this PR is the edge-case coverage.
  • Docstrings: each test class has a docstring citing the guarded issue.
  • Backend parity / dask / benchmark / README matrix: not applicable (test-only, guards are pre-dispatch).

@brendancol brendancol left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up review (#3385)

Addressed the single nit from the first pass. test_nonfinite_geometry_in_gdf_dropped_with_warning now carries a @pytest.mark.filterwarnings for the incidental shapely "invalid value encountered in bounds" RuntimeWarning, so it no longer shows up in the pytest warnings summary. The expected UserWarning assertion is unchanged.

Re-ran the module: 233 passed, 2 skipped (the 2 remaining warnings are the pre-existing GPU custom-merge UserWarnings, not from this PR).

No outstanding findings. Disposition: 1 nit fixed, 0 dismissed, 0 deferred.

@brendancol brendancol merged commit 98f6df1 into main Jun 18, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rasterize(): dtype/fill/burn-value validation guards and non-finite geometry drop have no tests

1 participant