Skip to content

TST: stop suppressing plot test exceptions, xfail broken test #29099

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 11 commits into from
Oct 22, 2019
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
13 changes: 7 additions & 6 deletions pandas/tests/plotting/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

from pandas.core.dtypes.api import is_list_like

import pandas as pd
from pandas import DataFrame, Series
import pandas.util.testing as tm
from pandas.util.testing import assert_is_valid_plot_return_object, ensure_clean
Expand Down Expand Up @@ -541,13 +542,13 @@ def _check_plot_works(f, filterwarnings="always", **kwargs):

assert_is_valid_plot_return_object(ret)

try:
kwargs["ax"] = fig.add_subplot(212)
ret = f(**kwargs)
except Exception:
pass
if f is pd.plotting.bootstrap_plot:
assert "ax" not in kwargs
else:
assert_is_valid_plot_return_object(ret)
kwargs["ax"] = fig.add_subplot(212)

ret = f(**kwargs)
assert_is_valid_plot_return_object(ret)

with ensure_clean(return_filelike=True) as path:
plt.savefig(path)
Expand Down
18 changes: 12 additions & 6 deletions pandas/tests/plotting/test_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
""" Test cases for DataFrame.plot """

from datetime import date, datetime
import itertools
import string
import warnings

Expand Down Expand Up @@ -2604,12 +2605,6 @@ def test_errorbar_plot(self):
ax = _check_plot_works(df.plot, yerr=np.ones((2, 12)) * 0.4)
self._check_has_errorbars(ax, xerr=0, yerr=2)

# yerr is iterator
import itertools

ax = _check_plot_works(df.plot, yerr=itertools.repeat(0.1, len(df)))
self._check_has_errorbars(ax, xerr=0, yerr=2)

# yerr is column name
for yerr in ["yerr", "誤差"]:
s_df = df.copy()
Expand All @@ -2626,6 +2621,17 @@ def test_errorbar_plot(self):
with pytest.raises((ValueError, TypeError)):
df.plot(yerr=df_err)

@pytest.mark.xfail(reason="Iterator is consumed", raises=ValueError)
@pytest.mark.slow
def test_errorbar_plot_iterator(self):
with warnings.catch_warnings():
d = {"x": np.arange(12), "y": np.arange(12, 0, -1)}
df = DataFrame(d)

# yerr is iterator
ax = _check_plot_works(df.plot, yerr=itertools.repeat(0.1, len(df)))
self._check_has_errorbars(ax, xerr=0, yerr=2)

@pytest.mark.slow
def test_errorbar_with_integer_column_names(self):
# test with integer column names
Expand Down