Update VRT window-clamp tests to match the reject contract from #1698#1731
Merged
Conversation
PRs #1692 and #1698 raced through main with conflicting expectations for out-of-bounds window=. #1692's tests were written against the pre-#1697 contract that silently clamped windows to the VRT extent (returning a smaller array). #1698 replaced that contract with the validator-rejects-up-front behaviour from #1634 / #1669 so all three backends (local, HTTP, VRT) raise ValueError on out-of-bounds windows. Update both clamp-assertion tests to use pytest.raises(ValueError) and rename them to reflect the new contract. The "negative offsets clamp to 0" path is also gone -- negative offsets now raise.
Contributor
There was a problem hiding this comment.
Pull request overview
Updates GeoTIFF VRT windowing tests to align with the post-#1698 contract where out-of-bounds read_vrt(..., window=...) inputs are rejected (raise ValueError) rather than silently clamped. This keeps the test suite consistent with the shared window validator behavior across VRT/local/HTTP read paths.
Changes:
- Rewrite two
read_vrt(window=...)tests to assertValueErrorfor out-of-bounds windows (instead of expecting clamped reads). - Rename the two tests to reflect the new “rejected” behavior and update docstrings accordingly.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3 tasks
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
Two tests added by #1692 still assert the pre-#1697 clamping contract for
read_vrt(..., window=):test_window_clamps_to_raster_bounds— expectedwindow=(0, 0, 100, 100)on a 4x4 VRT to return a 4x4 array.test_window_clamps_negative_offsets— expectedwindow=(-1, -2, 3, 4)to clamp to(0, 0, 3, 4).#1698 replaced that contract with the same up-front validator already used by the local-eager path (#1634) and HTTP path (#1669). Out-of-bounds windows now raise
ValueErrorinstead of silently clamping. Both PRs landed on main; #1698 broke the tests added by #1692.This rewrites the two tests to assert the new contract (
pytest.raises(ValueError, match="outside the VRT extent")) and renames them to reflect the rejection behavior. No production-code change.Test plan
TestReadVrtWindowEagerpass locally.