Skip to content

Commit c940dea

Browse files
committed
TEST: Validate expected ndim behavior
1 parent 7e03807 commit c940dea

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

nibabel/tests/test_image_api.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ def validate_data_interface(self, imaker, params):
202202
# Check get data returns array, and caches
203203
img = imaker()
204204
assert_equal(img.shape, img.dataobj.shape)
205+
assert_equal(len(img.shape), img.dataobj.ndim)
205206
assert_data_similar(img.dataobj, params)
206207
for meth_name in self.meth_names:
207208
if params['is_proxy']:

nibabel/tests/test_proxy_api.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,14 @@ def validate_shape(self, pmaker, params):
108108
# Read only
109109
assert_raises(AttributeError, setattr, prox, 'shape', params['shape'])
110110

111+
def validate_ndim(self, pmaker, params):
112+
# Check shape
113+
prox, fio, hdr = pmaker()
114+
assert_equal(prox.ndim, len(params['shape']))
115+
# Read only
116+
assert_raises(AttributeError, setattr, prox,
117+
'ndim', len(params['shape']))
118+
111119
def validate_is_proxy(self, pmaker, params):
112120
# Check shape
113121
prox, fio, hdr = pmaker()

0 commit comments

Comments
 (0)