Skip to content

Commit 6da2600

Browse files
committed
TEST: Test order kwarg to ArrayProxy classes
1 parent 1cbf446 commit 6da2600

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

nibabel/tests/test_arrayproxy.py

+14
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,20 @@ def test_proxy_slicing_with_scaling():
190190
assert_array_equal(arr[sliceobj] * 2.0 + 1.0, prox[sliceobj])
191191

192192

193+
@pytest.mark.parametrize("order", ("C", "F"))
194+
def test_order_override(order):
195+
shape = (15, 16, 17)
196+
arr = np.arange(np.prod(shape)).reshape(shape)
197+
fobj = BytesIO()
198+
fobj.write(arr.tobytes(order=order))
199+
for klass in (ArrayProxy, CArrayProxy):
200+
fobj.seek(0)
201+
prox = klass(fobj, (shape, arr.dtype), order=order)
202+
assert prox.order == order
203+
sliceobj = (None, slice(None), 1, -1)
204+
assert_array_equal(arr[sliceobj], prox[sliceobj])
205+
206+
193207
def test_is_proxy():
194208
# Test is_proxy function
195209
hdr = FunkyHeader((2, 3, 4))

0 commit comments

Comments
 (0)