@@ -349,8 +349,9 @@ def test_qform_sform(self):
349
349
assert_array_equal (hdr .get_sform (), empty_sform )
350
350
assert_equal (hdr .get_qform (coded = True ), (None , 0 ))
351
351
assert_equal (hdr .get_sform (coded = True ), (None , 0 ))
352
- # Affine with no shears
352
+ # Affines with no shears
353
353
nice_aff = np .diag ([2 , 3 , 4 , 1 ])
354
+ another_aff = np .diag ([3 , 4 , 5 , 1 ])
354
355
# Affine with shears
355
356
nasty_aff = from_matvec (np .arange (9 ).reshape ((3 , 3 )), [9 , 10 , 11 ])
356
357
fixed_aff = unshear_44 (nasty_aff )
@@ -361,10 +362,11 @@ def test_qform_sform(self):
361
362
assert_array_equal (aff , nice_aff )
362
363
assert_equal (code , 2 )
363
364
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
368
370
# Default qform code when previous == 0 is 2
369
371
in_meth (nice_aff )
370
372
aff , code = out_meth (coded = True )
0 commit comments