Skip to content
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

TST: clean deprecation warnings for xref #19980 #20013

Merged
merged 1 commit into from
Mar 6, 2018
Merged
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
45 changes: 27 additions & 18 deletions pandas/tests/plotting/test_datetimelike.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,15 @@ def test_tsplot_deprecated(self):

@pytest.mark.slow
def test_tsplot(self):

from pandas.tseries.plotting import tsplot

_, ax = self.plt.subplots()
ts = tm.makeTimeSeries()

f = lambda *args, **kwds: tsplot(s, self.plt.Axes.plot, *args, **kwds)
def f(*args, **kwds):
with tm.assert_produces_warning(FutureWarning):
return tsplot(s, self.plt.Axes.plot, *args, **kwds)

for s in self.period_ser:
_check_plot_works(f, s.index.freq, ax=ax, series=s)
Expand Down Expand Up @@ -188,11 +191,13 @@ def check_format_of_first_point(ax, expected_string):
tm.close()

# tsplot
_, ax = self.plt.subplots()
from pandas.tseries.plotting import tsplot
tsplot(annual, self.plt.Axes.plot, ax=ax)
_, ax = self.plt.subplots()
with tm.assert_produces_warning(FutureWarning):
tsplot(annual, self.plt.Axes.plot, ax=ax)
check_format_of_first_point(ax, 't = 2014 y = 1.000000')
tsplot(daily, self.plt.Axes.plot, ax=ax)
with tm.assert_produces_warning(FutureWarning):
tsplot(daily, self.plt.Axes.plot, ax=ax)
check_format_of_first_point(ax, 't = 2014-01-01 y = 1.000000')

@pytest.mark.slow
Expand Down Expand Up @@ -879,12 +884,12 @@ def test_to_weekly_resampling(self):
for l in ax.get_lines():
assert PeriodIndex(data=l.get_xdata()).freq == idxh.freq

# tsplot
from pandas.tseries.plotting import tsplot

_, ax = self.plt.subplots()
tsplot(high, self.plt.Axes.plot, ax=ax)
lines = tsplot(low, self.plt.Axes.plot, ax=ax)
from pandas.tseries.plotting import tsplot
with tm.assert_produces_warning(FutureWarning):
tsplot(high, self.plt.Axes.plot, ax=ax)
with tm.assert_produces_warning(FutureWarning):
lines = tsplot(low, self.plt.Axes.plot, ax=ax)
for l in lines:
assert PeriodIndex(data=l.get_xdata()).freq == idxh.freq

Expand All @@ -910,12 +915,12 @@ def test_from_weekly_resampling(self):
tm.assert_numpy_array_equal(xdata, expected_h)
tm.close()

# tsplot
from pandas.tseries.plotting import tsplot

_, ax = self.plt.subplots()
tsplot(low, self.plt.Axes.plot, ax=ax)
lines = tsplot(high, self.plt.Axes.plot, ax=ax)
from pandas.tseries.plotting import tsplot
with tm.assert_produces_warning(FutureWarning):
tsplot(low, self.plt.Axes.plot, ax=ax)
with tm.assert_produces_warning(FutureWarning):
lines = tsplot(high, self.plt.Axes.plot, ax=ax)
for l in lines:
assert PeriodIndex(data=l.get_xdata()).freq == idxh.freq
xdata = l.get_xdata(orig=False)
Expand Down Expand Up @@ -1351,9 +1356,11 @@ def test_plot_outofbounds_datetime(self):
values = [datetime(1677, 1, 1, 12), datetime(1677, 1, 2, 12)]
ax.plot(values)

@pytest.mark.skip(
is_platform_mac(),
"skip on mac for precision display issue on older mpl")
@pytest.mark.xfail(reason="suspect on mpl 2.2.2")
def test_format_timedelta_ticks_narrow(self):
if is_platform_mac():
pytest.skip("skip on mac for precision display issue on older mpl")

if self.mpl_ge_2_0_0:
expected_labels = [''] + [
Expand All @@ -1374,9 +1381,11 @@ def test_format_timedelta_ticks_narrow(self):
for l, l_expected in zip(labels, expected_labels):
assert l.get_text() == l_expected

@pytest.mark.skip(
is_platform_mac(),
"skip on mac for precision display issue on older mpl")
@pytest.mark.xfail(reason="suspect on mpl 2.2.2")
def test_format_timedelta_ticks_wide(self):
if is_platform_mac():
pytest.skip("skip on mac for precision display issue on older mpl")

if self.mpl_ge_2_0_0:
expected_labels = [
Expand Down