Skip to content

Commit b93eedb

Browse files
committed
Changed exception message raised and updated test case
1 parent 878e610 commit b93eedb

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

pandas/plotting/_matplotlib/core.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -805,9 +805,6 @@ def _adorn_subplots(self, fig: Figure) -> None:
805805
if not isinstance(self.subplots, bool):
806806
if len(self.subplots) != len(self.title):
807807
raise ValueError(
808-
"The length of `title` must equal the number "
809-
"of subplots if `title` of type `list` "
810-
"and subplots is iterable.\n"
811808
f"The number of titles ({len(self.title)}) must equal "
812809
f"the number of subplots ({len(self.subplots)})."
813810
)

pandas/tests/plotting/test_misc.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
plt = pytest.importorskip("matplotlib.pyplot")
3232
cm = pytest.importorskip("matplotlib.cm")
3333

34+
import re
35+
3436
from pandas.plotting._matplotlib.style import get_standard_colors
3537

3638

@@ -844,12 +846,10 @@ def test_plot_bar_label_count_expected_fail():
844846
df = DataFrame(
845847
[(30, 10, 10, 10), (20, 20, 20, 20), (10, 30, 30, 10)], columns=list("ABCD")
846848
)
847-
with pytest.raises(
848-
ValueError,
849-
match="The length of `title` must equal the number "
850-
"of subplots if `title` of type `list` "
851-
"and subplots is iterable.\n",
852-
):
849+
error_regex = re.escape(
850+
"The number of titles (4) must equal the number of subplots (3)."
851+
)
852+
with pytest.raises(ValueError, match=error_regex):
853853
df.plot(
854854
subplots=[("A", "B")],
855855
kind="bar",

0 commit comments

Comments
 (0)