Skip to content

Commit dabac24

Browse files
committed
TEST: Try using clear_and_catch_warnings
1 parent 6cec414 commit dabac24

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
@@ -1119,7 +1119,7 @@ def test_zooms_edge_cases(self):
11191119

11201120

11211121
# Unknown units = 2 warnings
1122-
with warnings.catch_warnings(record=True) as warns:
1122+
with clear_and_catch_warnings() as warns:
11231123
warnings.simplefilter('always')
11241124
assert_array_almost_equal(img.header.get_zooms(units='canonical'),
11251125
(1, 1, 1, 1))
@@ -1128,7 +1128,7 @@ def test_zooms_edge_cases(self):
11281128
units='canonical', raise_unknown=True)
11291129

11301130
img.header.set_xyzt_units(xyz='meter')
1131-
with warnings.catch_warnings(record=True) as warns:
1131+
with clear_and_catch_warnings() as warns:
11321132
warnings.simplefilter('always')
11331133
assert_array_almost_equal(img.header.get_zooms(units='canonical'),
11341134
(1000, 1000, 1000, 1))
@@ -1144,7 +1144,7 @@ def test_zooms_edge_cases(self):
11441144
(0.001, 0.001, 0.001, 1))
11451145

11461146
img.header.set_xyzt_units(t='sec')
1147-
with warnings.catch_warnings(record=True) as warns:
1147+
with clear_and_catch_warnings() as warns:
11481148
warnings.simplefilter('always')
11491149
assert_array_equal(img.header.get_zooms(units='canonical'),
11501150
(1, 1, 1, 1))

0 commit comments

Comments
 (0)