Skip to content

Commit cfa3ada

Browse files
committed
Initial test cases
1 parent 0e0bafb commit cfa3ada

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

pandas/tests/plotting/test_misc.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,3 +681,23 @@ def test_bar_plt_xaxis_intervalrange(self):
681681
(a.get_text() == b.get_text())
682682
for a, b in zip(s.plot.bar().get_xticklabels(), expected)
683683
)
684+
685+
686+
def test_plot_bar_label_count_expected_fail():
687+
df = DataFrame([(30, 10, 10), (20, 20, 20), (10, 30, 30)], columns=list("ABC"))
688+
with pytest.raises(
689+
ValueError,
690+
match="The length of `title` must equal the number of columns "
691+
"if using `title` of type `list` and `subplots=True`.",
692+
):
693+
df.plot(
694+
subplots=[("A", "B")],
695+
kind="bar",
696+
stacked=True,
697+
title=["A&B", "C", "Extra Title"],
698+
)
699+
700+
701+
def test_plot_bar_label_count_expected_success():
702+
df = DataFrame([(30, 10, 10), (20, 20, 20), (10, 30, 30)], columns=list("ABC"))
703+
df.plot(subplots=[("A", "B")], kind="bar", stacked=True, title=["A&B", "C"])

0 commit comments

Comments
 (0)