o
    ji6                     @   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'd( Zd)d* Zd+d, Z d-d. Z!d/d0 Z"d1d2 Z#d3d4 Z$d5d6 Z%d7d8 Z&d9d: Z'd;d< Z(d=d> Z)d?d@ Z*dS )A    N)Path)subprocess_run_for_testing)pyplotc              
   C   s   t jddd ttjjd d }| st d ttj	 }| d }|
|d ttjt|t|gd	d
 |	d}||kr_dtj|d|dddddd}t d|  d S d S )Nblackz24.1)Z
minversion   ztools/boilerplate.pyzboilerplate.py not foundz	pyplot.pyzutf-8T)check
zfound pyplot.pyzexpected pyplot.pyr    )fromfiletofilenZlinetermzpyplot.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)pytestimportorskipr   mpl__file__parentsexistsskipplt	read_text
write_textr   sys
executablestrjoindifflibZunified_diffsplitZfail)Ztmp_pathZ
gen_scriptZorig_contentsZplt_fileZnew_contentsZdiff_msg r   ]/var/www/html/Deteccion_Ine/venv/lib/python3.10/site-packages/matplotlib/tests/test_pyplot.pytest_pyplot_up_to_date   s6   

r   c                 C   s   t jt jddt jt jdddd}t|ddd}|d  |d d |d d d	 |d d d
 | r9J tt j	 |d d W d    n1 sOw   Y  tt j	 |d d  W d    d S 1 skw   Y  d S )Noldnewkwoc                 S      d S Nr   r!   r"   r   r   r   func.   s   z1test_copy_docstring_and_deprecators.<locals>.funcc                 S   r#   r$   r   r%   r   r   r   wrapper_func3   s   z9test_copy_docstring_and_deprecators.<locals>.wrapper_func)r!   )r"   r%   )r    r$   )
r   Z_apiZrename_parameter__version__Zmake_keyword_onlyr   Z_copy_docstring_and_deprecatorsr   warnsZMatplotlibDeprecationWarning)Zrecwarnr&   r'   r   r   r   #test_copy_docstring_and_deprecators-   s    
"r*   c                  C   sd   t  \} }t d | rJ t d | sJ t   | r&J t   | s0J d S )NFT)r   subplotsboxZget_frame_on)figaxr   r   r   test_pyplot_boxB   s   

r/   c                   C   s   t g dg d d S )N)   r      )r   Z	stackplotr   r   r   r   test_stackplot_smokeN   s   r2   c                   C   sr   t t tjdd W d    n1 sw   Y  t t tjdd W d    d S 1 s2w   Y  d S )Nr0   )Znrows)Zncols)r   raises	TypeErrorr   subplotr   r   r   r   test_nrows_errorS   s   "r6   c                   C   s   t   t s
J t   t rJ W d    n1 sw   Y  t s*J t   t r4J t   t r?J W d    n1 sIw   Y  t rTJ d S r$   )r   ionr   is_interactiveioffr   r   r   r   	test_ioffZ      

r:   c                   C   s   t   t r
J t   t sJ W d    n1 sw   Y  t r*J t   t s4J t   t s?J W d    n1 sIw   Y  t sTJ d S r$   )r   r9   r   r8   r7   r   r   r   r   test_ionh   r;   r<   c                	   C   sd  t   t  . t rJ t   t sJ W d    n1 s$w   Y  t r/J W d    n1 s9w   Y  t sDJ t  " t   t rTJ W d    n1 s^w   Y  W d    n1 smw   Y  t sxJ t   t   W d    n1 sw   Y  t sJ t   t  . t sJ t   t rJ W d    n1 sw   Y  t sJ W d    n1 sw   Y  t rJ t  " t   t sJ W d    n1 sw   Y  W d    n	1 sw   Y  t rJ t   t   W d    n	1 s$w   Y  t r0J d S r$   )r   r7   r9   r   r8   r   r   r   r   test_nested_ion_ioffv   sP   











r=   c               
   C   sH   zt d W d S  ty# }  zt| dksJ W Y d } ~ d S d } ~ ww )Ng?zQclose() argument must be a Figure, an int, a string, or None, not <class 'float'>)r   closer4   r   )er   r   r   
test_close   s   r@   c                  C   s^   t d} | t  u sJ t d}|t  u sJ t d}| t  u s'J | |u s-J d S )Ny   z   )r   r5   gcaax1ax2ax3r   r   r   test_subplot_reuse   s   


rH   c                  C   s   t   t  } t  }| d usJ || usJ t   t   t jdd} t jdd}| d us2J || us8J t   t   t jdd} t  }| d usPJ |jdksWJ || us]J t   d S )Npolar
projectionrectilinear)r   figureaxesr>   namer.   rE   r   r   r   test_axes_kwargs   s&   rQ   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 us1J ||u s7J ||us=J ||usCJ ||u sIJ || jv sPJ || jv sWJ || jv s^J |jdkseJ |jdkslJ |jdkssJ d S )Nr0   r   rI   rJ   rL   )r   rM   r5   rN   rO   )r-   r.   rE   rF   rG   Zax4r   r   r   test_subplot_replace_projection   s"   rR   c                  C   s`   t jddd} t jddd}| |u sJ |   t jddd}| |us%J | t  jvs.J d S )NrI   r   )rK   Ztheta_offsetr0   )r   r5   removegcfrN   rD   r   r   r   test_subplot_kwarg_collision   s   rU   c                  C   s<   t   t  } t  }| d usJ || u sJ t   d S r$   )r   rM   rC   r>   rP   r   r   r   test_gca   s   rV   c                  C   s   t d} | t  u sJ | t du sJ |   t jddd}|t  u s)J | t  jvs2J |t du s;J |  t jddd}|t  u sNJ ||usTJ |t  jvs]J d S )No   rI   rJ   rL   )r   r5   rC   rS   rT   rN   rD   r   r   r   test_subplot_projection_reuse   s   
rX   c                  C   s   t jddd} t jddd}t jdddd}| |u sJ | |u s"J tjtdd t jddd	d}W d    d S 1 s=w   Y  d S )
NrW   rI   rJ   T)rI   )rI   rK   zpolar=True, yet projection='3d'match3d)r   r5   r   r3   
ValueErrorrD   r   r   r    test_subplot_polar_normalization  s   "r]   c                  C   s~   t  } t }| | d}|D ] }|  tj|d}|t u s$J |j|ks+J | | qt| dt| ks=J d S )N)ZaitoffhammerZlambertZ	mollweiderI   rL   r[   rJ   r0   )setr   r5   addrS   rO   len)Zcreated_axesr.   ZprojectionsZprojr   r   r   test_subplot_change_projection  s   
rb   c                  C   sX   t ddd\} t| tjjsJ t ddd\}t|tjjs"J | j|ju s*J d S )Ng        g      ?rogQ?      ?Zbo)r   rI   
isinstancer   linesZLine2DrN   )Zln1Zln2r   r   r   test_polar_second_call.  s
   rg   c                  C   sz   t g d} t jg dd}tj|j | j  t g d} t jg dg dd}tj|j | j  d S )N)皙?rh   rd   rd   )position)皙?rj   皙?rk   )r   rN   nptestingZassert_allcloseZbboxZ
get_points)ZaxrefZaxtestr   r   r   test_fallback_position8  s   rn   c                  C   sX   t  } | d}t   t  | ksJ t |d }t  | ks$J || ks*J d S )Nr   r0   )r   rM   
subfiguresrT   )fig1subfigscurrentr   r   r   %test_set_current_figure_via_subfigureF  s   
rs   c                  C   sd   t  } | d}|d jddd}|d jddd t  |ks#J t | t  |ks0J d S )Nr   r   r0   T)Zsqueeze)r   rM   ro   r+   rC   Zsca)r-   rq   r.   r   r   r   "test_set_current_axes_on_subfigureR  s   

rt   c                  C   s,   t d} tjj| jdddddd d S )NIPythonz--pylabz-c;)zimport matplotlib.pyplot as pltz<assert plt._REPL_DISPLAYHOOK == plt._ReplDisplayHook.IPYTHON<   )timeout)r   r   r   rm   Zsubprocess_run_helperZstart_ipythonr   )ru   r   r   r   test_pylab_integration^  s   

ry   c                  C   s   t tjd } |  std dd }|  d}t||}tt	
 }||}|r5td|||}|rCtd|dS )	z6Test that pyplot_summary lists all the plot functions.z#../../../doc/api/pyplot_summary.rstz#Documentation sources not availablec                 S   sZ   g }d}| D ]$}|s| drd}q|r| drq|d  s#d}q||  q|S )ae  
        Return a list of all the functions that are mentioned in the
        autosummary blocks contained in *lines*.

        An autosummary block looks like this::

            .. autosummary::
               :toctree: _as_gen
               :template: autosummary.rst
               :nosignatures:

               plot
               plot_date

        Fz.. autosummary::Tz   :r   )
startswithisspaceappendstrip)rf   Z	functionsZin_autosummaryliner   r   r   extract_documented_functionsr  s   
z=test_doc_pyplot_summary.<locals>.extract_documented_functionsr   zsThe following pyplot functions are not listed in the documentation. Please add them to doc/api/pyplot_summary.rst: zThe following functions are listed in the pyplot documentation, but they do not exist in pyplot. Please remove them from doc/api/pyplot_summary.rst: N)r   r   parentr   r   r   r   r   r_   r   Z_get_pyplot_commands
differenceAssertionError)Zpyplot_docsr   rf   Zdoc_functionsZplot_commandsmissingextrar   r   r   test_doc_pyplot_summaryl  s,   
!

r   c                  C   s   t   t tdd t jdd\} }t|tjg tjdks$J |g ks*J t j	ddgdd	gdd
 t 
 }|jdd} |jdd}t| tddgksTJ dd |D dd	gksaJ d S )Nr0   
   T)minor)Zdtypeg      @g      @ab)Ztickslabelsr   c                 S   s   g | ]}|  qS r   )Zget_text).0lr   r   r   
<listcomp>  s    z$test_minor_ticks.<locals>.<listcomp>)r   rM   Zplotrl   ZarangeZxticksallarrayZfloat64ZyticksrC   Z
get_yticksZget_yticklabels)Ztick_posZtick_labelsr.   r   r   r   test_minor_ticks  s   r   c                  C   sn   t d t  } t  } tt  dksJ t d tt  dks&J t d tt  dks5J d S )NZaggr   svg)r   Zswitch_backendrM   ra   Zget_fignums)r-   r   r   r   test_switch_backend_no_close  s   


r   c                 C   s
   d| _ d S )NT)_test_was_here)rM   r   r   r   figure_hook_example  s   
r   c                  C   sJ   ddgi} t |  t }W d    n1 sw   Y  |js#J d S )Nzfigure.hooksz0matplotlib.tests.test_pyplot:figure_hook_example)r   Z
rc_contextr   rM   r   )Ztest_rcr-   r   r   r   test_figure_hook  s   
r   c                  C   s   t jddd} tjtdd t jdtddgd}W d    n1 s%w   Y  tjtdd t j| tdd	gd W d    n1 sHw   Y  | |u sSJ t d}| |u s^J d S )
Nr0   )r0   r   )Zfigsizez)Ignoring specified arguments in this callrY   r1            )r   rM   r   r)   UserWarningrl   r   )r-   fig2Zfig3r   r   r   test_multiple_same_figure_calls  s   
r   c                  C   sF   t  } tjtdd t d}W d    d S 1 sw   Y  d S )Nzcloses all existing figuresrY   r   )r   rM   r   r)   r   )rp   r   r   r   r   test_close_all_warning  s   "r   c                  C   s,   t  } ddgddgg}t j|| jd d S )Nr   r0   r   )Zfignum)r   rM   Zmatshownumber)r-   Zarrr   r   r   test_matshow  s   r   )+r   numpyrl   r   pathlibr   r   Z
matplotlibr   Zmatplotlib.testingr   r   r   r   r*   r/   r2   r6   r:   r<   r=   r@   rH   rQ   rR   rU   rV   rX   r]   rb   rg   rn   rs   rt   ry   r   r   r   r   r   r   r   r   r   r   r   r   <module>   sL    ,



8