Skip to content

Commit 4720932

Browse files
committed
TEST: Test order kwarg to ArrayProxy classes
1 parent 0155598 commit 4720932

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Diff for: nibabel/tests/test_arrayproxy.py

+13
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,19 @@ 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+
prox = klass(fobj, (shape, arr.dtype), order=order)
201+
assert prox.order == order
202+
sliceobj = (None, slice(None), 1, -1)
203+
assert_array_equal(arr[sliceobj], prox[sliceobj])
204+
205+
193206
def test_is_proxy():
194207
# Test is_proxy function
195208
hdr = FunkyHeader((2, 3, 4))

0 commit comments

Comments
 (0)