Skip to content

Commit a536ed3

Browse files
committed
test for errors on non-3d inputs and arguments
A note to future developers is included that the `conform` function should be made more general.
1 parent 4ca32ba commit a536ed3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

nibabel/tests/test_processing.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,3 +443,13 @@ def test_conform():
443443
assert c.dataobj.dtype.type == anat.dataobj.dtype.type
444444
assert aff2axcodes(c.affine) == ('L', 'P', 'I')
445445
assert isinstance(c, Nifti2Image)
446+
447+
# TODO: support nD images in `conform` in the future, but for now, test that we get
448+
# errors on non-3D images.
449+
func = nib.load(pjoin(DATA_DIR, 'functional.nii'))
450+
with pytest.raises(ValueError):
451+
conform(func)
452+
with pytest.raises(ValueError):
453+
conform(anat, out_shape=(100, 100))
454+
with pytest.raises(ValueError):
455+
conform(anat, voxel_size=(2, 2))

0 commit comments

Comments
 (0)