fix(test): replace a vacuous serial-EPER assertion that now fails on main - #108
Merged
Merged
Conversation
…main
`test__region_list_from__array_2d_list_from` fails on main across all three
legs:
autoarray.exc.MaskException: shape_native[1] must be a positive number of
pixels; got 0. The full shape_native input was (3, 0)
lib-tests.yml clones PyAutoArray main, and PyAutoArray#440 (f2f7a4f,
2026-08-09) added the zero-length shape_native guard to Mask2D.__init__. This
repo's last main run was 2026-08-07, so the break sat dormant until the next
push.
The guard did not break a working test — it exposed one that never checked
anything. `serial_array` is 3x10 (columns 0-9). For region (0, 3, 5, 8),
`pixels=(2, 3)` resolves to columns 10-11: a window entirely past the edge,
extracting to a zero-width (3, 0) structure. The assertion it fed was
assert (array_2d_list[1] == np.array([[10.0], [10.0], [10.0]])).all()
and an empty-array comparison is vacuously True for ANY expected value
(confirmed: `(np.zeros((3,0)) == [[10.],[10.],[10.]]).all()` is True, and so is
the same comparison against 999.0). 10.0 is not even a value the fixture
contains.
The case now asserts what actually happens — a fully out-of-range window
raises — so the edge case stays covered instead of silently passing. A
partially overlapping window still clips, which the `pixels=(0, 3)` case
immediately below already asserts.
Test-only: no library behaviour is changed, and nothing here decides whether a
fully out-of-range window SHOULD raise or should clip to empty. That question
is left open deliberately.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q7kFdoYcD6wnTifNXV5T98
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.
mainis red on all three legs (3.12, 3.13,unittest-nojax), 1 failed / 270 passed:Found while opening the unrelated docs PR #107, whose diff is documentation only — the failure is
main's.Why it started
lib-tests.ymlclones PyAutoArraymainat run time, so this suite tracks autoarray source rather than a released wheel. PyAutoArray#440 (f2f7a4f, 2026-08-09 — the #333/B8 input-validation guards) added the zero-lengthshape_nativeguard toMask2D.__init__. This repo's lastmainrun was 2026-08-07, so the break has been dormant: nothing had pushed here since. It blocks every PR until fixed.The guard didn't break a working test — it exposed one that checked nothing
serial_arrayis 3×10 (columns 0–9, values 0–9). For the second region(0, 3, 5, 8), whose trailing region starts at column 8,pixels=(2, 3)resolves to columns 10–11 — a window entirely past the right edge. The extraction was therefore(3, 0), and the assertion it fed was:An empty-array comparison is vacuously
Truefor any expected value. Confirmed rather than asserted:10.0is not even a value the fixture contains — that is the tell.What this changes
The case now asserts what actually happens — a fully out-of-range window raises — so the edge case stays covered instead of silently passing. A partially overlapping window still clips rather than raising, which the
pixels=(0, 3)case immediately below already asserts (columns 8–10 clip to 8–9).Test-only. No library behaviour changes here, and this deliberately does not decide whether a fully out-of-range window should raise or should clip to an empty extraction. It pins today's behaviour so
mainis green and the question stays visible rather than hidden behind an assertion that passed either way. If the answer is "it should clip", the fix belongs inserial_trailing_region_from/array_2d_list_fromand this test should change with it.Nothing else in
test_autocti/extract/shows the same pattern — the other expected values above the fixture range (test_master.py,test_parallel_eper.py,test_parallel_pedestal.py) all belong to local fixtures that genuinely contain them, and only this one test fails.Verification is CI-side: this session has no PyAuto stack installed (autocti's suite needs arcticpy built against libgsl), so the three
unittestlegs on this PR are the check that matters.Tracked in PyAutoMind as
draft/bug/autocti/serial_eper_zero_width_region_vs_autoarray_guard.md.Generated by Claude Code