
    X/ii6                        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 Zd Zd Zd Zd	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Z d Z!d Z"d Z#d Z$d Z%d Z&d Z'd  Z(d! Z)d" Z*y)#    N)Path)subprocess_run_for_testing)pyplotc           
         t        j                  dd       t        t        j                        j
                  d   dz  }|j                         st        j                  d       t        t        j                        j                         }| dz  }|j                  |d       t        t        j                  t        |      t        |      gd	
       |j                  d      }||k7  radj                  t!        j"                  |j%                  d      |j%                  d      dddd            }t        j&                  d|z         y y )Nblackz24.1)
minversion   ztools/boilerplate.pyzboilerplate.py not foundz	pyplot.pyzutf-8T)check
zfound pyplot.pyzexpected pyplot.pyr    )fromfiletofilen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difflibunified_diffsplitfail)tmp_path
gen_scriptorig_contentsplt_filenew_contentsdiff_msgs         R/srv/sistema/bot/venv/lib/python3.12/site-packages/matplotlib/tests/test_pyplot.pytest_pyplot_up_to_dater*      s   
F3cll#++A.1GGJ./&002M+%Hw/	Z#h-8 %%g.L$99  ##D)<+=+=d+C*+b	"# 	< ?G	G	
 %    c                 `   t         j                  j                  t         j                  dd      t         j                  j	                  t         j                  d      d
d              }t        j                  |      d
d       } |d         |d         |d d         |d d        | rJ t        j                  t         j                        5   |d 	       d d d        t        j                  t         j                        5   |d d        d d d        y # 1 sw Y   ?xY w# 1 sw Y   y xY w)Noldnewkwoc                      y N r.   r/   s     r)   funcz1test_copy_docstring_and_deprecators.<locals>.func.   s     	r+   c                      y r1   r2   r3   s     r)   wrapper_funcz9test_copy_docstring_and_deprecators.<locals>.wrapper_func3   s    r+   )r.   )r/   r3   )r-   r1   )
r   _apirename_parameter__version__make_keyword_onlyr   _copy_docstring_and_deprecatorsr   warnsMatplotlibDeprecationWarning)recwarnr4   r6   s      r)   #test_copy_docstring_and_deprecatorsr?   -   s    XXsu=XX7 8 > 	((. / T4 Tt$;	c66	7 	c66	7 !T4 ! ! ! !s   
D
D$D!$D-c                  f   t        j                         \  } }t        j                  d       |j                         rJ t        j                  d       |j                         sJ t        j                          |j                         rJ t        j                          |j                         sJ y )NFT)r   subplotsboxget_frame_on)figaxs     r)   test_pyplot_boxrF   B   sy    llnGCGGEN   GGDM??GGI   GGI??r+   c                  8    t        j                  g dg d       y )N)   r	      )r   	stackplotr2   r+   r)   test_stackplot_smokerK   N   s    MM)Y'r+   c                     t        j                  t              5  t        j                  d       d d d        t        j                  t              5  t        j                  d       d d d        y # 1 sw Y   BxY w# 1 sw Y   y xY w)NrH   )nrows)ncols)r   raises	TypeErrorr   subplotr2   r+   r)   test_nrows_errorrR   S   sa    	y	! !	y	! !   s   A2A>2A;>Bc                     t        j                          t        j                         sJ t        j                         5  t        j                         rJ 	 d d d        t        j                         sJ t        j                          t        j                         rJ t        j                         5  t        j                         rJ 	 d d d        t        j                         rJ y # 1 sw Y   xY w# 1 sw Y   ,xY wr1   )r   ionr   is_interactiveioffr2   r+   r)   	test_ioffrW   Z   s    GGI	 (%%''''(HHJ!!###	 (%%''''(!!####( (( (   C*3C6*C36C?c                     t        j                          t        j                         rJ t        j                         5  t        j                         sJ 	 d d d        t        j                         rJ t        j                          t        j                         sJ t        j                         5  t        j                         sJ 	 d d d        t        j                         sJ y # 1 sw Y   xY w# 1 sw Y   ,xY wr1   )r   rV   r   rU   rT   r2   r+   r)   test_ionrZ   h   s    HHJ!!###	 $!!###$!!###GGI	 $!!###$$ $$ $rX   c                  Z   t        j                          t        j                         5  t        j                         rJ t        j                         5  t        j                         sJ 	 d d d        t        j                         rJ 	 d d d        t        j                         sJ t        j                         5  t        j                         5  t        j                         rJ 	 d d d        d d d        t        j                         sJ t        j                         5  t        j                          d d d        t        j                         sJ t        j                          t        j                         5  t        j                         sJ t        j                         5  t        j                         rJ 	 d d d        t        j                         sJ 	 d d d        t        j                         rJ t        j                         5  t        j                         5  t        j                         sJ 	 d d d        d d d        t        j                         rJ t        j                         5  t        j                          d d d        t        j                         rJ y # 1 sw Y   DxY w# 1 sw Y   2xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   /xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY wr1   )r   rT   rV   r   rU   r2   r+   r)   test_nested_ion_ioffr\   v   sm   GGI 
 (%%'''WWY 	(%%'''	(%%''''	(
  
 ,XXZ 	,))++++	,, 	 
 HHJ 
 $!!###XXZ 	,))++++	,!!###	$
 !!### 
 (WWY 	(%%'''	(( !!###	 	!!####E	( 	(( (	, 	,, ,
 	, 	,$ $	( 	(( (
 s   +J;J.,J;=KK*K$K"?+K<*K/K<L(L	 L:L!.J8	3J;;KK	KK"K,/K9	4K<<L	L	LL!L*c                  |    	 t        j                  d       y # t        $ r} t        |       dk(  sJ Y d } ~ y d } ~ ww xY w)Ng?zQclose() argument must be a Figure, an int, a string, or None, not <class 'float'>)r   closerP   r   )es    r)   
test_closer`      sD    B		# B1v B B 	B BBs    	;6;c                     t        j                  d      } | t        j                         u sJ t        j                  d      }|t        j                         u sJ t        j                  d      }| t        j                         u sJ | |u sJ y )Ny   z   )r   rQ   gcaax1ax2ax3s      r)   test_subplot_reuseri      st    
++c
C#'')
++c
C#'')
++c
C#'')#::r+   c                  N   t        j                          t        j                         } t        j                         }| J || usJ t        j                          t        j                          t        j                  d      } t        j                  d      }| J || usJ t        j                          t        j                          t        j                  d      } t        j                         }| J |j                  dk(  sJ || usJ t        j                          y )Npolar
projectionrectilinear)r   figureaxesr^   namerE   rf   s     r)   test_axes_kwargsrs      s    JJL	B
((*C>>b==IIKJJL	W	%B
((g
&C>>b==IIKJJL	W	%B
((*C>>88}$$$b==IIKr+   c                     t        j                         } t        j                  ddd      }t        j                  ddd      }t        j                  ddd      }t        j                  dddd      }t        j                  dddd      }|J ||u sJ ||usJ ||usJ ||u sJ || j                  v sJ || j                  v sJ || j                  v sJ |j                  dk(  sJ |j                  dk(  sJ |j                  dk(  sJ y )NrH   r	   rk   rl   rn   )r   ro   rQ   rp   rq   )rD   rE   rf   rg   rh   ax4s         r)   test_subplot_replace_projectionrv      s    **,C	Q1	B
++aA
C
++aA
C
++aA'
2C
++aA'
2C>>"99b==b==#::>>#((??#((??77m###88}$$$88wr+   c                  
   t        j                  dd      } t        j                  dd      }| |u sJ | j                          t        j                  dd      }| |usJ | t        j                         j                  vsJ y )Nrk   r   )rm   theta_offsetrH   )r   rQ   removegcfrp   re   s      r)   test_subplot_kwarg_collisionr{      sk    
++q
9C
++q
9C#::JJL
++q
9Cc>>cgginn$$$r+   c                      t        j                          t        j                         } t        j                         }| J || u sJ t        j                          y r1   )r   ro   rd   r^   rr   s     r)   test_gcar}      s@    JJL	B
'')C>>"99IIKr+   c                  R   t        j                  d      } | t        j                         u sJ | t        j                  d      u sJ | j                          t        j                  dd      }|t        j                         u sJ | t        j                         j
                  vsJ |t        j                  d      u sJ |j                          t        j                  dd      }|t        j                         u sJ ||usJ |t        j                         j
                  vsJ y )No   rk   rl   rn   )r   rQ   rd   ry   rz   rp   re   s      r)   test_subplot_projection_reuser      s    
++c
C#'')#++c""""JJL
++cg
.C#'')cgginn$$$#++c""""JJL ++cm
4C#'')c>>cgginn$$$r+   c                  8   t        j                  dd      } t        j                  dd      }t        j                  ddd      }| |u sJ | |u sJ t        j                  t        d      5  t        j                  ddd	      }d d d        y # 1 sw Y   y xY w)
Nr   rk   rl   T)rk   )rk   rm   zpolar=True, yet projection='3d'match3d)r   rQ   r   rO   
ValueErrorre   s      r)    test_subplot_polar_normalizationr     s    
++cg
.C
++c
&C
++c'
:C#::#::	z>
@ <kk#Td;< < <s   .BBc                  l   t               } t        j                         }| j                  |       d}|D ]b  }|j	                          t        j                  |      }|t        j                         u sJ |j
                  |k(  sJ | j                  |       d t        |       dt        |      z   k(  sJ y )N)aitoffhammerlambert	mollweiderk   rn   r   rl   rH   )setr   rQ   addry   rq   len)created_axesrE   projectionsprojs       r)   test_subplot_change_projectionr     s    5L	BR1K 
		[[D)S[[]"""ww$ |C$4 4444r+   c                  4   t        j                  ddd      \  } t        | t        j                  j
                        sJ t        j                  ddd      \  }t        |t        j                  j
                        sJ | j                  |j                  u sJ y )Ng        g      ?rogQ?      ?bo)r   rk   
isinstancer   linesLine2Drp   )ln1ln2s     r)   test_polar_second_callr   .  st    99RT"DCc399++,,,99T2t$DCc399++,,,88sxxr+   c                     t        j                  g d      } t        j                  g d      }t        j                  j	                  |j
                  j                         | j
                  j                                t        j                  g d      } t        j                  g dg d      }t        j                  j	                  |j
                  j                         | j
                  j                                y )N)皙?r   r   r   )position)皙?r   皙?r   )r   rp   nptestingassert_allclosebbox
get_points)axrefaxtests     r)   test_fallback_positionr   8  s    HH)*EXX34FJJv{{557$zz4468 HH)*EXX*5IJFJJv{{557$zz4468r+   c                     t        j                         } | j                  d      }t        j                          t        j                         | k7  sJ t        j                  |d         }t        j                         | k(  sJ || k(  sJ y )Nr	   rH   )r   ro   
subfiguresrz   )fig1subfigscurrents      r)   %test_set_current_figure_via_subfigurer   F  sj    ::<Dooa GJJL779jj$G779d??r+   c                  4   t        j                         } | j                  d      }|d   j                  dd      }|d   j                  dd       t        j                         |k7  sJ t        j
                  |       t        j                         |k(  sJ y )Nr	   r   rH   T)squeeze)r   ro   r   rA   rd   sca)rD   r   rE   s      r)   "test_set_current_axes_on_subfigurer   R  sz    
**,CnnQG			Q		-BAJ4(779??GGBK779??r+   c                      t        j                  d      } t        j                  j	                  | j
                  dddj                  d      d       y )NIPythonz--pylabz-c;)zimport matplotlib.pyplot as pltz<assert plt._REPL_DISPLAYHOOK == plt._ReplDisplayHook.IPYTHON<   )timeout)r   r   r   r   subprocess_run_helperstart_ipythonr   )r   s    r)   test_pylab_integrationr   ^  sN    !!),GKK%% 
 	  & 	r+   c                     t        t              j                  dz  } | j                         st	        j
                  d       d }| j                         j                  d      }t         ||            }t        t        j                               }|j                  |      }|rt        d|      |j                  |      }|rt        d|      y)z6Test that pyplot_summary lists all the plot functions.z#../../../doc/api/pyplot_summary.rstz#Documentation sources not availablec                     g }d}| D ]b  }|s|j                  d      sd}|r|j                  d      r.|d   j                         sd}D|j                  |j                                d |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)r   	functionsin_autosummarylines       r)   extract_documented_functionsz=test_doc_pyplot_summary.<locals>.extract_documented_functionsr  su      	 	/D!??#56%)Ntv6Aw(%*N  .	/ r+   r   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   _get_pyplot_commands
differenceAssertionError)pyplot_docsr   r   doc_functionsplot_commandsmissingextras          r)   test_doc_pyplot_summaryr   l  s    x.''*OOK9:B !!#))$/E4U;<M0023M&&}5GMk 	 $$]3ECCH)MN 	N r+   c                     t        j                          t        j                  t        j                  dd             t        j
                  d      \  } }t        j                  |t        j                  g t        j                        k(        sJ |g k(  sJ t        j                  ddgdd	gd
       t        j                         }|j                  d      } |j                  d      }t        j                  | t        j                  ddg      k(        sJ |D cg c]  }|j                          c}dd	gk(  sJ y c c}w )NrH   
   T)minor)dtypeg      @g      @ab)tickslabelsr   )r   ro   plotr   arangexticksallarrayfloat64yticksrd   
get_yticksget_yticklabelsget_text)tick_postick_labelsrE   ls       r)   test_minor_ticksr     s    JJLHHRYYq"JJT2Hk66+"BJJ!??@@@"JJc3Zc
$?	B}}4}(H$$4$0K66(bhhSz22333"-.QAJJL.3*<<<.s   "Ec                     t        j                  d       t        j                         } t        j                         } t        t        j                               dk(  sJ t        j                  d       t        t        j                               dk(  sJ t        j                  d       t        t        j                               dk(  sJ y )Naggr	   svg)r   switch_backendro   r   get_fignums)rD   s    r)   test_switch_backend_no_closer     s    u
**,C
**,Cs !Q&&&us !Q&&&us !Q&&&r+   c                     d| _         y )NT)_test_was_here)ro   s    r)   figure_hook_exampler     s
     Fr+   c                      ddgi} t        j                  |       5  t        j                         }d d d        j                  sJ y # 1 sw Y   xY w)Nzfigure.hooksz0matplotlib.tests.test_pyplot:figure_hook_example)r   
rc_contextr   ro   r   )test_rcrD   s     r)   test_figure_hookr     sS     	KLG 
	  jjl  s   AAc                     t        j                  dd      } t        j                  t        d      5  t        j                  dt        j                  ddg            }d d d        t        j                  t        d      5  t        j                  | t        j                  dd	g             d d d        | u sJ t        j                  d      }| |u sJ y # 1 sw Y   {xY w# 1 sw Y   7xY w)
NrH   )rH   r	   )figsizez)Ignoring specified arguments in this callr   rI            )r   ro   r   r<   UserWarningr   r   )rD   fig2fig3s      r)   test_multiple_same_figure_callsr     s    
**Q
'C	k)T	U 7zz!RXXq!f%567	k)T	U 2

3!Q 012$;;::a=D$;;7 72 2s   -C-C&C#&C/c                      t        j                         } t        j                  t        d      5  t        j                  d      }d d d        y # 1 sw Y   y xY w)Nzcloses all existing figuresr   r   )r   ro   r   r<   r   )r   r   s     r)   test_close_all_warningr     sA    ::<D 
k)F	G !zz% ! ! !s   AAc                  ~    t        j                         } ddgddgg}t        j                  || j                         y )Nr   rH   r	   )fignum)r   ro   matshownumber)rD   arrs     r)   test_matshowr    s3    
**,Cq6Aq6
C KKCJJ'r+   )+r   numpyr   r   pathlibr   r   
matplotlibr   matplotlib.testingr   r   r   r*   r?   rF   rK   rR   rW   rZ   r\   r`   ri   rs   rv   r{   r}   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r2   r+   r)   <module>r     s      
    9 $
>!*	(
$ )$XB20%%2	<5  8		5Np='!!(r+   