8000 Catch a couple of test warnings by dstansby · Pull Request #11352 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Catch a couple of test warnings #11352

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1821,7 +1821,8 @@ def test_pyplot_axes():
# test focusing of Axes in other Figure
fig1, ax1 = plt.subplots()
fig2, ax2 = plt.subplots()
assert ax1 is plt.axes(ax1)
with pytest.warns(MatplotlibDeprecationWarning):
assert ax1 is plt.axes(ax1)
assert ax1 is plt.gca()
assert fig1 is plt.gcf()
plt.close(fig1)
Expand Down
9 changes: 6 additions & 3 deletions lib/matplotlib/tests/test_dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

from matplotlib.testing.decorators import image_comparison
import matplotlib.pyplot as plt
from matplotlib.cbook import MatplotlibDeprecationWarning
import matplotlib.dates as mdates


Expand Down Expand Up @@ -239,16 +240,18 @@ def test_strftime_fields(dt):
minute=dt.minute,
second=dt.second,
microsecond=dt.microsecond))
assert formatter.strftime(dt) == formatted_date_str
with pytest.warns(MatplotlibDeprecationWarning):
assert formatter.strftime(dt) == formatted_date_str

try:
# Test strftime("%x") with the current locale.
import locale # Might not exist on some platforms, such as Windows
locale_formatter = mdates.DateFormatter("%x")
locale_d_fmt = locale.nl_langinfo(locale.D_FMT)
expanded_formatter = mdates.DateFormatter(locale_d_fmt)
assert locale_formatter.strftime(dt) == \
expanded_formatter.strftime(dt)
with pytest.warns(MatplotlibDeprecationWarning):
assert locale_formatter.strftime(dt) == \
expanded_formatter.strftime(dt)
except (ImportError, AttributeError):
pass

Expand Down
0