Skip to content

Commit e8d1906

Browse files
committed
Catch a few test warnings
1 parent 230a251 commit e8d1906

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1821,7 +1821,8 @@ def test_pyplot_axes():
18211821
# test focusing of Axes in other Figure
18221822
fig1, ax1 = plt.subplots()
18231823
fig2, ax2 = plt.subplots()
1824-
assert ax1 is plt.axes(ax1)
1824+
with pytest.warns(MatplotlibDeprecationWarning):
1825+
assert ax1 is plt.axes(ax1)
18251826
assert ax1 is plt.gca()
18261827
assert fig1 is plt.gcf()
18271828
plt.close(fig1)

lib/matplotlib/tests/test_dates.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
from matplotlib.testing.decorators import image_comparison
1111
import matplotlib.pyplot as plt
12+
from matplotlib.cbook import MatplotlibDeprecationWarning
1213
import matplotlib.dates as mdates
1314

1415

@@ -239,16 +240,18 @@ def test_strftime_fields(dt):
239240
minute=dt.minute,
240241
second=dt.second,
241242
microsecond=dt.microsecond))
242-
assert formatter.strftime(dt) == formatted_date_str
243+
with pytest.warns(MatplotlibDeprecationWarning):
244+
assert formatter.strftime(dt) == formatted_date_str
243245

244246
try:
245247
# Test strftime("%x") with the current locale.
246248
import locale # Might not exist on some platforms, such as Windows
247249
locale_formatter = mdates.DateFormatter("%x")
248250
locale_d_fmt = locale.nl_langinfo(locale.D_FMT)
249251
expanded_formatter = mdates.DateFormatter(locale_d_fmt)
250-
assert locale_formatter.strftime(dt) == \
251-
expanded_formatter.strftime(dt)
252+
with pytest.warns(MatplotlibDeprecationWarning):
253+
assert locale_formatter.strftime(dt) == \
254+
expanded_formatter.strftime(dt)
252255
except (ImportError, AttributeError):
253256
pass
254257

0 commit comments

Comments
 (0)