@@ -1119,7 +1119,7 @@ def test_zooms_edge_cases(self):
1119
1119
1120
1120
1121
1121
# Unknown units = 2 warnings
1122
- with warnings . catch_warnings ( record = True ) as warns :
1122
+ with clear_and_catch_warnings ( ) as warns :
1123
1123
warnings .simplefilter ('always' )
1124
1124
assert_array_almost_equal (img .header .get_zooms (units = 'canonical' ),
1125
1125
(1 , 1 , 1 , 1 ))
@@ -1128,7 +1128,7 @@ def test_zooms_edge_cases(self):
1128
1128
units = 'canonical' , raise_unknown = True )
1129
1129
1130
1130
img .header .set_xyzt_units (xyz = 'meter' )
1131
- with warnings . catch_warnings ( record = True ) as warns :
1131
+ with clear_and_catch_warnings ( ) as warns :
1132
1132
warnings .simplefilter ('always' )
1133
1133
assert_array_almost_equal (img .header .get_zooms (units = 'canonical' ),
1134
1134
(1000 , 1000 , 1000 , 1 ))
@@ -1144,7 +1144,7 @@ def test_zooms_edge_cases(self):
1144
1144
(0.001 , 0.001 , 0.001 , 1 ))
1145
1145
1146
1146
img .header .set_xyzt_units (t = 'sec' )
1147
- with warnings . catch_warnings ( record = True ) as warns :
1147
+ with clear_and_catch_warnings ( ) as warns :
1148
1148
warnings .simplefilter ('always' )
1149
1149
assert_array_equal (img .header .get_zooms (units = 'canonical' ),
1150
1150
(1 , 1 , 1 , 1 ))
0 commit comments