Skip to content

Commit aced0ed

Browse files
committed
Add a unit test for pandas-dev#9351.
1 parent 4a64c39 commit aced0ed

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

pandas/tests/plotting/test_hist_method.py

+14
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,20 @@ def test_hist_layout(self):
238238
with tm.assertRaises(ValueError):
239239
df.hist(layout=(-1, -1))
240240

241+
@slow
242+
def test_tight_layout(self):
243+
tm._skip_if_mpl_1()
244+
245+
df = DataFrame(randn(100, 2))
246+
df.plot.hist()
247+
248+
try:
249+
self.plt.tight_layout()
250+
except AttributeError:
251+
raise
252+
253+
tm.close()
254+
241255

242256
@tm.mplskip
243257
class TestDataFrameGroupByPlots(TestPlotBase):

pandas/util/testing.py

+8
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,14 @@ def _skip_if_mpl_1_5():
286286
pytest.skip("matplotlib 1.5")
287287

288288

289+
def _skip_if_mpl_1():
290+
import matplotlib
291+
v = matplotlib.__version__
292+
if v < LooseVersion('2.0.0') or v[0] == '0' or v[0] == '1':
293+
import pytest
294+
pytest.skip("matplotlib 1.5")
295+
296+
289297
def _skip_if_no_scipy():
290298
try:
291299
import scipy.stats # noqa

0 commit comments

Comments
 (0)