File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed
lib/iris/tests/unit/fileformats/netcdf Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -122,12 +122,11 @@ def test_comment_bracket_mismatch_warning(self):
122122 "time : minimum within days (comment: 18h day-1)-18h)" ,
123123 ]
124124 for cell_method_str in cell_method_strings :
125- with mock .patch ("warnings.warn" ) as warn :
125+ with self .assertWarns (
126+ UserWarning ,
127+ msg = "Cell methods may be incorrectly parsed due to mismatched brackets" ,
128+ ):
126129 _ = parse_cell_methods (cell_method_str )
127- self .assertIn (
128- "Cell methods may be incorrectly parsed due to mismatched brackets" ,
129- warn .call_args [0 ][0 ],
130- )
131130
132131 def test_badly_formatted_warning (self ):
133132 cell_method_strings = [
@@ -139,12 +138,11 @@ def test_badly_formatted_warning(self):
139138 "time: (interval: 1 day comment: second bit)" ,
140139 ]
141140 for cell_method_str in cell_method_strings :
142- with mock .patch ("warnings.warn" ) as warn :
141+ with self .assertWarns (
142+ UserWarning ,
143+ msg = f"Failed to fully parse cell method string: { cell_method_str } " ,
144+ ):
143145 _ = parse_cell_methods (cell_method_str )
144- self .assertIn (
145- f"Failed to fully parse cell method string: { cell_method_str } " ,
146- warn .call_args [0 ][0 ],
147- )
148146
149147 def test_portions_of_cells (self ):
150148 cell_method_strings = [
You can’t perform that action at this time.
0 commit comments