Skip to content

Commit 5ca34c7

Browse files
authored
Merge branch 'main' into feature/pynufft-removal-phase-3
2 parents 8c562a4 + 515216a commit 5ca34c7

1 file changed

Lines changed: 19 additions & 6 deletions

File tree

test_autocti/extract/two_d/serial/test_serial_eper.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import numpy as np
2+
import pytest
23

34
import autocti as ac
5+
from autocti import exc
46

57

68
def test__region_list_from__array_2d_list_from(serial_array, serial_masked_array):
@@ -61,12 +63,23 @@ def test__region_list_from__array_2d_list_from(serial_array, serial_masked_array
6163
assert (array_2d_list[0] == np.array([[5.0], [5.0], [5.0]])).all()
6264
assert (array_2d_list[1] == np.array([[9.0], [9.0], [9.0]])).all()
6365

64-
array_2d_list = extract.array_2d_list_from(
65-
array=serial_array, settings=ac.SettingsExtract(pixels=(2, 3))
66-
)
67-
68-
assert (array_2d_list[0] == np.array([[6.0], [6.0], [6.0]])).all()
69-
assert (array_2d_list[1] == np.array([[10.0], [10.0], [10.0]])).all()
66+
# `pixels=(2, 3)` asks for the third column of each trailing region. For the
67+
# second region (its trailing region starts at column 8) that is columns
68+
# 10-11 of a 10-column array: a window entirely past the edge, which extracts
69+
# to a zero-width (3, 0) structure. PyAutoArray rejects that outright, so the
70+
# whole call raises rather than returning an empty extraction.
71+
#
72+
# This case previously asserted `array_2d_list[1] == [[10.0], [10.0], [10.0]]`
73+
# and "passed" while checking nothing: comparing an empty array against
74+
# anything is vacuously True, and 10.0 is not a value this fixture even
75+
# contains. The behaviour is pinned here instead of left silent.
76+
#
77+
# A *partially* overlapping window still clips rather than raising — the
78+
# `pixels=(0, 3)` case below asserts exactly that for the same region.
79+
with pytest.raises(exc.MaskException):
80+
extract.array_2d_list_from(
81+
array=serial_array, settings=ac.SettingsExtract(pixels=(2, 3))
82+
)
7083

7184
array_2d_list = extract.array_2d_list_from(
7285
array=serial_array, settings=ac.SettingsExtract(pixels=(0, 3))

0 commit comments

Comments
 (0)