Skip to content

Commit 8302c24

Browse files
committed
pytest.warns needs a warning
1 parent b42a2e6 commit 8302c24

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

xarray/tests/test_coding_times.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def test_decode_non_standard_calendar_single_element_fallback(self):
166166
dt = nc4.netcdftime.datetime(2001, 2, 29)
167167
for calendar in ['360_day', 'all_leap', '366_day']:
168168
num_time = nc4.date2num(dt, units, calendar)
169-
with pytest.warns('Unable to decode time axis'):
169+
with pytest.warns(Warning, 'Unable to decode time axis'):
170170
actual = coding.times.decode_cf_datetime(num_time, units,
171171
calendar=calendar)
172172
expected = np.asarray(nc4.num2date(num_time, units, calendar))

xarray/tests/test_conventions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ def test_incompatible_attributes(self):
197197
def test_missing_fillvalue(self):
198198
v = Variable(['x'], np.array([np.nan, 1, 2, 3]))
199199
v.encoding = {'dtype': 'int16'}
200-
with pytest.warns('floating point data as an integer'):
200+
with pytest.warns(Warning, 'floating point data as an integer'):
201201
conventions.encode_cf_variable(v)
202202

203203
def test_multidimensional_coordinates(self):

xarray/tests/test_extensions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def foo(self):
5353
del xr.Dataset.demo
5454
assert not hasattr(xr.Dataset, 'demo')
5555

56-
with pytest.warns('overriding a preexisting attribute'):
56+
with pytest.warns(Warning, 'overriding a preexisting attribute'):
5757
@xr.register_dataarray_accessor('demo')
5858
class Foo(object):
5959
pass

xarray/tests/test_utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def new_method():
1818
pass
1919
old_method = utils.alias(new_method, 'old_method')
2020
assert 'deprecated' in old_method.__doc__
21-
with pytest.warns('deprecated'):
21+
with pytest.warns(Warning, 'deprecated'):
2222
old_method()
2323

2424

0 commit comments

Comments
 (0)