a
    Pfr                     @   s   d 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 edZedZdd	 ZG d
d dZG dd dZdS )z  Test cases for .boxplot method     N)	DataFrame
MultiIndexSeries
date_rangeplottingtimedelta_range)_check_axes_shape_check_box_return_type_check_plot_works_check_ticks_props_check_visible)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   b/var/www/ai-form-bot/venv/lib/python3.9/site-packages/pandas/tests/plotting/test_boxplot_method.py_check_ax_limits    s    r   c                   @   sf  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dMdNdOgdPdQ ZejdMdNdOgdRdS ZejdMdNdOgdTdU ZejdMdNdOgdVdW Z ejdMdNdOgdXdY Z!dS )Z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sJ |tddd |  dd |	 D ttdddksJ d S )Nr   P      )r      r      )ZClinicalZ	ConfirmedZ	DiscardedindexbarT)kindZstackedc                 S   s   g | ]}t | qS r   intget_text.0xr   r   r   
<listcomp>5       zDTestDataFramePlots.test_stacked_boxplot_set_axis.<locals>.<listcomp>
   c                 S   s   g | ]}t | qS r   r   r"   r   r   r   r%   8   r&   )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_axis'   s     
 z0TestDataFramePlots.test_stacked_boxplot_set_axiszkwargs, warnreturn_typedictNcolumnonetwoindic)r8   byindic2r<   notchr   )r<   r>   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    n1 s0    Y  d S )Nr         r@   r9   r:   threefourr   columnsfoor   r   r;   )rG   r   rG   r=   FZcheck_stacklevel)r   r*   r+   r,   standard_normalr0   stringascii_letterstmassert_produces_warningr
   boxplot)r1   kwargswarnr4   r   r   r   test_boxplot_legacy1<   s    z'TestDataFramePlots.test_boxplot_legacy1c                 C   s,   t tjdd}ttjj|dd d S )Nr   r@   r7   )datar6   )	r   r*   r+   r,   rI   r
   r   Z_corerN   )r1   Zserr   r   r   test_boxplot_legacy1_seriesW   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    n1 sr0    Y  d S )Nr   r'   r   Col1Col2rF   
ArY   rY   rY   rY   BrZ   rZ   rZ   rZ   XrY   r'   YFrH   r<   )
r   r*   r+   r,   r   rL   rM   UserWarningr
   rN   r1   r4   r   r   r   test_boxplot_legacy2[   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 spJ d S )Nr   rT   rU   rV   rW   rX   r[   rY   r'   r\   )r<   r   )
r   r*   r+   r,   r   mplr)   subplotsrN   axes)r1   r4   _r   rc   ax_axesr   r   r   test_boxplot_legacy2_with_axd   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 sxJ d S )Nr   rT   rU   rV   rW   rX   r[   rY   r'   r\   rc   r   r6   )r   r*   r+   r,   r   ra   r)   rb   groupbyrN   rc   )r1   r4   figr   rc   re   r   r   r   (test_boxplot_legacy2_with_ax_return_typeq   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 s0    Y  |d  |u sJ d S )Nr   rT   rU   rV   rW   rX   r[   rY   r'   r\   rc   )r8   r<   r   r6   )r   r*   r+   r,   r   ra   r)   rb   rL   rM   r^   rN   Z
get_figure)r1   r4   ri   r   rc   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sJ d S )Nr   rT   rU   rV   rW   rX   r[   rY   r'   r\   r7   rg   )r   r*   r+   r,   r   ra   r)   rb   rN   r0   	itertoolschainfrom_iterablevalueslen	get_lines)r1   r4   rd   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   )rN   
isinstancera   r)   ZAxes)r1   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 sb0    Y  | }t|d
 d S )Nr   r?   r@   rB   rE   z,return_type must be {'axes', 'dict', 'both'}matchZ
NOT_A_TYPEr6   rc   )r   r*   r+   r,   rI   r0   rJ   rK   pytestraises
ValueErrorrN   r	   )r1   r4   msgrw   r   r   r   test_boxplot_return_type_legacy   s    *z2TestDataFramePlots.test_boxplot_return_type_legacyr7   rc   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 sZ0    Y  t|| d S )Nr   r?   r@   rB   rE   Fr{   )r   r*   r+   r,   rI   r0   rJ   rK   rL   rM   rN   r	   )r1   r6   r4   rw   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shJ d S )
Nr   r      r   ageheightweightcategoryr]   	copyr*   r+   r,   integersshaperN   r   Z_sharey)r1   rv   r4   	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sJ |j|ksJ |jd u sJ d S )Nr   r   r   r   r   )r   r   r   r   r]   )r   r   )r   r   )r   r   r   r   r   r   r   )r1   rv   r4   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   rA   r   rc   r{   )	r   r*   r+   r,   rI   nanlocr
   rN   r_   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sPJ d S )
Nr   )r'      )rY   rZ   CDErW   rc   )      )r6   figsizer   r   )	r   r*   r+   r,   rN   figureZbbox_incheswidthr   )r1   r4   rw   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   rA   r   r@      )fontsizeZ
xlabelsizeZ
ylabelsizer   r   rN   r_   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sJ d S )Nz
2012-01-01d   )periodsr   UTC)r   tzz1 days)r   bcrr   efbox)r   c                 S   s   g | ]}|  qS r   r!   r"   r   r   r   r%      r&   z@TestDataFramePlots.test_boxplot_numeric_data.<locals>.<listcomp>r   r   )r   r   r*   r+   r,   rI   astypestrr   r.   r/   )r1   r4   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   rT   r7   colorr6   r   )r   r*   r+   r,   rN   items	get_color)r1   Z
colors_kwdexpectedr4   rw   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sDJ qDd S )Nr   rT   r   r7   r{   )r   r*   r+   r,   r(   r)   styleZuser.   r   r   r   )r1   schemer   r4   r2   rw   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   sV   t tjdd}tjt|d |j|dd W d    n1 sH0    Y  d S )Nr   rT   ry   r7   r   )r   r*   r+   r,   r|   r}   r~   rN   )r1   Zdict_colorsr   r4   r   r   r   test_color_kwd_errors#  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f ddi|}|| d  dksJJ d S )	Nc                 S   s    i | ]}|t jd dqS )r   r'   )r*   r+   r,   )r#   r   r   r   r   
<dictcomp>8  r&   z?TestDataFramePlots.test_specified_props_kwd.<locals>.<dictcomp>ABCr   ZC1r6   r7   r   )r   rN   r   )r1   propsr   r4   Zkwdrw   r   r   r   test_specified_props_kwd-  s    z+TestDataFramePlots.test_specified_props_kwdvertTFc                 C   s~   t tjddtjddtjdddgdd}d\}}|jd|||d}| |ksjJ | |kszJ d S )	Nr   r'   group1group2r   r   groupr$   yr   )r   r   xlabelylabel)	r   r*   r+   r,   rI   r-   r.   
get_xlabel
get_ylabelr1   r   r4   r   r   r   r   r   r   test_plot_xlabel_ylabel>  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 |jj	|d |||d |D ]$}	|	
 |ksJ |	 |ksJ qtj  d S )Nr   r   r   )r   rA   sizeZABCDrW   r   )r'      T)Zncolsr   Zsharey)r   r   r   r   r   )r*   r+   r,   r   r   r0   r2   rb   r.   r   r   r   ra   r)   close)
r1   r   rngZdf1df2r   r   rd   Zaxsr   r   r   r   test_plot_boxL  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}| |kshJ | |ksxJ d S )Nr   r'   r   r   r   r   )r   r   r   )	r   r*   r+   r,   rI   r-   rN   r   r   r   r   r   r   test_boxplot_xlabel_ylabel\  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 ]$}| |ksrJ | |ks^J q^t	j
  d S )	Nr   r'   r   r   r   r   r   )r<   r   r   r   )r   r*   r+   r,   rI   r-   rN   r   r   ra   r)   r   )r1   r   r4   r   r   r   subplotr   r   r    test_boxplot_group_xlabel_ylabelj  s    z3TestDataFramePlots.test_boxplot_group_xlabel_ylabelc                 C   s   t tjddtjddtjdddgdd}|jd|d}|D ]*}|rb| n| }|t	dgksRJ qRt
j  d S )Nr   r'   r   r   r   r   )r<   r   )r   r*   r+   r,   rI   r-   rN   r   r   r   ra   r)   r   )r1   r   r4   r   r   Ztarget_labelr   r   r   #test_boxplot_group_no_xlabel_ylabelz  s    z6TestDataFramePlots.test_boxplot_group_no_xlabel_ylabel)"__name__
__module____qualname__r5   r|   markslowparametrizer^   rQ   rS   r`   rf   rj   rk   rt   rx   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   &   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>0    Y  tt|jddd	 d S )
Ngenderr]   FrH   rc   r{   r   )r   r   axes_numlayout)	rh   rL   rM   r^   r
   rN   r   r0   ro   r1   rv   groupedrc   r   r   r   rQ     s    ,z.TestDataFrameGroupByPlots.test_boxplot_legacy1c                 C   s.   |j dd}t|jddd}t|ddd d S )	Nr   r]   Frc   rb   r6   r   r   r   )rh   r
   rN   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 sv0    Y  tt|jddd d S )Nr'   r   r'   r   r   r   levelFrH   rc   r{   )rA   r   r   )ziprJ   rK   ranger   r*   r+   r,   r   from_tuplesrh   rL   rM   r^   r
   rN   r   r0   ro   r1   tuplesr4   r   rc   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   Frc   r   r   r   )r   rJ   rK   r   r   r*   r+   r,   r   r   rh   r
   rN   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 sv0    Y  t
j|dd  t|j|dd}	W d    n1 s0    Y  t|	||d d S )Nr'   r   r   r   z+DataFrame.groupby with axis=1 is deprecatedry   r   r   r   )r   ZaxisFrH   rc   r   r   )r   rJ   rK   r   r   r*   r+   r,   r   r   rL   rM   FutureWarningZunstackrh   r
   rN   r   )
r1   rb   rP   r   r   r   r4   r   r   rc   r   r   r   test_boxplot_legacy3  s    4$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sJ t	|dksJ td |jdd}t	t
j dksJ t	|dksJ d S )Nr'   r      r   r   <   malefemaler   r   r   r   allrc   r{   r   )r   r*   r+   r,   normalr-   r   rh   r.   rp   ra   r)   Zget_fignumsr2   r   rN   )r1   r3   r   r   r   r4   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,   r  r-   r   rh   hist)r1   r3   r   r   r   r4   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   r]   r   r   r   Zexpected_keys)rN   ru   r*   Zndarrayr	   r1   rv   r4   rw   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   r7   r{   ZMaleZFemaler
  rh   rN   r	   r  r   r   r   $test_grouped_box_return_type_groupby  s    z>TestDataFrameGroupByPlots.test_grouped_box_return_type_groupbyr6   r   c                 C   sL   |}| dj|d}t||g dd |jd|d}t||g dd d S )N	classroomr{   rY   rZ   r   r
  r<   r6   r	  r  )r1   rv   r6   r4   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   )r@   r   rW   zA Br   r   r{   r
  r  )	splitr   r*   r+   r,   rI   rh   rN   r	   )r1   r6   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   sP   |}d}t jt|d& |jddg|jdd W d    n1 sB0    Y  d S )Nz1Layout of 1x1 must be larger than required size 2ry   r   r   r   r8   r<   r   r|   r}   r~   rN   r   r1   rv   r4   r   r   r   r   !test_grouped_box_layout_too_small	  s    z;TestDataFrameGroupByPlots.test_grouped_box_layout_too_smallc                 C   sN   |}d}t jt|d$ |jg dddd W d    n1 s@0    Y  d S )Nz7The 'layout' keyword is not supported when 'by' is Nonery   r	  )r   r   r7   r8   r   r6   )r|   r}   r~   rN   r  r   r   r    test_grouped_box_layout_needs_by  s    z:TestDataFrameGroupByPlots.test_grouped_box_layout_needs_byc                 C   sP   |}d}t jt|d& |jddg|jdd W d    n1 sB0    Y  d S )Nz1At least one dimension of layout must be positivery   r   r   )r  r  r  r  r   r   r   'test_grouped_box_layout_positive_layout  s    zATestDataFrameGroupByPlots.test_grouped_box_layout_positive_layoutzgb_key, axes_num, rows)r   r   r   )r   rA   r   )r  r   r   c                 C   sf   |}t jtdd& t||jddd W d    n1 s>0    Y  ttj	 j
||dfd d S )NFrH   r   r7   r8   r6   r   r   rL   rM   r^   r
   rh   rN   r   ra   r)   gcfrc   )r1   rv   Zgb_keyr   rowsr4   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   rc   )r8   r<   r6   r   r   r   )visible)
rN   r   ra   r)   r   rc   r   r/   ZxaxisZ	get_label)r1   rv   r   r#  r4   rc   r   r   r   r   test_grouped_box_layout_visible3  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	  r7   r  r   r   r   rh   rN   r   ra   r)   r   rc   )r1   rv   r4   r   r   r   test_grouped_box_layout_shapeB  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 sD0    Y  ttj	 j
dd	d
 d S )NFrH   r   r   r   r7   r  rA   )r   r   r   r  )r1   rv   r'  r4   r   r   r   test_grouped_box_layout_worksJ  s    
$z7TestDataFrameGroupByPlots.test_grouped_box_layout_worksz	rows, resrA   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   )rN   r   ra   r)   r   rc   )r1   rv   r!  r  r4   r   r   r   'test_grouped_box_layout_axes_shape_rowsW  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   r7   r  r   r   r%  )r1   rv   r'  r  r4   r   r   r   /test_grouped_box_layout_axes_shape_cols_groupby`  s    
zITestDataFrameGroupByPlots.test_grouped_box_layout_axes_shape_cols_groupbyc                 C   sp   |}t tN tjdd\}}|djdd|d ttj	 j
ddd W d    n1 sb0    Y  d S )	Nr   r   r   rc   r8   r6   r   rA   r   r   )rL   rM   r^   ra   r)   rb   rh   rN   r   r   rc   )r1   rv   r4   rd   rc   r   r   r   test_grouped_box_multiple_axesk  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 sP0    Y  tt	|j
}t|ddd	 t||d  |d j|u sJ tt. |d
jg dd|d d}W d    n1 s0    Y  tt	|j
}t|ddd	 t||d  |d j|u s$J d S )Nr   r   r	  r   rc   r   )r8   r<   r6   r   )r   r   r   r  r   r+  )ra   r)   rb   rL   rM   r^   rN   r*   arrayr0   ro   r   Zassert_numpy_array_equalr   rh   )r1   rv   r4   ri   rc   r  r   r   r   %test_grouped_box_multiple_axes_on_figz  s*    $
$z?TestDataFrameGroupByPlots.test_grouped_box_multiple_axes_on_figc              	   C   s   |}d}t jt|d^ tjdd\}}tt" |	dj
|d}W d    n1 s\0    Y  W d    n1 sz0    Y  d S )Nz@The number of passed axes must be 3, the same as the output plotry   r   r   r  )r   )r|   r}   r~   ra   r)   rb   rL   rM   r^   rh   rN   )r1   rv   r4   r   ri   rc   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   )r<   r   r   r   r_   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))
r0  r6  r1  r7  r2  r8  r3  r9  r4  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szJ d S )Nr   Zabcder   )catr   r5  r;  Frc   )rb   r8   r6   c                 S   s   g | ]}|  qS r   r   r"   r   r   r   r%     r&   zQTestDataFrameGroupByPlots.test_groupby_boxplot_subplots_false.<locals>.<listcomp>)
r   r*   r+   r,   r-   r0   rh   r
   rN   r/   )r1   r   expected_xticklabelr4   r   rc   result_xticklabelr   r   r   #test_groupby_boxplot_subplots_false  s    (

z=TestDataFrameGroupByPlots.test_groupby_boxplot_subplots_falsec                 C   sX   | d}|d}d}tjt|d t|jdd W d    n1 sJ0    Y  d S )Nobjectr   z:boxplot method requires numerical columns, nothing to plotry   F)rb   )r   rh   r|   r}   r~   r
   rN   )r1   rv   r4   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sJ d S )N)r   r   bazrA  rG   rG   quxrB  )r9   r:   r9   r:   r9   r:   r9   r:   firstsecond)namesr   )r   r   r  rE   )r   r9   )r   r:   rc   r  z
(bar, one)z
(bar, two)c                 S   s   g | ]}|  qS r   r   r"   r   r   r   r%     r&   zLTestDataFrameGroupByPlots.test_boxplot_multiindex_column.<locals>.<listcomp>)r0   r   r   r   r   r*   r+   r,   rI   r
   rN   r/   )	r1   Zarraysr   r   r4   r   rc   r<  r=  r   r   r   test_boxplot_multiindex_column  s    z8TestDataFrameGroupByPlots.test_boxplot_multiindex_column)#r   r   r   rQ   r   r|   r   r   r`   r   r   r^   r   r  r  r  r  r  r  r  r  r  r"  r$  r&  r(  r)  r*  r,  r.  r/  r   r>  r@  rF  r   r   r   r   r     s   



	

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



	





&
r   )__doc__rl   rJ   numpyr*   r|   Zpandasr   r   r   r   r   r   Zpandas._testingZ_testingrL   Zpandas.tests.plotting.commonr   r	   r
   r   r   Zpandas.io.formats.printingr   Zimportorskipra   r2   r   r   r   r   r   r   r   <module>   s    

  f