File tree Expand file tree Collapse file tree 1 file changed +42
-1
lines changed
Expand file tree Collapse file tree 1 file changed +42
-1
lines changed Original file line number Diff line number Diff line change 1616import pytest
1717from typing_extensions import assert_type
1818
19- from tests import check
19+ from tests import (
20+ PD_LTE_22 ,
21+ check ,
22+ )
2023
2124from 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
609628def 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
You can’t perform that action at this time.
0 commit comments