o
    %ju                     @  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_thingZ
matplotlibzmatplotlib.pyplotc                 C  s0   |  \}}||  ksJ ||  ksJ d S N)Zget_ylimminmax)colaxZy_minZy_max r   j/var/www/html/Deteccion_Ine/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#      )ZClinicalZ	ConfirmedZ	DiscardedindexbarT)kindZ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  r*   r   r+   r.   r   r   r   r1   F   r2   )matplotlib.pyplotpyplotr   nprandomdefault_rngchoiceZarangeplotget_xticklabelsr'   Zto_listZ
set_xticksZ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)rD   byindic2rH   notchr$   )rH   rJ   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#         rL   rE   rF   threefourr'   columnsfoor(   r%   rG   )rS   r(   rS   rI   FZcheck_stacklevel)r   r6   r7   r8   standard_normalr<   stringascii_letterstmassert_produces_warningr   boxplot)r=   kwargswarnr@   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#   rL   rC   )datarB   )	r   r6   r7   r8   rU   r   r   Z_corerZ   )r=   Z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#   r3   r#   Col1Col2rR   
Are   re   re   re   Brf   rf   rf   rf   Xre   r3   YFrT   rH   )
r   r6   r7   r8   r   rX   rY   UserWarningr   rZ   r=   r@   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#   r`   ra   rb   rc   rd   rg   re   r3   rh   )rH   r   )
r   r6   r7   r8   r   mplr5   subplotsrZ   axes)r=   r@   _r   ro   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#   r`   ra   rb   rc   rd   rg   re   r3   rh   ro   r   rB   )r   r6   r7   r8   r   rm   r5   rn   groupbyrZ   ro   )r=   r@   figr   ro   rq   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#   r`   ra   rb   rc   rd   rg   re   r3   rh   ro   )rD   rH   r   rB   )r   r6   r7   r8   r   rm   r5   rn   rX   rY   rj   rZ   Z
get_figure)r=   r@   ru   r   ro   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#   r`   ra   rb   rc   rd   rg   re   r3   rh   rC   rs   )r   r6   r7   r8   r   rm   r5   rn   rZ   r<   	itertoolschainfrom_iterablevalueslen	get_lines)r=   r@   rp   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   )rZ   
isinstancerm   r5   ZAxes)r=   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#   rK   rL   rN   rQ   z,return_type must be {'axes', 'dict', 'both'}matchZ
NOT_A_TYPErB   ro   )r   r6   r7   r8   rU   r<   rV   rW   pytestraises
ValueErrorrZ   r
   )r=   r@   msgr   r   r   r   test_boxplot_return_type_legacy   s   z2TestDataFramePlots.test_boxplot_return_type_legacyrC   ro   Z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#   rK   rL   rN   rQ   Fr   )r   r6   r7   r8   rU   r<   rV   rW   rX   rY   rZ   r
   )r=   rB   r@   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categoryri   	copyr6   r7   r8   integersshaperZ   r   Z_sharey)r=   r   r@   	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   ri   )r   r   )r   r$   )r$   r   r$   r$   r   r   r   )r=   r   r@   pr   r   Zage_axZ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   rM   r   ro   r   )	r   r6   r7   r8   rU   nanlocr   rZ   rk   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#   )r3      )re   rf   CDErc   ro   )      )rB   figsizer   r   )	r   r6   r7   r8   rZ   figureZbbox_incheswidthr   )r=   r@   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%   rM   r   rL      )fontsizeZ
xlabelsizeZ
ylabelsizer   r   rZ   rk   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)r)   c                 S     g | ]}|  qS r   r-   r.   r   r   r   r1          z@TestDataFramePlots.test_boxplot_numeric_data.<locals>.<listcomp>r   r   )r   r   r6   r7   r8   rU   astypestrr   r:   r;   )r=   r@   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#   r`   rC   colorrB   r   )r   r6   r7   r8   rZ   items	get_color)r=   Z
colors_kwdexpectedr@   r   kvr   r   r   test_color_kwd   s
   z!TestDataFramePlots.test_color_kwdzscheme,expectedZ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#   r`   r   rC   r   )r   r6   r7   r8   r4   r5   styleZuser:   r   r   r   )r=   schemer   r@   r>   r   r   r   r   r   r   test_colors_in_theme  s   z'TestDataFramePlots.test_colors_in_themezdict_colors, msg)r   Z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#   r`   r   rC   r   )r   r6   r7   r8   r   r   r   rZ   )r=   Zdict_colorsr   r@   r   r   r   test_color_kwd_errors1  s   "z(TestDataFramePlots.test_color_kwd_errorszprops, expected))Zboxpropsr   )Zwhiskerpropsr   )Zcappropsr   )Z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#   r3   )r6   r7   r8   )r/   r   r   r   r   
<dictcomp>F  s     z?TestDataFramePlots.test_specified_props_kwd.<locals>.<dictcomp>ABCr   ZC1rB   rC   r   r   )r   rZ   r   )r=   propsr   r@   Z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#   r3   group1group2r   r   groupr0   yr   )r)   xlabelylabelr   )	r   r6   r7   r8   rU   r9   r:   
get_xlabel
get_ylabelr=   r   r@   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   rM   sizeZABCDrc   r   )r3      T)Zncolsr   Zsharey)r   r   r   r$   r   )r6   r7   r8   r   r   r<   r>   rn   r:   r   r   r   rm   r5   close)
r=   r   rngZdf1df2r   r   rp   Z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#   r3   r   r   r   r   )r   r   r   )	r   r6   r7   r8   rU   r9   rZ   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#   r3   r   r   r   r   r   )rH   r   r   r   )r   r6   r7   r8   rU   r9   rZ   r   r   rm   r5   r   )r=   r   r@   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#   r3   r   r   r   rH   r   r   Tr   r   )r   rm   __version__Zapplymarkerr   markZxfailr   r6   r7   r8   rU   r9   rZ   r   r   r   r5   r   )r=   r   r    r@   r   r   Ztarget_labelr   r   r   #test_boxplot_group_no_xlabel_ylabel  s*   z6TestDataFramePlots.test_boxplot_group_no_xlabel_ylabel)#__name__
__module____qualname__rA   r   r   slowparametrizerj   r]   r_   rl   rr   rv   rw   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genderri   FrT   ro   r   r#   )r$   r#   axes_numlayout)	rt   rX   rY   rj   r   rZ   r	   r<   r{   r=   r   groupedro   r   r   r   r]     s
   z.TestDataFrameGroupByPlots.test_boxplot_legacy1c                 C  s.   |j dd}t|jddd}t|ddd d S )	Nr   ri   Fro   rn   rB   r$   r   r   )rt   r   rZ   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 )Nr3   r#   r3   r%   r&   r$   levelFrT   ro   r   )rM   r%   r   )ziprV   rW   ranger   r6   r7   r8   r   from_tuplesrt   rX   rY   rj   r   rZ   r	   r<   r{   r=   tuplesr@   r   ro   r   r   r   rl     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 )Nr3   r#   r  r&   r$   r  Fro   r   r   r   )r  rV   rW   r  r   r6   r7   r8   r   r  rt   r   rZ   r	   r  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 )Nr3   r#   r  r&   z+DataFrame.groupby with axis=1 is deprecatedr   r$   r  r   )r  ZaxisFrT   ro   r   r   )r  rV   rW   r  r   r6   r7   r8   r   r  rX   rY   FutureWarningZunstackrt   r   rZ   r	   )
r=   rn   r\   r   r   r  r@   r   r   ro   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 )Nr3   r#      r   r   <   malefemaler   r   r   r   allro   r   r$   )r   r6   r7   r8   normalr9   r   rt   r:   r|   rm   r5   Zget_fignumsr>   r   rZ   )r=   r?   r   r   r   r@   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 )Nr3   r#   r  r   r   r  r  r  r  r   )	r   r6   r7   r8   r  r9   r   rt   hist)r=   r?   r   r   r   r@   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   ri   r   r   r   Zexpected_keys)rZ   r   r6   Zndarrayr
   r=   r   r@   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   rC   r   ZMaleZFemaler  rt   rZ   r
   r  r   r   r   $test_grouped_box_return_type_groupby  s   z>TestDataFrameGroupByPlots.test_grouped_box_return_type_groupbyrB   r   c                 C  sL   |}| dj|d}t||g dd |jd|d}t||g dd d S )N	classroomr   re   rf   r   r  rH   rB   r  r  )r=   r   rB   r@   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#   )rL   r   rc   zA Br%   r   r   r  r!  )	splitr   r6   r7   r8   rU   rt   rZ   r
   )r=   rB   Zcolumns2r   Zcategories2r"  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   rD   rH   r   r   r   r   rZ   r   r=   r   r@   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   r  )r#   r$   rC   rD   r   rB   )r   r   r   rZ   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   )r-  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   rM   r#   )r  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 )NFrT   r   rC   rD   rB   r#   r   rX   rY   rj   r   rt   rZ   r	   rm   r5   gcfro   )r=   r   Zgb_keyr   rowsr@   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 )	Nr  r   ro   )rD   rH   rB   r%   r
  r   )visible)
rZ   r	   rm   r5   r1  ro   r   r;   ZxaxisZ	get_label)r=   r   r   r4  r@   ro   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 )Nr  r  rC   r/  r%   r
  r   rt   rZ   r	   rm   r5   r1  ro   )r=   r   r@   r   r   r   test_grouped_box_layout_shape[  s
   
z7TestDataFrameGroupByPlots.test_grouped_box_layout_shapecolsr#   r-  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 )NFrT   r   r   r%   rC   r+  rM   )r%   r#   r   r0  )r=   r   r8  r@   r   r   r   test_grouped_box_layout_worksc  s   
z7TestDataFrameGroupByPlots.test_grouped_box_layout_worksz	rows, resrM   c                 C  s:   |}|j g dd|dfd ttj jd|dfd d S )Nr  r   r$   r'  r%   r   )rZ   r	   rm   r5   r1  ro   )r=   r   r2  r  r@   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 )Nr  r  r$   rC   r+  r%   r   r6  )r=   r   r8  r  r@   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   ro   rD   rB   r   rM   r
  r   )rX   rY   rj   rm   r5   rn   rt   rZ   r	   r1  ro   )r=   r   r@   rp   ro   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%   r  r   ro   r   )rD   rH   rB   r   )r$   r%   r   r  r$   r<  )rm   r5   rn   rX   rY   rj   rZ   r6   arrayr<   r{   r	   Zassert_numpy_array_equalr   rt   )r=   r   r@   ru   ro   r"  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%   r  )r   )r   r   r   rm   r5   rn   rX   rY   rj   rt   rZ   )r=   r   r@   r   ru   ro   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   )rH   r   r   r   rk   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))
rA  rG  rB  rH  rC  rI  rD  rJ  rE  rK  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#   Zabcder   )catr   rF  rL  Fro   )rn   rD   rB   c                 S  r   r   r   r.   r   r   r   r1     r   zQTestDataFrameGroupByPlots.test_groupby_boxplot_subplots_false.<locals>.<listcomp>)
r   r6   r7   r8   r9   r<   rt   r   rZ   r;   )r=   r   expected_xticklabelr@   r   ro   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)rn   )r   rt   r   r   r   r   rZ   )r=   r   r@   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(   bazrR  rS   rS   quxrS  )rE   rF   rE   rF   rE   rF   rE   rF   firstsecond)namesr#   )r%   r   r   rQ   )r(   rE   )r(   rF   ro   r/  z
(bar, one)z
(bar, two)c                 S  r   r   r   r.   r   r   r   r1     r   zLTestDataFrameGroupByPlots.test_boxplot_multiindex_column.<locals>.<listcomp>)r<   r  r   r  r   r6   r7   r8   rU   r   rZ   r;   )	r=   Zarraysr  r'   r@   r   ro   rM  rN  r   r   r   test_boxplot_multiindex_column  s   z8TestDataFrameGroupByPlots.test_boxplot_multiindex_column)#r   r   r   r]   r   r   r   r   rl   r	  r   rj   r  r  r  r  r  r#  r%  r*  r,  r.  r3  r5  r7  r9  r:  r;  r=  r?  r@  r   rO  rQ  rW  r   r   r   r   r     s    



	


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


	






&r   )'__doc__
__future__r   rx   rV   numpyr6   r   Zpandasr   r   r   r   r   r   Zpandas._testingZ_testingrX   Zpandas.tests.plotting.commonr	   r
   r   r   r   Zpandas.util.versionr   Zpandas.io.formats.printingr   Zimportorskiprm   r>   r   r   r   __annotations__Zfixturer   r!   r   r   r   r   r   <module>   s.     



  q