o
    Û­jÏu  ã                   @  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   úf/var/www/html/CropPilot/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-01éd   )Ú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 s‘J ‚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