Skip to content

Commit 8ad9c32

Browse files
committed
TEST: Catch warning, test -1 reshaping
1 parent fbac7e4 commit 8ad9c32

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

nibabel/tests/test_arrayproxy.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ def test_tuplespec():
105105
assert_array_equal(getattr(ap_header, method)(*args),
106106
getattr(ap_tuple, method)(*args))
107107
# Tuple-defined ArrayProxies have no header to store
108-
assert_true(ap_tuple.header is None)
108+
with warnings.catch_warnings():
109+
assert_true(ap_tuple.header is None)
109110

110111

111112
def write_raw_data(arr, hdr, fileobj):
@@ -216,6 +217,10 @@ def test_reshaped_is_proxy():
216217
bio = BytesIO()
217218
prox = ArrayProxy(bio, hdr)
218219
assert_true(isinstance(prox.reshape((2, 3, 4)), ArrayProxy))
220+
minus1 = prox.reshape((2, -1, 4))
221+
assert_true(isinstance(minus1, ArrayProxy))
222+
assert_equal(minus1.shape, (2, 3, 4))
223+
assert_raises(ValueError, prox.reshape, (-1, -1, 4))
219224

220225

221226
def test_get_unscaled():

0 commit comments

Comments
 (0)