|
9 | 9 | """Testing processing module""" |
10 | 10 |
|
11 | 11 | import logging |
| 12 | +import warnings |
12 | 13 | from os.path import dirname |
13 | 14 | from os.path import join as pjoin |
14 | 15 |
|
@@ -169,7 +170,8 @@ def test_resample_from_to(caplog): |
169 | 170 | exp_out[1:, :, :] = data[1, :, :] |
170 | 171 | assert_almost_equal(out.dataobj, exp_out) |
171 | 172 | out = resample_from_to(img, trans_p_25_img) |
172 | | - with pytest.warns(UserWarning): # Suppress scipy warning |
| 173 | + with warnings.catch_warnings(): |
| 174 | + warnings.simplefilter('ignore', UserWarning) |
173 | 175 | exp_out = spnd.affine_transform(data, [1, 1, 1], [-0.25, 0, 0], order=3) |
174 | 176 | assert_almost_equal(out.dataobj, exp_out) |
175 | 177 | # Test cval |
@@ -275,7 +277,8 @@ def test_resample_to_output(caplog): |
275 | 277 | assert_array_equal(out_img.dataobj, np.flipud(data)) |
276 | 278 | # Subsample voxels |
277 | 279 | out_img = resample_to_output(Nifti1Image(data, np.diag([4, 5, 6, 1]))) |
278 | | - with pytest.warns(UserWarning): # Suppress scipy warning |
| 280 | + with warnings.catch_warnings(): |
| 281 | + warnings.simplefilter('ignore', UserWarning) |
279 | 282 | exp_out = spnd.affine_transform(data, [1 / 4, 1 / 5, 1 / 6], output_shape=(5, 11, 19)) |
280 | 283 | assert_array_equal(out_img.dataobj, exp_out) |
281 | 284 | # Unsubsample with voxel sizes |
|
0 commit comments