U
    \	¸aÔ!  ã                   @   sØ   d dl Z d dlZd dlZd dlmZ d dlZd dlZd dlmZ	 d dl
m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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dS )'é    N)ÚPath)Úpyplot)ÚMatplotlibDeprecationWarningc              
   C   s´   t tjƒjd d }| ¡ s&t d¡ t tjƒ ¡ }|  	d¡}| 
|d¡ tjtjt|ƒt|ƒgdd | d¡}||kr°d 	tj| d¡| d¡d	d
ddd¡}t d| ¡ d S )Né   ztools/boilerplate.pyzboilerplate.py not foundz	pyplot.pyzutf-8T)ÚcheckÚ
zfound pyplot.pyzexpected pyplot.pyr   Ú )ZfromfileZtofileÚnZlinetermzøpyplot.py is not up-to-date. Please run 'python tools/boilerplate.py' to update pyplot.py. This needs to be done from an environment where your current working copy is installed (e.g. 'pip install -e'd). Here is a diff of unexpected differences:
%s)r   ÚmplÚ__file__ÚparentsÚexistsÚpytestÚskipÚpltÚ	read_textÚjoinÚ
write_textÚ
subprocessÚrunÚsysÚ
executableÚstrÚdifflibZunified_diffÚsplitZfail)ZtmpdirZ
gen_scriptZorig_contentsZplt_fileZnew_contentsZdiff_msg© r   ú@/tmp/pip-unpacked-wheel-wjyw_3jo/matplotlib/tests/test_pyplot.pyÚtest_pyplot_up_to_date   s4    

ÿ
  üÿüÿr   c              	   C   s²   t j ddd¡t j dd¡ddd„ƒƒ}t |¡ddd„ƒ}|d ƒ |d d	 |d d d
 |d d d | rnt‚t t	¡ |d d W 5 Q R X t t	¡ |d d ƒ W 5 Q R X d S )Nz	(version)ÚoldÚnewÚkwoc                 S   s   d S ©Nr   ©r   r    r   r   r   Úfunc*   s    z1test_copy_docstring_and_deprecators.<locals>.funcc                 S   s   d S r!   r   r"   r   r   r   Úwrapper_func/   s    z9test_copy_docstring_and_deprecators.<locals>.wrapper_func)r   )r    r"   )r   )N)N)
r
   Z_apiZrename_parameterZmake_keyword_onlyr   Z_copy_docstring_and_deprecatorsÚAssertionErrorr   Úwarnsr   )Zrecwarnr#   r$   r   r   r   Ú#test_copy_docstring_and_deprecators)   s    
r'   c                  C   sd   t  ¡ \} }t  d¡ | ¡ r"t‚t  d¡ | ¡ s8t‚t  ¡  | ¡ rLt‚t  ¡  | ¡ s`t‚d S )NFT)r   ZsubplotsZboxZget_frame_onr%   )ÚfigÚaxr   r   r   Útest_pyplot_box>   s    

r*   c                   C   s   t  dddgdddg¡ d S )Né   r   é   )r   Z	stackplotr   r   r   r   Útest_stackplot_smokeJ   s    r-   c                	   C   sH   t  t¡ tjdd W 5 Q R X t  t¡ tjdd W 5 Q R X d S )Nr+   )Znrows)Zncols)r   ÚraisesÚ	TypeErrorr   Úsubplotr   r   r   r   Útest_nrows_errorO   s    r1   c                	   C   s„   t  ¡  t ¡ st‚t  ¡  t ¡ r*t‚W 5 Q R X t ¡ s@t‚t  ¡  t ¡ rTt‚t  ¡  t ¡ rjt‚W 5 Q R X t ¡ r€t‚d S r!   )r   Úionr
   Úis_interactiver%   Úioffr   r   r   r   Ú	test_ioffV   s    

r5   c                	   C   s„   t  ¡  t ¡ rt‚t  ¡  t ¡ s*t‚W 5 Q R X t ¡ r@t‚t  ¡  t ¡ sTt‚t  ¡  t ¡ sjt‚W 5 Q R X t ¡ s€t‚d S r!   )r   r4   r
   r3   r%   r2   r   r   r   r   Útest_iond   s    

r6   c                
   C   sž  t  ¡  t  ¡ > t ¡ rt‚t  ¡  t ¡ s4t‚W 5 Q R X t ¡ rJt‚W 5 Q R X t ¡ s`t‚t  ¡ & t  ¡  t ¡ r€t‚W 5 Q R X W 5 Q R X t ¡ s t‚t  ¡  t  ¡  W 5 Q R X t ¡ sÈt‚t  ¡  t  ¡ @ t ¡ sæt‚t  ¡  t ¡ rüt‚W 5 Q R X t ¡ st‚W 5 Q R X t ¡ r,t‚t  ¡ ( t  ¡  t ¡ sNt‚W 5 Q R X W 5 Q R X t ¡ rpt‚t  ¡  t  ¡  W 5 Q R X t ¡ ršt‚d S r!   )r   r2   r4   r
   r3   r%   r   r   r   r   Útest_nested_ion_ioffr   s8    



 




"
r7   c               
   C   sF   zt  d¡ W n2 tk
r@ }  zt| ƒdks0t‚W 5 d } ~ X Y nX d S )Ngš™™™™™ñ?zQclose() argument must be a Figure, an int, a string, or None, not <class 'float'>)r   Úcloser/   r   r%   )Úer   r   r   Ú
test_closež   s    r:   c                  C   s^   t  d¡} | t  ¡ kst‚t  d¡}|t  ¡ ks4t‚t  d¡}| t  ¡ ksNt‚| |ksZt‚d S )Néy   éz   )r   r0   Úgcar%   ©Úax1Úax2Úax3r   r   r   Útest_subplot_reuse¦   s    


rB   c                  C   sÆ   t  ¡  t  ¡ } t  ¡ }| d k	s$t‚|| k	s0t‚t  ¡  t  ¡  t jdd} t jdd}| d k	sdt‚|| k	spt‚t  ¡  t  ¡  t jdd} t  ¡ }| d k	s t‚|jdks®t‚|| k	sºt‚t  ¡  d S )NÚpolar©Ú
projectionÚrectilinear)r   ÚfigureÚaxesr%   r8   Úname©r)   r?   r   r   r   Útest_axes_kwargs°   s&    rK   c                  C   sê   t  ¡ } t  ddd¡}t  ddd¡}t  ddd¡}t jddddd}t jddddd}|d k	sbt‚||ksnt‚||k	szt‚||k	s†t‚||ks’t‚|| jks t‚|| jks®t‚|| jks¼t‚|jdksÊt‚|jdksØt‚|jdksæt‚d S )Nr+   r   rC   rD   rF   )r   rG   r0   r%   rH   rI   )r(   r)   r?   r@   rA   Zax4r   r   r   Útest_subplot_replace_projectionÉ   s"    rL   c                  C   sX   t jddd} t jddd}| |ks(t‚t jddd}| |k	sBt‚| t  ¡ jksTt‚d S )NrC   r   )rE   Ztheta_offsetr+   )r   r0   r%   ÚgcfrH   r>   r   r   r   Útest_subplot_kwarg_collisionâ   s    rN   c               	   C   s  t  ¡  t  ¡ } t  ¡ }| d k	s$t‚|| ks0t‚t  ¡  t  ¡  tjtdd t jdd} W 5 Q R X t  ¡ }| d k	szt‚|| ks†t‚|jdks”t‚t  ¡  t  ¡  t  ¡ } tjtdd t jdd}W 5 Q R X | d k	sÞt‚|| ksêt‚|jdksøt‚t  ¡  d S )Nz5Calling gca\(\) with keyword arguments was deprecated©ÚmatchrC   rD   rF   )	r   rG   r=   r%   r8   r   r&   r   rI   rJ   r   r   r   Útest_gca_kwargsë   s8    þþrQ   c                  C   s®   t  d¡} | t  ¡ kst‚| t  d¡ks,t‚t jddd}|t  ¡ ksJt‚| t  ¡ jks\t‚|t  d¡ksnt‚t jddd}|t  ¡ ksŒt‚||k	s˜t‚|t  ¡ jksªt‚d S )Néo   rC   rD   rF   )r   r0   r=   r%   rM   rH   r>   r   r   r   Útest_subplot_projection_reuse  s    
rS   c               	   C   sr   t jddd} t jddd}t jdddd}| |ks8t‚| |ksDt‚tjtdd t jddd	d}W 5 Q R X d S )
NrR   rC   rD   T)rC   )rC   rE   zpolar=True, yet projection='3d'rO   Ú3d)r   r0   r%   r   r.   Ú
ValueErrorr>   r   r   r   Ú test_subplot_polar_normalization#  s    ÿrV   c                  C   sT   t  ¡ } d}|D ]>}t j|d}|t  ¡ ks0t‚|j|ks>t‚| |k	sJt‚|} qd S )N)ZaitoffZhammerZlambertZ	mollweiderC   rF   rT   rD   )r   r0   r%   rI   )r)   ZprojectionsZprojZax_nextr   r   r   Útest_subplot_change_projection/  s    rW   )r   r   r   Úpathlibr   r   Z
matplotlibr
   r   r   Zmatplotlib.cbookr   r   r'   r*   r-   r1   r5   r6   r7   r:   rB   rK   rL   rN   rQ   rS   rV   rW   r   r   r   r   Ú<module>   s0   ,
	"