Skip to content

Commit 6e79e35

Browse files
committed
TEST: Try using clear_and_catch_warnings
1 parent 6f4c2aa commit 6e79e35

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

nibabel/tests/test_nifti1.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,7 +1131,7 @@ def test_zooms_edge_cases(self):
11311131

11321132

11331133
# Unknown units = 2 warnings
1134-
with warnings.catch_warnings(record=True) as warns:
1134+
with clear_and_catch_warnings() as warns:
11351135
warnings.simplefilter('always')
11361136
assert_array_almost_equal(img.header.get_zooms(units='canonical'),
11371137
(1, 1, 1, 1))
@@ -1140,7 +1140,7 @@ def test_zooms_edge_cases(self):
11401140
units='canonical', raise_unknown=True)
11411141

11421142
img.header.set_xyzt_units(xyz='meter')
1143-
with warnings.catch_warnings(record=True) as warns:
1143+
with clear_and_catch_warnings() as warns:
11441144
warnings.simplefilter('always')
11451145
assert_array_almost_equal(img.header.get_zooms(units='canonical'),
11461146
(1000, 1000, 1000, 1))
@@ -1156,7 +1156,7 @@ def test_zooms_edge_cases(self):
11561156
(0.001, 0.001, 0.001, 1))
11571157

11581158
img.header.set_xyzt_units(t='sec')
1159-
with warnings.catch_warnings(record=True) as warns:
1159+
with clear_and_catch_warnings() as warns:
11601160
warnings.simplefilter('always')
11611161
assert_array_equal(img.header.get_zooms(units='canonical'),
11621162
(1, 1, 1, 1))

0 commit comments

Comments
 (0)