Skip to content

Commit cff88a6

Browse files
committed
Test refinements
1 parent c36cae2 commit cff88a6

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

pandas/tests/plotting/test_groupby.py

+5-9
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,8 @@ def test_plot_kwargs(self):
6969

7070
@pytest.mark.parametrize("column, expected_axes_num", [(None, 2), ("b", 1)])
7171
@pytest.mark.parametrize("label", [None, "d"])
72-
def test_groupby_hist_with_legend(self, column, expected_axes_num, label):
73-
# GH 6279
74-
# Histogram can have a legend
72+
def test_groupby_hist_frame_with_legend(self, column, expected_axes_num, label):
73+
# GH 6279 - Histogram can have a legend
7574
expected_layout = (1, expected_axes_num)
7675
expected_labels = label or column or [["a"], ["b"]]
7776

@@ -84,8 +83,7 @@ def test_groupby_hist_with_legend(self, column, expected_axes_num, label):
8483
if label is not None:
8584
kwargs["label"] = label
8685

87-
ret = g.hist(**kwargs)
88-
for (_, axes) in ret.iteritems():
86+
for axes in g.hist(**kwargs):
8987
self._check_axes_shape(
9088
axes, axes_num=expected_axes_num, layout=expected_layout
9189
)
@@ -96,8 +94,7 @@ def test_groupby_hist_with_legend(self, column, expected_axes_num, label):
9694
"label, expected_label", [(None, ["1", "2"]), ("d", ["d", "d"])]
9795
)
9896
def test_groupby_hist_series_with_legend(self, label, expected_label):
99-
# GH 6279
100-
# Histogram can have a legend
97+
# GH 6279 - Histogram can have a legend
10198
index = Index(15 * ["1"] + 15 * ["2"], name="c")
10299
df = DataFrame(np.random.randn(30, 2), index=index, columns=["a", "b"])
103100
g = df.groupby("c")
@@ -107,7 +104,6 @@ def test_groupby_hist_series_with_legend(self, label, expected_label):
107104
if label is not None:
108105
kwargs["label"] = label
109106

110-
axes = g["a"].hist(**kwargs)
111-
for (_, ax) in axes.iteritems():
107+
for ax in g["a"].hist(**kwargs):
112108
self._check_axes_shape(ax, axes_num=1, layout=(1, 1))
113109
self._check_legend_labels(ax, expected_label)

pandas/tests/plotting/test_hist_method.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,7 @@ def test_plot_fails_when_ax_differs_from_figure(self):
136136
def test_hist_with_legend(
137137
self, by, expected_axes_num, expected_layout, label, expected_label
138138
):
139-
# GH 6279
140-
# Histogram can have a legend
139+
# GH 6279 - Histogram can have a legend
141140
index = 15 * ["1"] + 15 * ["2"]
142141
s = Series(np.random.randn(30), index=index, name="a")
143142
s.index.name = "b"
@@ -319,8 +318,7 @@ def test_hist_column_order_unchanged(self, column, expected):
319318
@pytest.mark.parametrize("column", [None, "b"])
320319
@pytest.mark.parametrize("label", [None, "d"])
321320
def test_hist_with_legend(self, by, column, label):
322-
# GH 6279
323-
# Histogram can have a legend
321+
# GH 6279 - Histogram can have a legend
324322
expected_axes_num = 1 if by is None and column is not None else 2
325323
expected_layout = (1, expected_axes_num)
326324
expected_labels = label or column or ["a", "b"]

0 commit comments

Comments
 (0)