geotiff tests: consolidate input-validation cluster#2461
Merged
Conversation
Fold nine top-level input-validation test files into a new xrspatial/geotiff/tests/unit/test_input_validation.py, organised by validation axis: band type/bool, size params, source dimensions, 3D writer dims, window bounds, and degenerate pixel size. Update the reader.windowed release-gate row to cite the new file so the checklist-parity gate stays green.
brendancol
commented
May 26, 2026
Contributor
Author
brendancol
left a comment
There was a problem hiding this comment.
PR Review: geotiff tests: consolidate input-validation cluster
Tests-only consolidation. Nine top-level input-validation files fold into unit/test_input_validation.py, grouped into 22 classes across six validation axes. No xrspatial/geotiff source changes. I read all nine originals and the new file, ran the suite, and checked parity.
Blockers (must fix before merge)
None.
Suggestions (should fix, not blocking)
None.
Nits (optional improvements)
- A couple of
TestBandTypeRejectioncases are really bool-rejection or positive-path checks (test_read_to_array_band_bool_still_rejected,test_read_to_array_band_zero_still_works), not type-rejection. This follows how the originals were split (the type file owned the positive still-works cases), so it is defensible. A reader skimming by class name might expect those elsewhere. Not worth the churn to move them.
What looks good
- The 145-vs-146 count delta is intentional and documented:
test_read_to_array_band_one_still_worksis the same test astest_read_to_array_band_int_still_works(both read band 1), so one drops. Called out in the PR body and the audit file. - The behavior-bearing helpers carry over unchanged: the IFD byte builders (
_build_classic_tiff,_short_bytes,_long_bytes), the tag-patch helpers (_find_ifd_entry_offset,_patch_inline_long), the_StaticBytesHTTPSourcestub, and theMAX_PIXEL_ARRAY_COUNTmonkeypatch with its try/finally restore. - The per-file
_gpu_onlymarkers are replaced with the sharedrequires_gpufrom_helpers/markers.py, samecupy.cuda.is_available()semantics. - The release-gate checklist row that cited the deleted
test_window_out_of_bounds_1634.pynow points at the consolidated file, so the checklist-parity gate stays green. Easy to miss. - isort and flake8 both pass (lines under 100).
Checklist
- N/A algorithm vs reference (tests-only)
- All four read backends still covered (numpy eager, dask, gpu-gated, vrt)
- NaN handling unchanged (no logic touched)
- Edge cases preserved (zero/negative dims, out-of-bounds windows, degenerate 1xN/Nx1)
- N/A dask chunk boundaries
- N/A premature materialization
- N/A benchmark
- N/A README feature matrix (no new public API)
- Docstrings: module-level and per-class present
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.
Closes #2430. Cluster 6 of the long-tail GeoTIFF test consolidation epic (#2424).
Summary
Fold nine top-level files into a new
xrspatial/geotiff/tests/unit/test_input_validation.py:test_degenerate_pixel_size_2214.pytest_geotiff_band_bool_rejection_1786.pytest_geotiff_band_type_rejection_1910.pytest_pixel_array_count_cap_1901.pytest_size_param_validation_1752.pytest_strip_zero_dims_2053.pytest_tile_size_multiple_of_16_1767.pytest_validate_3d_non_band_trailing_dim_2240.pytest_window_out_of_bounds_1634.pyThe new file is organised by validation axis:
bandmust be a non-negative int;bool/np.bool_raiseValueError,float/strraiseTypeError, acrossread_to_array,open_geotiff,read_geotiff_dask,read_geotiff_gpu, andread_vrt.tile_sizeandread_geotiff_daskchunksmust be positive, andtile_sizemust be a multiple of 16 whentiled=True.ImageWidth/ImageLength/SamplesPerPixelrejected on stripped and tiled read paths, local and HTTP, plus pixel-array count caps against IFD geometry.(y, x, <non-band>)DataArray inputs rejected rather than silently written band-last.windowraises a clearValueErroron the eager and dask paths.One intentional dedup: the bool file's
test_read_to_array_band_one_still_worksis the same test as the type file'stest_read_to_array_band_int_still_works(both read band 1), so only one survives. That accounts for 145 collected here vs 146 across the nine originals.The
reader.windowedrelease-gate row indocs/source/reference/release_gate_geotiff.rstcitedtest_window_out_of_bounds_1634.py; it now cites the consolidated file so the checklist-parity gate stays green.Audit
xrspatial/geotiff/tests/CLUSTER_AUDIT_INPUT_VALIDATION.mdmaps every oldfile::testto its newfile::test_id. The audit file is deleted on a final commit on this branch before merge.Verification
pytest xrspatial/geotiff/tests/unit/test_input_validation.py -v: 145 passed.pytest xrspatial/geotiff/tests/ -q: 5814 passed, 68 skipped, 2 xfailed.find xrspatial/geotiff/tests -name 'test_*.py' | wc -l: 236 (was 244; -9 deleted +1 added = -8).Test plan
unit/test_input_validation.pypasses on this checkout.xrspatial/geotiff/tests/suite passes.