Skip to content

Commit 8f15523

Browse files
committed
TEST: Clarify test_qform_sform test
1 parent 1a51085 commit 8f15523

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

nibabel/tests/test_nifti1.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,9 @@ def test_qform_sform(self):
349349
assert_array_equal(hdr.get_sform(), empty_sform)
350350
assert_equal(hdr.get_qform(coded=True), (None, 0))
351351
assert_equal(hdr.get_sform(coded=True), (None, 0))
352-
# Affine with no shears
352+
# Affines with no shears
353353
nice_aff = np.diag([2, 3, 4, 1])
354+
another_aff = np.diag([3, 4, 5, 1])
354355
# Affine with shears
355356
nasty_aff = from_matvec(np.arange(9).reshape((3, 3)), [9, 10, 11])
356357
fixed_aff = unshear_44(nasty_aff)
@@ -361,10 +362,11 @@ def test_qform_sform(self):
361362
assert_array_equal(aff, nice_aff)
362363
assert_equal(code, 2)
363364
assert_array_equal(out_meth(), nice_aff) # non coded
364-
# Affine can also be passed if code == 0, affine will be suitably set
365-
in_meth(nice_aff, 0)
366-
assert_equal(out_meth(coded=True), (None, 0))
367-
assert_array_almost_equal(out_meth(), nice_aff)
365+
# Affine may be passed if code == 0, and will get set into header,
366+
# but the returned affine with 'coded=True' will be None.
367+
in_meth(another_aff, 0)
368+
assert_equal(out_meth(coded=True), (None, 0)) # coded -> None
369+
assert_array_almost_equal(out_meth(), another_aff) # else -> input
368370
# Default qform code when previous == 0 is 2
369371
in_meth(nice_aff)
370372
aff, code = out_meth(coded=True)

0 commit comments

Comments
 (0)