Skip to content

Commit 8525240

Browse files
committed
better comments
1 parent 1df63cc commit 8525240

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

xarray/tests/test_testing.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -155,21 +155,21 @@ def __array__(self):
155155
a = WarningVariable("x", [1])
156156
b = WarningVariable("x", [2])
157157

158-
# elevate warnings to errors
159-
warnings.filterwarnings("error")
160-
161158
with warnings.catch_warnings(record=True) as w:
159+
warnings.filterwarnings("error")
160+
# elevate warnings to errors
162161
with pytest.raises(AssertionError):
163162
getattr(xr.testing, func)(a, b)
164163

165164
assert len(w) > 0
166165

167-
# ensure warnings still raise outside of assert_*
168-
with pytest.raises(UserWarning):
169-
warnings.warn("test")
166+
# ensure warnings still raise outside of assert_*
167+
with pytest.raises(UserWarning):
168+
warnings.warn("test")
170169

170+
# ensure warnings stay ignored in assert_*
171171
with warnings.catch_warnings(record=True) as w:
172-
# elevate warnings to errors
172+
# ignore warnings
173173
warnings.filterwarnings("ignore")
174174
with pytest.raises(AssertionError):
175175
getattr(xr.testing, func)(a, b)

0 commit comments

Comments
 (0)