
    EVf3                         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'y)     N)Path)subprocess_run_for_testing)pyplotc           
         t        j                  d       t        t        j                        j
                  d   dz  }|j                         st        j                  d       t        t        j                        j                         }| j                  d      }|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black   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join
write_textr   sys
executablestrdifflibunified_diffsplitfail)tmpdir
gen_scriptorig_contentsplt_filenew_contentsdiff_msgs         e/var/www/html/software/conda/envs/catlas/lib/python3.12/site-packages/matplotlib/tests/test_pyplot.pytest_pyplot_up_to_dater)      s   
 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                  ddd      t         j                  j                  d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)Nz	(version)oldnewkwoc                      y N r-   r.   s     r(   funcz1test_copy_docstring_and_deprecators.<locals>.func.   s     	r*   c                      y r0   r1   r2   s     r(   wrapper_funcz9test_copy_docstring_and_deprecators.<locals>.wrapper_func3   s    r*   )r-   )r.   r2   )r,   r0   )	r   _apirename_parametermake_keyword_onlyr   _copy_docstring_and_deprecatorsr   warnsMatplotlibDeprecationWarning)recwarnr3   r5   s      r(   #test_copy_docstring_and_deprecatorsr=   -   s    XX{E59XXU3 4 : 	((. / T4 Tt$;	c66	7 	c66	7 !T4 ! ! ! !s   4
C<)
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_boxrD   B   sy    llnGCGGEN   GGDM??GGI   GGI??r*   c                  8    t        j                  g dg d       y )N)   r      )r   	stackplotr1   r*   r(   test_stackplot_smokerI   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)NrF   )nrows)ncols)r   raises	TypeErrorr   subplotr1   r*   r(   test_nrows_errorrP   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r0   )r   ionr   is_interactiveioffr1   r*   r(   	test_ioffrU   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r0   )r   rT   r   rS   rR   r1   r*   r(   test_ionrX   h   s    HHJ!!###	 $!!###$!!###GGI	 $!!###$$ $$ $rV   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r0   )r   rR   rT   r   rS   r1   r*   r(   test_nested_ion_ioffrZ   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   closerN   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   rO   gcaax1ax2ax3s      r(   test_subplot_reuserg      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rC   rd   s     r(   test_axes_kwargsrq      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 )NrF   r   ri   rj   rl   )r   rm   rO   rn   ro   )rB   rC   rd   re   rf   ax4s         r(   test_subplot_replace_projectionrt      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 )Nri   r   )rk   theta_offsetrF   )r   rO   removegcfrn   rc   s      r(   test_subplot_kwarg_collisionry      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 r0   )r   rm   rb   r\   rp   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   ri   rj   rl   )r   rO   rb   rw   rx   rn   rc   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}   ri   rj   T)ri   )ri   rk   zpolar=True, yet projection='3d')match3d)r   rO   r   rM   
ValueErrorrc   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	mollweideri   rl   r   rj   rF   )setr   rO   addrw   ro   len)created_axesrC   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   ri   
isinstancer   linesLine2Drn   )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   rn   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   rF   )r   rm   
subfiguresrx   )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   rF   T)squeeze)r   rm   r   r?   rb   sca)rB   r   rC   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 )NrF   
   T)minor)dtypeg      @g      @ab)tickslabelsr   )r   rm   plotr   arangexticksallarrayfloat64yticksrb   
get_yticksget_yticklabelsget_text)tick_postick_labelsrC   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                  t        j                        5  t        j                  d       d d d        t        t        j                               dk(  sJ y # 1 sw Y   ,xY w)Naggr   svgr   )	r   switch_backendrm   r   get_fignumsr   r:   r   r;   )rB   s    r(   test_switch_backend_no_closer     s    u
**,C
**,Cs !Q&&&us !Q&&&	c66	7 "5!"s !Q&&&" "s   :C;;Dc                     d| _         y )NT)_test_was_here)rm   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   rm   r   )test_rcrB   s     r(   test_figure_hookr     sS     	KLG 
	  jjl  s   AA)(r   numpyr   r   pathlibr   r   
matplotlibr   matplotlib.testingr   r   r   r)   r=   rD   rI   rP   rU   rX   rZ   r^   rg   rq   rt   ry   r{   r~   r   r   r   r   r   r   r   r   r   r   r   r   r1   r*   r(   <module>r      s      
    9 $
>!*	(
$ )$XB20%%2	<5  8		5Np=	'!r*   