Skip to content

Commit

Permalink
TEST: Fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Dec 21, 2017
1 parent bddf15c commit dcc71f1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion nibabel/tests/test_nifti1.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ def test_freesurfer_ico7_hack(self):
nii2 = load('test.nii')
assert_equal(nii.shape, nii2.shape)
assert_array_equal(nii.get_data(), nii2.get_data())
assert_array_equal(nii.get_affine(), nii2.get_affine())
assert_array_equal(nii.affine, nii2.affine)

def test_qform_sform(self):
HC = self.header_class
Expand Down Expand Up @@ -1036,15 +1036,18 @@ def test_norm_zooms_edge_cases(self):
aff = np.eye(4)
img = img_klass(arr, aff)


# Unknown units = 2 warnings
with warnings.catch_warnings(record=True) as warns:
warnings.simplefilter('always')
assert_array_almost_equal(img.header.get_norm_zooms(),
(1, 1, 1, 1))
assert_equal(len(warns), 2)
assert_raises(ValueError, img.header.get_norm_zooms, True)

img.header.set_xyzt_units(xyz='meter')
with warnings.catch_warnings(record=True) as warns:
warnings.simplefilter('always')
assert_array_almost_equal(img.header.get_norm_zooms(),
(1000, 1000, 1000, 1))
assert_equal(len(warns), 1)
Expand All @@ -1059,6 +1062,7 @@ def test_norm_zooms_edge_cases(self):

img.header.set_xyzt_units(t='sec')
with warnings.catch_warnings(record=True) as warns:
warnings.simplefilter('always')
assert_array_equal(img.header.get_norm_zooms(), (1, 1, 1, 1))
assert_equal(len(warns), 1)
assert_raises(ValueError, img.header.get_norm_zooms, True)
Expand Down

0 comments on commit dcc71f1

Please sign in to comment.