Skip to content

Commit ca52e39

Browse files
authored
TST/REF: delete duplicated hist tests (#38628)
1 parent 3882fd2 commit ca52e39

File tree

1 file changed

+0
-84
lines changed

1 file changed

+0
-84
lines changed

pandas/tests/plotting/test_series.py

-84
Original file line numberDiff line numberDiff line change
@@ -365,90 +365,6 @@ def test_pie_nan(self):
365365
result = [x.get_text() for x in ax.texts]
366366
assert result == expected
367367

368-
def test_hist_legacy(self):
369-
_check_plot_works(self.ts.hist)
370-
_check_plot_works(self.ts.hist, grid=False)
371-
_check_plot_works(self.ts.hist, figsize=(8, 10))
372-
# _check_plot_works adds an ax so catch warning. see GH #13188
373-
with tm.assert_produces_warning(UserWarning):
374-
_check_plot_works(self.ts.hist, by=self.ts.index.month)
375-
with tm.assert_produces_warning(UserWarning):
376-
_check_plot_works(self.ts.hist, by=self.ts.index.month, bins=5)
377-
378-
fig, ax = self.plt.subplots(1, 1)
379-
_check_plot_works(self.ts.hist, ax=ax)
380-
_check_plot_works(self.ts.hist, ax=ax, figure=fig)
381-
_check_plot_works(self.ts.hist, figure=fig)
382-
tm.close()
383-
384-
fig, (ax1, ax2) = self.plt.subplots(1, 2)
385-
_check_plot_works(self.ts.hist, figure=fig, ax=ax1)
386-
_check_plot_works(self.ts.hist, figure=fig, ax=ax2)
387-
388-
with pytest.raises(ValueError):
389-
self.ts.hist(by=self.ts.index, figure=fig)
390-
391-
def test_hist_bins_legacy(self):
392-
df = DataFrame(np.random.randn(10, 2))
393-
ax = df.hist(bins=2)[0][0]
394-
assert len(ax.patches) == 2
395-
396-
def test_hist_layout(self):
397-
df = self.hist_df
398-
with pytest.raises(ValueError):
399-
df.height.hist(layout=(1, 1))
400-
401-
with pytest.raises(ValueError):
402-
df.height.hist(layout=[1, 1])
403-
404-
def test_hist_layout_with_by(self):
405-
df = self.hist_df
406-
407-
# _check_plot_works adds an ax so catch warning. see GH #13188
408-
with tm.assert_produces_warning(UserWarning):
409-
axes = _check_plot_works(df.height.hist, by=df.gender, layout=(2, 1))
410-
self._check_axes_shape(axes, axes_num=2, layout=(2, 1))
411-
412-
with tm.assert_produces_warning(UserWarning):
413-
axes = _check_plot_works(df.height.hist, by=df.gender, layout=(3, -1))
414-
self._check_axes_shape(axes, axes_num=2, layout=(3, 1))
415-
416-
with tm.assert_produces_warning(UserWarning):
417-
axes = _check_plot_works(df.height.hist, by=df.category, layout=(4, 1))
418-
self._check_axes_shape(axes, axes_num=4, layout=(4, 1))
419-
420-
with tm.assert_produces_warning(UserWarning):
421-
axes = _check_plot_works(df.height.hist, by=df.category, layout=(2, -1))
422-
self._check_axes_shape(axes, axes_num=4, layout=(2, 2))
423-
424-
with tm.assert_produces_warning(UserWarning):
425-
axes = _check_plot_works(df.height.hist, by=df.category, layout=(3, -1))
426-
self._check_axes_shape(axes, axes_num=4, layout=(3, 2))
427-
428-
with tm.assert_produces_warning(UserWarning):
429-
axes = _check_plot_works(df.height.hist, by=df.category, layout=(-1, 4))
430-
self._check_axes_shape(axes, axes_num=4, layout=(1, 4))
431-
432-
with tm.assert_produces_warning(UserWarning):
433-
axes = _check_plot_works(df.height.hist, by=df.classroom, layout=(2, 2))
434-
self._check_axes_shape(axes, axes_num=3, layout=(2, 2))
435-
436-
axes = df.height.hist(by=df.category, layout=(4, 2), figsize=(12, 7))
437-
self._check_axes_shape(axes, axes_num=4, layout=(4, 2), figsize=(12, 7))
438-
439-
def test_hist_no_overlap(self):
440-
from matplotlib.pyplot import gcf, subplot
441-
442-
x = Series(np.random.randn(2))
443-
y = Series(np.random.randn(2))
444-
subplot(121)
445-
x.hist()
446-
subplot(122)
447-
y.hist()
448-
fig = gcf()
449-
axes = fig.axes
450-
assert len(axes) == 2
451-
452368
def test_df_series_secondary_legend(self):
453369
# GH 9779
454370
df = DataFrame(np.random.randn(30, 3), columns=list("abc"))

0 commit comments

Comments
 (0)