From 3583da908a586734e1badf2e65c1944028537f2e Mon Sep 17 00:00:00 2001 From: Aleksey Bilogur Date: Mon, 13 Mar 2017 11:15:21 -0400 Subject: [PATCH 1/3] TST: remove errant test cf. #9351 --- pandas/tests/plotting/test_hist_method.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/pandas/tests/plotting/test_hist_method.py b/pandas/tests/plotting/test_hist_method.py index 22de7055e3cea..4f64f66bd3c4d 100644 --- a/pandas/tests/plotting/test_hist_method.py +++ b/pandas/tests/plotting/test_hist_method.py @@ -238,16 +238,6 @@ def test_hist_layout(self): with tm.assertRaises(ValueError): df.hist(layout=(-1, -1)) - @slow - # GH 9351 - def test_tight_layout(self): - if self.mpl_ge_2_0_0: - df = DataFrame(randn(100, 2)) - _check_plot_works(df.hist) - self.plt.tight_layout() - - tm.close() - @tm.mplskip class TestDataFrameGroupByPlots(TestPlotBase): From 888a4cef9b801a2a92e38b14b9fb2a42cdbfc2df Mon Sep 17 00:00:00 2001 From: Aleksey Bilogur Date: Mon, 13 Mar 2017 13:19:10 -0400 Subject: [PATCH 2/3] +test --- pandas/tests/plotting/common.py | 1 + pandas/tests/plotting/test_hist_method.py | 10 ++++++++++ pandas/tools/plotting.py | 8 ++++++++ 3 files changed, 19 insertions(+) diff --git a/pandas/tests/plotting/common.py b/pandas/tests/plotting/common.py index 92e2dc7b5d934..c31d8b539ae6f 100644 --- a/pandas/tests/plotting/common.py +++ b/pandas/tests/plotting/common.py @@ -53,6 +53,7 @@ def setUp(self): self.mpl_ge_1_4_0 = plotting._mpl_ge_1_4_0() self.mpl_ge_1_5_0 = plotting._mpl_ge_1_5_0() self.mpl_ge_2_0_0 = plotting._mpl_ge_2_0_0() + self.mpl_ge_2_0_1 = plotting._mpl_ge_2_0_1() if self.mpl_ge_1_4_0: self.bp_n_objects = 7 diff --git a/pandas/tests/plotting/test_hist_method.py b/pandas/tests/plotting/test_hist_method.py index 4f64f66bd3c4d..380bdc12abce4 100644 --- a/pandas/tests/plotting/test_hist_method.py +++ b/pandas/tests/plotting/test_hist_method.py @@ -238,6 +238,16 @@ def test_hist_layout(self): with tm.assertRaises(ValueError): df.hist(layout=(-1, -1)) + @slow + # GH 9351 + def test_tight_layout(self): + if self.mpl_ge_2_0_1: + df = DataFrame(randn(100, 3)) + _check_plot_works(df.hist) + self.plt.tight_layout() + + tm.close() + @tm.mplskip class TestDataFrameGroupByPlots(TestPlotBase): diff --git a/pandas/tools/plotting.py b/pandas/tools/plotting.py index d46c38c117445..f72f71437f4de 100644 --- a/pandas/tools/plotting.py +++ b/pandas/tools/plotting.py @@ -150,6 +150,14 @@ def _mpl_ge_2_0_0(): return False +def _mpl_ge_2_0_1(): + try: + import matplotlib + return (matplotlib.__version__ >= LooseVersion('2.0.1')) + except ImportError: + return False + + if _mpl_ge_1_5_0(): # Compat with mp 1.5, which uses cycler. import cycler From 99cd2558f3baf9d6c9772b170d05dd9c3edfdb9d Mon Sep 17 00:00:00 2001 From: Aleksey Bilogur Date: Mon, 13 Mar 2017 13:52:35 -0400 Subject: [PATCH 3/3] rm redundant parens --- pandas/tools/plotting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tools/plotting.py b/pandas/tools/plotting.py index f72f71437f4de..d311b0e6d83eb 100644 --- a/pandas/tools/plotting.py +++ b/pandas/tools/plotting.py @@ -153,7 +153,7 @@ def _mpl_ge_2_0_0(): def _mpl_ge_2_0_1(): try: import matplotlib - return (matplotlib.__version__ >= LooseVersion('2.0.1')) + return matplotlib.__version__ >= LooseVersion('2.0.1') except ImportError: return False