Skip to content

fix(test): replace a vacuous serial-EPER assertion that now fails on main - #108

Merged
Jammy2211 merged 1 commit into
mainfrom
fix/serial-eper-out-of-range-pixels-window
Aug 24, 2026
Merged

fix(test): replace a vacuous serial-EPER assertion that now fails on main#108
Jammy2211 merged 1 commit into
mainfrom
fix/serial-eper-out-of-range-pixels-window

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

main is red on all three legs (3.12, 3.13, unittest-nojax), 1 failed / 270 passed:

FAILED test_autocti/extract/two_d/serial/test_serial_eper.py::test__region_list_from__array_2d_list_from
  autoarray.exc.MaskException: shape_native[1] must be a positive number of pixels;
  got 0. The full shape_native input was (3, 0)

Found while opening the unrelated docs PR #107, whose diff is documentation only — the failure is main's.

Why it started

lib-tests.yml clones PyAutoArray main at 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-length shape_native guard to Mask2D.__init__. This repo's last main run 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_array is 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:

assert (array_2d_list[1] == np.array([[10.0], [10.0], [10.0]])).all()

An empty-array comparison is vacuously True for any expected value. Confirmed rather than asserted:

>>> empty = np.zeros((3, 0))
>>> (empty == np.array([[10.0], [10.0], [10.0]])).all()
np.True_
>>> (empty == np.array([[999.0], [999.0], [999.0]])).all()
np.True_

10.0 is 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 main is 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 in serial_trailing_region_from / array_2d_list_from and 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 unittest legs 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

…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
@Jammy2211
Jammy2211 merged commit 515216a into main Aug 24, 2026
3 checks passed
@Jammy2211
Jammy2211 deleted the fix/serial-eper-out-of-range-pixels-window branch August 25, 2026 18:19
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.

1 participant