Skip to content

Update VRT window-clamp tests to match the reject contract from #1698#1731

Merged
brendancol merged 1 commit into
mainfrom
fix-vrt-window-test-clamp
May 12, 2026
Merged

Update VRT window-clamp tests to match the reject contract from #1698#1731
brendancol merged 1 commit into
mainfrom
fix-vrt-window-test-clamp

Conversation

@brendancol
Copy link
Copy Markdown
Contributor

Summary

Two tests added by #1692 still assert the pre-#1697 clamping contract for read_vrt(..., window=):

  • test_window_clamps_to_raster_bounds — expected window=(0, 0, 100, 100) on a 4x4 VRT to return a 4x4 array.
  • test_window_clamps_negative_offsets — expected window=(-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 ValueError instead 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

  • All 8 tests in TestReadVrtWindowEager pass locally.
  • CI on Linux/macOS/Windows goes green.

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.
@github-actions github-actions Bot added the performance PR touches performance-sensitive code label May 12, 2026
@brendancol brendancol requested a review from Copilot May 12, 2026 19:18
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 assert ValueError for 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.

@brendancol brendancol merged commit 0699aae into main May 12, 2026
15 of 16 checks passed
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.

2 participants