Skip to content

Commit 86dc4e6

Browse files
GH1147 PR Feedback
1 parent 849a69b commit 86dc4e6

File tree

1 file changed

+42
-1
lines changed

1 file changed

+42
-1
lines changed

tests/test_plotting.py

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
import pytest
1717
from typing_extensions import assert_type
1818

19-
from tests import check
19+
from tests import (
20+
PD_LTE_22,
21+
check,
22+
)
2023

2124
from pandas.plotting import (
2225
deregister_matplotlib_converters,
@@ -605,8 +608,31 @@ def test_grouped_dataframe_boxplot(close_figures):
605608
check(assert_type(grouped.boxplot(), Series), Series)
606609
check(assert_type(grouped.boxplot(subplots=True), Series), Series)
607610

611+
# a single plot
612+
if not PD_LTE_22:
613+
check(
614+
assert_type(
615+
grouped.boxplot(
616+
subplots=False,
617+
rot=45,
618+
fontsize=12,
619+
figsize=(8, 10),
620+
orientation="horizontal",
621+
),
622+
Axes,
623+
),
624+
Axes,
625+
)
626+
608627

609628
def test_grouped_dataframe_boxplot_single(close_figures):
629+
"""
630+
Test with pandas 2.2.3 separated to make it pass.
631+
632+
With pandas 2.2.3 the passing of certain keywords is broken so this test
633+
is put separately to make sure that we have no Axes already created.
634+
It will fail with `orientation="horizontal"`.
635+
"""
610636
tuples = [t for t in itertools.product(range(10), range(2))]
611637
index = pd.MultiIndex.from_tuples(tuples, names=["lvl0", "lvl1"])
612638
df = pd.DataFrame(
@@ -628,6 +654,21 @@ def test_grouped_dataframe_boxplot_single(close_figures):
628654
Axes,
629655
)
630656

657+
if not PD_LTE_22:
658+
check(
659+
assert_type(
660+
grouped.boxplot(
661+
subplots=False,
662+
rot=45,
663+
fontsize=12,
664+
figsize=(8, 10),
665+
orientation="horizontal",
666+
),
667+
Axes,
668+
),
669+
Axes,
670+
)
671+
631672
# not a literal bool
632673
check(assert_type(grouped.boxplot(subplots=bool(0.5)), Union[Axes, Series]), Series)
633674

0 commit comments

Comments
 (0)