Skip to content

Commit 08a20a4

Browse files
committed
TST: Verify pixdim check for non-negative values
1 parent b5b59fa commit 08a20a4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

nibabel/tests/test_nifti1.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,10 @@ def test_qform(self):
448448
assert_true, ehdr['qform_code'] == xfas['scanner']
449449
ehdr.set_qform(A, xfas['aligned'])
450450
assert_true, ehdr['qform_code'] == xfas['aligned']
451+
# Test pixdims[1,2,3] are checked for negatives
452+
for dims in ((-1, 1, 1), (1, -1, 1), (1, 1, -1)):
453+
ehdr['pixdim'][1:4] = dims
454+
assert_raises(HeaderDataError, ehdr.get_qform)
451455

452456
def test_sform(self):
453457
# Test roundtrip case

0 commit comments

Comments
 (0)