o
    vhu                     @  s  U d Z ddlmZ ddlZddlZddlZddlZddlm	Z	m
Z
mZmZmZmZ ddlmZ ddlmZmZmZmZmZ ddlmZ ddlmZ edZed	Zd
d Zeej edk rmddiddigZ!de"d< nddiddigZ!ej#e!ddd Z$G dd dZ%G dd dZ&dS )z  Test cases for .boxplot method     )annotationsN)	DataFrame
MultiIndexSeries
date_rangeplottingtimedelta_range)_check_axes_shape_check_box_return_type_check_plot_works_check_ticks_props_check_visible)Version)pprint_thing
matplotlibzmatplotlib.pyplotc                 C  s0   |  \}}||  ksJ ||  ksJ d S N)get_ylimminmax)colaxy_miny_max r   g/var/www/html/hyperkenya/venv/lib/python3.10/site-packages/pandas/tests/plotting/test_boxplot_method.py_check_ax_limits#   s   r   3.10vertFTzlist[dict[str, bool | str]]vertsorientation
horizontalvertical)paramsc                 C  s   | j S r   )param)requestr   r   r   r   /   s   c                   @  sH  e Zd Zdd Zejjejdddidgddd	gidgdd	gd
degdgd
dgddgdd
iegdd
dgiegddidgd
ddeggdd Z	dd Z
dd Zdd Zdd Zdd Zdd Zdd  Zd!d" Zejdg d#d$d% Zd&d' Zd(d) Zd*d+ Zd,d- Zd.d/ Zd0d1 Zejd2d3d4d5d6d7d3d4d5d6d7fd8d3id8d3ifd3d3d3d3d3d7fgd9d: Zejd;d<d=d=d>d=d7fd?d@d@dAd@d7fgdBdC ZejdDd3d3dEdFfgdGdH ZejdIg dJdKdL ZejdMdNdO ZejdMdPdQ ZejdMdRdS Z ejdMdTdU Z!ejdMdVdW Z"dS )XTestDataFramePlotsc                 C  s   dd l m} d}ttjdg d|tjdg d|tjdg d|dtd|d}|jddd	}d
d |	 D |j
 ksKJ |tddd |  dd |	 D ttdddksmJ d S )Nr   P      )r      r'      )Clinical	Confirmed	DiscardedindexbarT)kindstackedc                 S     g | ]}t | qS r   intget_text.0xr   r   r   
<listcomp>C       zDTestDataFramePlots.test_stacked_boxplot_set_axis.<locals>.<listcomp>
   c                 S  r2   r   r3   r6   r   r   r   r9   F   r:   )matplotlib.pyplotpyplotr   nprandomdefault_rngchoicearangeplotget_xticklabelsr.   to_list
set_xticksdrawlist)selfpltndfr   r   r   r   test_stacked_boxplot_set_axis5   s    
 z0TestDataFramePlots.test_stacked_boxplot_set_axiszkwargs, warnreturn_typedictNcolumnonetwoindic)rP   byindic2rT   notchr(   )rT   rV   c                 C  s   t tjddttjd d g dd}ddgd |d	< g d
d |d< tj	|dd t
|jfi | W d    d S 1 sCw   Y  d S )Nr'         rX   rQ   rR   threefourr.   columnsfoor/   r)   rS   )r_   r/   r_   rU   Fcheck_stacklevel)r   r>   r?   r@   standard_normalrH   stringascii_letterstmassert_produces_warningr   boxplot)rI   kwargswarnrL   r   r   r   test_boxplot_legacy1J   s   "z'TestDataFramePlots.test_boxplot_legacy1c                 C  s,   t tjdd}ttjj|dd d S )Nr'   rX   rO   )datarN   )	r   r>   r?   r@   rb   r   r   _corerg   )rI   serr   r   r   test_boxplot_legacy1_seriese   s   z.TestDataFramePlots.test_boxplot_legacy1_seriesc                 C  s   t tjddddgd}tg d|d< tdgd	 |d
< tjtdd t|j	dd W d    d S 1 s:w   Y  d S )Nr'   r;   r'   Col1Col2r^   
Art   rt   rt   rt   Bru   ru   ru   ru   Xrt   r;   YFr`   rT   )
r   r>   r?   r@   r   re   rf   UserWarningr   rg   rI   rL   r   r   r   test_boxplot_legacy2i   s   "z'TestDataFramePlots.test_boxplot_legacy2c                 C  st   t tjddddgd}tg d|d< tdgd	 |d
< tj \}}|jdd|d}|j	}||u s8J d S )Nr'   ro   rp   rq   rr   rs   rv   rt   r;   rw   )rT   r   )
r   r>   r?   r@   r   mplr=   subplotsrg   axes)rI   rL   _r   r~   ax_axesr   r   r   test_boxplot_legacy2_with_axr   s   z/TestDataFramePlots.test_boxplot_legacy2_with_axc                 C  s|   t tjddddgd}tg d|d< tdgd	 |d
< tj \}}|d
j	|dd}|j
}||d u s<J d S )Nr'   ro   rp   rq   rr   rs   rv   rt   r;   rw   r~   r   rN   )r   r>   r?   r@   r   r|   r=   r}   groupbyrg   r~   )rI   rL   figr   r~   r   r   r   r   (test_boxplot_legacy2_with_ax_return_type   s   z;TestDataFramePlots.test_boxplot_legacy2_with_ax_return_typec                 C  s   t tjddddgd}tg d|d< tdgd	 |d
< tj \}}t	t
 |jddgd|dd}W d    n1 sBw   Y  |d  |u sQJ d S )Nr'   ro   rp   rq   rr   rs   rv   rt   r;   rw   r~   )rP   rT   r   rN   )r   r>   r?   r@   r   r|   r=   r}   re   rf   ry   rg   
get_figure)rI   rL   r   r   r~   r   r   r   #test_boxplot_legacy2_with_multi_col   s   z6TestDataFramePlots.test_boxplot_legacy2_with_multi_colc                 C  s   t tjddddgd}tg d|d< tdgd	 |d
< tj \}}|j|dd}t	t
j| }t| t|ksDJ d S )Nr'   ro   rp   rq   rr   rs   rv   rt   r;   rw   rO   r   )r   r>   r?   r@   r   r|   r=   r}   rg   rH   	itertoolschainfrom_iterablevalueslen	get_lines)rI   rL   r   r   dlinesr   r   r   test_boxplot_legacy2_by_none   s   z/TestDataFramePlots.test_boxplot_legacy2_by_nonec                 C  s   |  }t|tjjsJ d S r   )rg   
isinstancer|   r=   Axes)rI   hist_dfresultr   r   r   test_boxplot_return_type_none   s   z0TestDataFramePlots.test_boxplot_return_type_nonec                 C  s   t tjddttjd d g dd}d}tj	t
|d |jdd	 W d    n1 s1w   Y  | }t|d
 d S )Nr'   rW   rX   rZ   r]   z,return_type must be {'axes', 'dict', 'both'}match
NOT_A_TYPErN   r~   )r   r>   r?   r@   rb   rH   rc   rd   pytestraises
ValueErrorrg   r
   )rI   rL   msgr   r   r   r   test_boxplot_return_type_legacy   s   z2TestDataFramePlots.test_boxplot_return_type_legacyrO   r~   bothc                 C  sr   t tjddttjd d g dd}t	d |j
|d}W d    n1 s-w   Y  t|| d S )Nr'   rW   rX   rZ   r]   Fr   )r   r>   r?   r@   rb   rH   rc   rd   re   rf   rg   r
   )rI   rN   rL   r   r   r   r   +test_boxplot_return_type_legacy_return_type   s   z>TestDataFramePlots.test_boxplot_return_type_legacy_return_typec                 C  sl   |  }tjddd|jd |d< |jddgdd	\}}t|d | t|d | |j|ks4J d S )
Nr'   r(      r   ageheightweightcategoryrx   	copyr>   r?   r@   integersshaperg   r   _sharey)rI   r   rL   	height_ax	weight_axr   r   r   test_boxplot_axis_limits   s    z+TestDataFramePlots.test_boxplot_axis_limitsc                 C  s   |  }tjddd|jd |d< |jg ddd}|d	 |d
 |d }}}|d }t|d | t|d | t|d | |j|ksKJ |j|ksRJ |jd u sYJ d S )Nr'   r(   r   r   r   )r   r   r   r   rx   )r   r   )r   r(   )r(   r   r(   r(   r   r   r   )rI   r   rL   pr   r   age_axdummy_axr   r   r   !test_boxplot_axis_limits_two_rows   s    z4TestDataFramePlots.test_boxplot_axis_limits_two_rowsc                 C  s<   t tjdd}tj|jd d df< t|jdd d S )Nr'   )r   rY   r   r~   r   )	r   r>   r?   r@   rb   nanlocr   rg   rz   r   r   r   test_boxplot_empty_column   s   z,TestDataFramePlots.test_boxplot_empty_columnc                 C  sT   t tjddg dd}|jddd}|jjjdksJ |jjjd	ks(J d S )
Nr'   )r;      )rt   ru   CDErr   r~   )      )rN   figsizer   r   )	r   r>   r?   r@   rg   figurebbox_incheswidthr   )rI   rL   r   r   r   r   test_figsize   s   zTestDataFramePlots.test_figsizec                 C  s,   t dg di}t|jdddddd d S )Nar(   r'   r)   rY   r   rX      )fontsize
xlabelsize
ylabelsizer   r   rg   rz   r   r   r   test_fontsize   s   z TestDataFramePlots.test_fontsizec              
   C  s   t tdddtjddtjddd tdddttddddtdddd}|j	d	d
}dd |
 D ddgksDJ d S )Nz
2012-01-01d   )periodsr'   UTC)r   tzz1 days)r   bcr   efbox)r0   c                 S     g | ]}|  qS r   r5   r6   r   r   r   r9          z@TestDataFramePlots.test_boxplot_numeric_data.<locals>.<listcomp>r   r   )r   r   r>   r?   r@   rb   astypestrr   rC   rD   )rI   rL   r   r   r   r   test_boxplot_numeric_data   s   


"z,TestDataFramePlots.test_boxplot_numeric_datazcolors_kwd, expectedrr   gr   )boxeswhiskersmedianscapsr   c                 C  sR   t tjdd}|j|dd}| D ]\}}|| d  |ks&J qd S )Nr'   ro   rO   colorrN   r   )r   r>   r?   r@   rg   items	get_color)rI   
colors_kwdexpectedrL   r   kvr   r   r   test_color_kwd   s
   z!TestDataFramePlots.test_color_kwdzscheme,expecteddark_backgroundz#8dd3c7z#bfbbd9defaultz#1f77b4z#2ca02cc                 C  sj   t tjdd}dd lm} |j| |jj	dd}|
 D ]\}}|| d  |ks2J q"d S )Nr'   ro   r   rO   r   )r   r>   r?   r@   r<   r=   styleuserC   r   r   r   )rI   schemer   rL   rJ   r   r   r   r   r   r   test_colors_in_theme  s   z'TestDataFramePlots.test_colors_in_themezdict_colors, msg)r   invalid_keyzinvalid key 'invalid_key'c                 C  sX   t tjdd}tjt|d |j|dd W d    d S 1 s%w   Y  d S )Nr'   ro   r   rO   r   )r   r>   r?   r@   r   r   r   rg   )rI   dict_colorsr   rL   r   r   r   test_color_kwd_errors1  s   "z(TestDataFramePlots.test_color_kwd_errorszprops, expected))boxpropsr   )whiskerpropsr   )cappropsr   )medianpropsr   c                 C  sN   t dd dD }|ddii}|jd	ddi|}|| d  dks%J d S )
Nc                 S  s    i | ]}|t jd dqS )r'   r;   )r>   r?   r@   )r7   r   r   r   r   
<dictcomp>F  s     z?TestDataFramePlots.test_specified_props_kwd.<locals>.<dictcomp>ABCr   C1rN   rO   r   r   )r   rg   r   )rI   propsr   rL   kwdr   r   r   r   test_specified_props_kwd;  s   z+TestDataFramePlots.test_specified_props_kwdz!ignore:set_ticklabels:UserWarningc                 C  s   t tjddtjddtjdddgdd}d\}}|jd	d||d|}| |ks8J | |ks@J d S )
Nr'   r;   group1group2r   r   groupr8   yr   )r0   xlabelylabelr   )	r   r>   r?   r@   rb   rA   rC   
get_xlabel
get_ylabelrI   r   rL   r  r  r   r   r   r   test_plot_xlabel_ylabelL  s   z*TestDataFramePlots.test_plot_xlabel_ylabelc           
      C  s   t jd}t|jddddtdd}t|jddddtdd}d\}}tjdd	d
d\}}|jj	d|d ||d| |jj	d|d ||d| |D ]}	|	
 |ksZJ |	 |ksbJ qPtj  d S )Nr'   r   r   )r   rY   sizeABCDrr   r   )r;      T)ncolsr   sharey)r   r  r  r(   r   )r>   r?   r@   r   r   rH   rJ   r}   rC   r   r  r  r|   r=   close)
rI   r   rngdf1df2r  r  r   axsr   r   r   r   test_plot_boxZ  s   z TestDataFramePlots.test_plot_boxc                 C  s   t tjddtjddtjdddgdd}d\}}|jd||d|}| |ks7J | |ks?J d S )	Nr'   r;   r   r   r   r   )r  r  r   )	r   r>   r?   r@   rb   rA   rg   r  r  r  r   r   r   test_boxplot_xlabel_ylabelj  s   z-TestDataFramePlots.test_boxplot_xlabel_ylabelc                 C  s   t tjddtjddtjdddgdd}d\}}|jd	d||d|}|D ]}| |ks<J | |ksDJ q2t	j
  d S )
Nr'   r;   r   r   r   r   r   )rT   r  r  r   )r   r>   r?   r@   rb   rA   rg   r  r  r|   r=   r  )rI   r   rL   r  r  r   subplotr   r   r    test_boxplot_group_xlabel_ylabelx  s   z3TestDataFramePlots.test_boxplot_group_xlabel_ylabelc                 C  s   t tjt dkr|ddikr|tjj| dd ttj	
ddtj	
ddtj	
ddd	gdd
}|jdddi|}|D ]}|ddiksV|ddikrZ| n| }|tdgksgJ qHtj  d S )Nr   r   r    z$ fails starting with matplotlib 3.10)reasonr'   r;   r   r   r   rT   r   r   Tr!   r   )r   r|   __version__applymarkerr   markxfailr   r>   r?   r@   rb   rA   rg   r  r  r   r=   r  )rI   r   r$   rL   r   r  target_labelr   r   r   #test_boxplot_group_no_xlabel_ylabel  s*   z6TestDataFramePlots.test_boxplot_group_no_xlabel_ylabel)#__name__
__module____qualname__rM   r   r  slowparametrizery   rj   rn   r{   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   filterwarningsr  r  r  r  r  r   r   r   r   r%   4   s    


	
	





	








r%   c                
   @  s  e Zd Zdd Zdd Zejjdd Zejjdd Z	ej
d	d
eddgg dgdd Zdd Zdd Zejjdd Zejjdd Zejjej
dg ddd Zejjej
dg ddd Zejjdd Zejjd d! Zejjd"d# Zejjej
d$g d%g d&g d'gd(d) Zejjej
d*d+d,gd-d
gd.d
ggd/d0 Zejjd1d2 Zejjej
d3d4d5gd6d7 Zejjej
d8d9d9gd5dggd:d; Zejjej
d<d9d9gd5dggd=d> Zejjd?d@ ZejjdAdB ZejjdCdD ZdEdF Zej
dGdHg dIfdHgg dIfdJg dKfdHdJgg dLfdMg dLfgdNdO Z dPdQ Z!dRdS Z"dMS )TTestDataFrameGroupByPlotsc                 C  s`   |j dd}tjtdd t|jdd}W d    n1 sw   Y  tt|jddd	 d S )
Ngenderrx   Fr`   r~   r   r'   )r(   r'   axes_numlayout)	r   re   rf   ry   r   rg   r	   rH   r   rI   r   groupedr~   r   r   r   rj     s
   z.TestDataFrameGroupByPlots.test_boxplot_legacy1c                 C  s.   |j dd}t|jddd}t|ddd d S )	Nr%  rx   Fr~   r}   rN   r(   r   r&  )r   r   rg   r	   r)  r   r   r    test_boxplot_legacy1_return_type  s   z:TestDataFrameGroupByPlots.test_boxplot_legacy1_return_typec                 C  s   t tjd d td}ttjddt	|d}|j
dd}tjtdd t|jd	d
}W d    n1 s;w   Y  tt|jddd d S )Nr;   r'   r;   r)   r-   r(   levelFr`   r~   r   )rY   r)   r&  )ziprc   rd   ranger   r>   r?   r@   r   from_tuplesr   re   rf   ry   r   rg   r	   rH   r   rI   tuplesrL   r*  r~   r   r   r   r{     s   z.TestDataFrameGroupByPlots.test_boxplot_legacy2c                 C  sf   t tjd d td}ttjddt	|d}|j
dd}t|jddd	}t|dd
d d S )Nr;   r'   r-  r-   r(   r.  Fr~   r+  r   r&  )r0  rc   rd   r1  r   r>   r?   r@   r   r2  r   r   rg   r	   r3  r   r   r    test_boxplot_legacy2_return_type  s   z:TestDataFrameGroupByPlots.test_boxplot_legacy2_return_typez subplots, warn, axes_num, layoutTr)   r'   r'   )FNr(   r   c           
      C  s   t tjd d td}ttjddt	|d}d}t
jt|d |jddjd	dd
}W d    n1 s;w   Y  t
j|dd t|j|dd}	W d    n1 sZw   Y  t|	||d d S )Nr;   r'   r-  r-   z+DataFrame.groupby with axis=1 is deprecatedr   r(   r.  r   )r/  axisFr`   r~   r+  r&  )r0  rc   rd   r1  r   r>   r?   r@   r   r2  re   rf   FutureWarningunstackr   r   rg   r	   )
rI   r}   ri   r'  r(  r4  rL   r   r*  r~   r   r   r   test_boxplot_legacy3  s   z.TestDataFrameGroupByPlots.test_boxplot_legacy3c                 C  s   d}t tjdjdd|d}t tjdjdd|d}tjdjddg|d}t|||d	}|d
}| }t	t
j dksGJ t	|dksOJ td |jdd}t	t
j dkseJ t	|dksmJ d S )Nr;   r'      r   r  <   malefemaler   r   r%  r%  allr~   r   r(   )r   r>   r?   r@   normalrA   r   r   rC   r   r|   r=   get_fignumsrJ   r  rg   )rI   rK   r   r   r%  rL   gbresr   r   r   test_grouped_plot_fignums  s   

z3TestDataFrameGroupByPlots.test_grouped_plot_fignumsc                 C  sx   d}t tjdjdd|d}t tjdjdd|d}tjdjddg|d}t|||d	}|d
  d S )Nr;   r'   r;  r   r  r<  r=  r>  r?  r%  )	r   r>   r?   r@   rA  rA   r   r   hist)rI   rK   r   r   r%  rL   r   r   r   &test_grouped_plot_fignums_excluded_col  s   z@TestDataFrameGroupByPlots.test_grouped_plot_fignums_excluded_colc                 C  s6   |}|j dd}t|tjsJ t|d g dd d S )Nr%  rx   r   r   r   expected_keys)rg   r   r>   ndarrayr
   rI   r   rL   r   r   r   r   test_grouped_box_return_type  s   

z6TestDataFrameGroupByPlots.test_grouped_box_return_typec                 C  s,   |}| djdd}t|dddgd d S )Nr%  rO   r   MaleFemalerI  r   rg   r
   rL  r   r   r   $test_grouped_box_return_type_groupby  s   z>TestDataFrameGroupByPlots.test_grouped_box_return_type_groupbyrN   r   c                 C  sL   |}| dj|d}t||g dd |jd|d}t||g dd d S )N	classroomr   rt   ru   r   rI  rT   rN   rH  rP  )rI   r   rN   rL   returnedr   r   r    test_grouped_box_return_type_arg  s   

z:TestDataFrameGroupByPlots.test_grouped_box_return_type_argc                 C  sv   d  }ttjdd|d}d  }|d |d< |dj|d}t|||d	 |jd|d
}t|||d	 d S )Nz	X B C D Ar'   )rX   r   rr   zA Br)   r   r   rI  rT  )	splitr   r>   r?   r@   rb   r   rg   r
   )rI   rN   columns2r  categories2rU  r   r   r   .test_grouped_box_return_type_arg_duplcate_cats  s   zHTestDataFrameGroupByPlots.test_grouped_box_return_type_arg_duplcate_catsc                 C  R   |}d}t jt|d |jddg|jdd W d    d S 1 s"w   Y  d S )Nz1Layout of 1x1 must be larger than required size 2r   r   r   r   rP   rT   r(  r   r   r   rg   r%  rI   r   rL   r   r   r   r   !test_grouped_box_layout_too_small"  s
   "z;TestDataFrameGroupByPlots.test_grouped_box_layout_too_smallc                 C  sP   |}d}t jt|d |jg dddd W d    d S 1 s!w   Y  d S )Nz7The 'layout' keyword is not supported when 'by' is Noner   rH  )r'   r(   rO   rP   r(  rN   )r   r   r   rg   r^  r   r   r    test_grouped_box_layout_needs_by*  s   "z:TestDataFrameGroupByPlots.test_grouped_box_layout_needs_byc                 C  r[  )Nz1At least one dimension of layout must be positiver   r   r   )rb  r\  r]  r^  r   r   r   'test_grouped_box_layout_positive_layout5  s
   "zATestDataFrameGroupByPlots.test_grouped_box_layout_positive_layoutzgb_key, axes_num, rows)r%  r'   r(   )r   rY   r'   )rR  r)   r'   c                 C  sf   |}t jtdd t||jddd W d    n1 sw   Y  ttj	 j
||dfd d S )NFr`   r   rO   rP   rN   r'   r&  re   rf   ry   r   r   rg   r	   r|   r=   gcfr~   )rI   r   gb_keyr'  rowsrL   r   r   r   ,test_grouped_box_layout_positive_layout_axes<  s   zFTestDataFrameGroupByPlots.test_grouped_box_layout_positive_layout_axeszcol, visibler   Fr   r   c                 C  s^   |}|j g dddd}ttj jddd || }t| |d t|j	 g|d d S )	NrH  r%  r~   )rP   rT   rN   r)   r6  r&  )visible)
rg   r	   r|   r=   rf  r~   r   rD   xaxis	get_label)rI   r   r   rj  rL   r~   r   r   r   r   test_grouped_box_layout_visibleL  s   
z9TestDataFrameGroupByPlots.test_grouped_box_layout_visiblec                 C  s6   |}| djg ddd ttj jddd d S )NrR  rH  rO   rd  r)   r6  r&  r   rg   r	   r|   r=   rf  r~   )rI   r   rL   r   r   r   test_grouped_box_layout_shape[  s
   
z7TestDataFrameGroupByPlots.test_grouped_box_layout_shapecolsr'   rb  c                 C  sh   |}t jtdd t|djdd|fdd W d    n1 s"w   Y  ttj	 j
dd	d
 d S )NFr`   r   r   r)   rO   r`  rY   )r)   r'   r&  re  )rI   r   rp  rL   r   r   r   test_grouped_box_layout_worksc  s   
z7TestDataFrameGroupByPlots.test_grouped_box_layout_worksz	rows, resrY   c                 C  s:   |}|j g dd|dfd ttj jd|dfd d S )NrH  r%  r(   r\  r)   r&  )rg   r	   r|   r=   rf  r~   )rI   r   rh  rD  rL   r   r   r   'test_grouped_box_layout_axes_shape_rowsp  s
   zATestDataFrameGroupByPlots.test_grouped_box_layout_axes_shape_rowsz	cols, resc                 C  s@   |}| djg dd|fdd ttj jdd|fd d S )NrR  rH  r(   rO   r`  r)   r&  rn  )rI   r   rp  rD  rL   r   r   r   /test_grouped_box_layout_axes_shape_cols_groupbyy  s   
zITestDataFrameGroupByPlots.test_grouped_box_layout_axes_shape_cols_groupbyc                 C  sr   |}t t( tjdd\}}|djdd|d ttj	 j
ddd W d    d S 1 s2w   Y  d S )	Nr'   r   r   r~   rP   rN   r   rY   r6  r&  )re   rf   ry   r|   r=   r}   r   rg   r	   rf  r~   )rI   r   rL   r   r~   r   r   r   test_grouped_box_multiple_axes  s   "z8TestDataFrameGroupByPlots.test_grouped_box_multiple_axesc                 C  s&  |}t jdd\}}tt |jg ddd|d d}W d    n1 s(w   Y  tt	|j
}t|ddd	 t||d  |d j|u sMJ tt |d
jg dd|d d}W d    n1 slw   Y  tt	|j
}t|ddd	 t||d  |d j|u sJ d S )Nr'   r)   rH  r%  r~   r   )rP   rT   rN   r   )r(   r)   r&  rR  r(   rt  )r|   r=   r}   re   rf   ry   rg   r>   arrayrH   r   r	   assert_numpy_array_equalr   r   )rI   r   rL   r   r~   rU  r   r   r   %test_grouped_box_multiple_axes_on_fig  s.   
z?TestDataFrameGroupByPlots.test_grouped_box_multiple_axes_on_figc              	   C  s   |}d}t jt|d8 tjdd\}}tt |	dj
|d}W d    n1 s.w   Y  W d    d S W d    d S 1 sFw   Y  d S )Nz@The number of passed axes must be 3, the same as the output plotr   r'   r)   rR  )r   )r   r   r   r|   r=   r}   re   rf   ry   r   rg   )rI   r   rL   r   r   r~   r   r   r   'test_grouped_box_multiple_axes_ax_error  s   "zATestDataFrameGroupByPlots.test_grouped_box_multiple_axes_ax_errorc                 C  s4   t g dg dd}t|jddddddd d S )	Nr   )r   r   r   r(   r(   r(   )r   r   r   r   r   )rT   r   r   r   rz   r   r   r   r     s   
z'TestDataFrameGroupByPlots.test_fontsizezcol, expected_xticklabelr   )(a, v)(b, v)(c, v)(d, v)(e, v)v1)(a, v1)(b, v1)(c, v1)(d, v1)(e, v1))
rz  r  r{  r  r|  r  r}  r  r~  r  Nc                 C  s~   t tjdtddtjddtjddd}|d}t|jd|dd}d	d
 |	 D }||ks=J d S )Nr'   abcder   )catr   r  r  Fr~   )r}   rP   rN   c                 S  r   r   r   r6   r   r   r   r9     r   zQTestDataFrameGroupByPlots.test_groupby_boxplot_subplots_false.<locals>.<listcomp>)
r   r>   r?   r@   rA   rH   r   r   rg   rD   )rI   r   expected_xticklabelrL   r*  r~   result_xticklabelr   r   r   #test_groupby_boxplot_subplots_false  s   (

z=TestDataFrameGroupByPlots.test_groupby_boxplot_subplots_falsec                 C  sZ   | d}|d}d}tjt|d t|jdd W d    d S 1 s&w   Y  d S )Nobjectr%  z:boxplot method requires numerical columns, nothing to plotr   F)r}   )r   r   r   r   r   r   rg   )rI   r   rL   r*  r   r   r   r   test_groupby_boxplot_object  s   

"z5TestDataFrameGroupByPlots.test_groupby_boxplot_objectc           	      C  s   g dg dg}t t| }tj|ddgd}ttjddg d|d	}d
dg}t	|j
|dd}ddg}dd | D }||ksFJ d S )N)r/   r/   bazr  r_   r_   quxr  )rQ   rR   rQ   rR   rQ   rR   rQ   rR   firstsecond)namesr'   )r)   r   rS  r]   )r/   rQ   )r/   rR   r~   rd  z
(bar, one)z
(bar, two)c                 S  r   r   r   r6   r   r   r   r9     r   zLTestDataFrameGroupByPlots.test_boxplot_multiindex_column.<locals>.<listcomp>)rH   r0  r   r2  r   r>   r?   r@   rb   r   rg   rD   )	rI   arraysr4  r.   rL   r   r~   r  r  r   r   r   test_boxplot_multiindex_column  s   z8TestDataFrameGroupByPlots.test_boxplot_multiindex_column)#r  r  r   rj   r,  r   r  r!  r{   r5  r"  ry   r:  rE  rG  rM  rQ  rV  rZ  r_  ra  rc  ri  rm  ro  rq  rr  rs  ru  rx  ry  r   r  r  r  r   r   r   r   r$    s    



	







	






&r$  )'__doc__
__future__r   r   rc   numpyr>   r   pandasr   r   r   r   r   r   pandas._testing_testingre   pandas.tests.plotting.commonr	   r
   r   r   r   pandas.util.versionr   pandas.io.formats.printingr   importorskipr|   rJ   r   r  r   __annotations__fixturer   r%   r$  r   r   r   r   <module>   s.     



  q