MCPcopy
hub / github.com/pandas-dev/pandas / _check_plot_works

Function _check_plot_works

pandas/tests/plotting/test_datetimelike.py:1696–1721  ·  view source on GitHub ↗
(f, freq=None, series=None, *args, **kwargs)

Source from the content-addressed store, hash-verified

1694
1695
1696def _check_plot_works(f, freq=None, series=None, *args, **kwargs):
1697 fig = plt.gcf()
1698
1699 fig.clf()
1700 ax = fig.add_subplot(211)
1701 orig_ax = kwargs.pop("ax", plt.gca())
1702 orig_axfreq = getattr(orig_ax, "freq", None)
1703
1704 ret = f(*args, **kwargs)
1705 assert ret is not None # do something more intelligent
1706
1707 ax = kwargs.pop("ax", plt.gca())
1708 if series is not None:
1709 dfreq = series.index.freq
1710 if isinstance(dfreq, BaseOffset):
1711 dfreq = dfreq.rule_code
1712 if orig_axfreq is None:
1713 assert ax.freq == dfreq
1714
1715 if freq is not None and orig_axfreq is None:
1716 assert to_offset(ax.freq, is_period=True) == freq
1717
1718 ax = fig.add_subplot(212)
1719 kwargs["ax"] = ax
1720 ret = f(*args, **kwargs)
1721 assert ret is not None # TODO: do something more intelligent

Calls 2

fFunction · 0.50
popMethod · 0.45

Tested by

no test coverage detected