Skip to content

Commit 27234c3

Browse files
committed
TEST: Try using clear_and_catch_warnings
1 parent f31aba5 commit 27234c3

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

12091209

12101210
# Unknown units = 2 warnings
1211-
with warnings.catch_warnings(record=True) as warns:
1211+
with clear_and_catch_warnings() as warns:
12121212
warnings.simplefilter('always')
12131213
assert_array_almost_equal(img.header.get_zooms(units='canonical'),
12141214
(1, 1, 1, 1))
@@ -1217,7 +1217,7 @@ def test_zooms_edge_cases(self):
12171217
units='canonical', raise_unknown=True)
12181218

12191219
img.header.set_xyzt_units(xyz='meter')
1220-
with warnings.catch_warnings(record=True) as warns:
1220+
with clear_and_catch_warnings() as warns:
12211221
warnings.simplefilter('always')
12221222
assert_array_almost_equal(img.header.get_zooms(units='canonical'),
12231223
(1000, 1000, 1000, 1))
@@ -1233,7 +1233,7 @@ def test_zooms_edge_cases(self):
12331233
(0.001, 0.001, 0.001, 1))
12341234

12351235
img.header.set_xyzt_units(t='sec')
1236-
with warnings.catch_warnings(record=True) as warns:
1236+
with clear_and_catch_warnings() as warns:
12371237
warnings.simplefilter('always')
12381238
assert_array_equal(img.header.get_zooms(units='canonical'),
12391239
(1, 1, 1, 1))

0 commit comments

Comments
 (0)