From 23479374bc1fceff3b93383ba4fcea8bd240ad3e Mon Sep 17 00:00:00 2001 From: Hugues Valois Date: Tue, 23 May 2017 12:00:08 -0700 Subject: [PATCH 1/2] Add test for bug #6608. --- pandas/tests/plotting/test_series.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pandas/tests/plotting/test_series.py b/pandas/tests/plotting/test_series.py index 340a98484480f..0141bb141c390 100644 --- a/pandas/tests/plotting/test_series.py +++ b/pandas/tests/plotting/test_series.py @@ -433,6 +433,22 @@ def test_hist_no_overlap(self): axes = fig.axes if self.mpl_ge_1_5_0 else fig.get_axes() assert len(axes) == 2 + @slow + def test_overlapping_datetime(self): + # GB 6608 + s1 = pd.Series([1, 2, 3], index=[datetime(1995, 12, 31), + datetime(2000, 12, 31), + datetime(2005, 12, 31)]) + s2 = pd.Series([1, 2, 3], index=[datetime(1997, 12, 31), + datetime(2003, 12, 31), + datetime(2008, 12, 31)]) + + # plot first series, then add the second series to those axes, + # then try adding the first series again + ax = s1.plot() + s2.plot(ax=ax) + s1.plot(ax=ax) + @slow def test_hist_secondary_legend(self): # GH 9610 From 3fe6d647a5c45c996ca452a84fcc2fe6ac3d48b7 Mon Sep 17 00:00:00 2001 From: Hugues Valois Date: Tue, 23 May 2017 13:19:24 -0700 Subject: [PATCH 2/2] Relocated test to a different file. --- pandas/tests/plotting/test_datetimelike.py | 16 ++++++++++++++++ pandas/tests/plotting/test_series.py | 16 ---------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/pandas/tests/plotting/test_datetimelike.py b/pandas/tests/plotting/test_datetimelike.py index 92537059218d6..d9bdafb37a321 100644 --- a/pandas/tests/plotting/test_datetimelike.py +++ b/pandas/tests/plotting/test_datetimelike.py @@ -1349,6 +1349,22 @@ def test_hist(self): w2 = np.arange(0, 1, .1)[::-1] self.plt.hist([x, x], weights=[w1, w2]) + @slow + def test_overlapping_datetime(self): + # GB 6608 + s1 = Series([1, 2, 3], index=[datetime(1995, 12, 31), + datetime(2000, 12, 31), + datetime(2005, 12, 31)]) + s2 = Series([1, 2, 3], index=[datetime(1997, 12, 31), + datetime(2003, 12, 31), + datetime(2008, 12, 31)]) + + # plot first series, then add the second series to those axes, + # then try adding the first series again + ax = s1.plot() + s2.plot(ax=ax) + s1.plot(ax=ax) + def _check_plot_works(f, freq=None, series=None, *args, **kwargs): import matplotlib.pyplot as plt diff --git a/pandas/tests/plotting/test_series.py b/pandas/tests/plotting/test_series.py index 0141bb141c390..340a98484480f 100644 --- a/pandas/tests/plotting/test_series.py +++ b/pandas/tests/plotting/test_series.py @@ -433,22 +433,6 @@ def test_hist_no_overlap(self): axes = fig.axes if self.mpl_ge_1_5_0 else fig.get_axes() assert len(axes) == 2 - @slow - def test_overlapping_datetime(self): - # GB 6608 - s1 = pd.Series([1, 2, 3], index=[datetime(1995, 12, 31), - datetime(2000, 12, 31), - datetime(2005, 12, 31)]) - s2 = pd.Series([1, 2, 3], index=[datetime(1997, 12, 31), - datetime(2003, 12, 31), - datetime(2008, 12, 31)]) - - # plot first series, then add the second series to those axes, - # then try adding the first series again - ax = s1.plot() - s2.plot(ax=ax) - s1.plot(ax=ax) - @slow def test_hist_secondary_legend(self): # GH 9610