
    rbii6                        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*dS )#    N)Path)subprocess_run_for_testing)pyplotc           
         t          j        dd           t          t          j                  j        d         dz  }|                                st          j        d           t          t          j                  	                                }| dz  }|
                    |d           t          t          j        t          |          t          |          gd	
           |	                    d          }||k    rld                    t!          j        |                    d          |                    d          dddd                    }t          j        d|z             d S d S )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         l/var/www/html/mdtn/previsions/meteo_cartes/venv/lib/python3.11/site-packages/matplotlib/tests/test_pyplot.pytest_pyplot_up_to_dater*      st   
F3333cl##+A.1GGJ 0.///&&0022M+%Hw///	Z#h--8    %%g..L$$99 ##D))<+=+=d+C+C*+b	" " "# # 	< ?G	G	
 	
 	
 	
 	
 %$    c                    t           j                            t           j        dd          t           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            n# 1 swxY w Y   t          j        t           j	                  5   |d d            d d d            d S # 1 swxY w Y   d S )Noldnewkwoc                     d S N r.   r/   s     r)   funcz1test_copy_docstring_and_deprecators.<locals>.func.   s	     	r+   c                     d S 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   Xsu==X77   87 >= 	(..   /. LLTL4    LTt$$$$	c6	7	7                	c6	7	7 ! !T4   ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !s$   C00C47C4D33D7:D7c                  ~   t          j                    \  } }t          j        d           |                                rJ t          j        d           |                                sJ t          j                     |                                rJ t          j                     |                                sJ d S )NFT)r   subplotsboxget_frame_on)figaxs     r)   test_pyplot_boxrF   B   s    lnnGCGENNN     GDMMM??GIII     GIII??r+   c                  8    t          j        g dg d           d S )N)   r	      )r   	stackplotr2   r+   r)   test_stackplot_smokerK   N   s"    M)))YYY'''''r+   c                      t          j        t                    5  t          j        d           d d d            n# 1 swxY w Y   t          j        t                    5  t          j        d           d d d            d S # 1 swxY w Y   d S )NrH   )nrows)ncols)r   raises	TypeErrorr   subplotr2   r+   r)   test_nrows_errorrR   S   s   	y	!	!  !              	y	!	!  !                 s!   <A A  BB
Bc                     t          j                     t          j                    sJ t          j                    5  t          j                    rJ 	 d d d            n# 1 swxY w Y   t          j                    sJ t          j                     t          j                    rJ t          j                    5  t          j                    rJ 	 d d d            n# 1 swxY w Y   t          j                    rJ d S r1   )r   ionr   is_interactiveioffr2   r+   r)   	test_ioffrW   Z   sd   GIII	 ( (%''''''( ( ( ( ( ( ( ( ( ( ( ( ( ( (HJJJ!#####	 ( (%''''''( ( ( ( ( ( ( ( ( ( ( ( ( ( (!########   AA#&A#:CC!$C!c                     t          j                     t          j                    rJ t          j                    5  t          j                    sJ 	 d d d            n# 1 swxY w Y   t          j                    rJ t          j                     t          j                    sJ t          j                    5  t          j                    sJ 	 d d d            n# 1 swxY w Y   t          j                    sJ d S r1   )r   rV   r   rU   rT   r2   r+   r)   test_ionrZ   h   sd   HJJJ!#####	 $ $!######$ $ $ $ $ $ $ $ $ $ $ $ $ $ $!#####GIII	 $ $!######$ $ $ $ $ $ $ $ $ $ $ $ $ $ $rX   c                  R   t          j                     t          j                    5  t          j                    rJ t          j                    5  t          j                    sJ 	 d d d            n# 1 swxY w Y   t          j                    rJ 	 d d d            n# 1 swxY w Y   t          j                    sJ t          j                    5  t          j                    5  t          j                    rJ 	 d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   t          j                    sJ t          j                    5  t          j                     d d d            n# 1 swxY w Y   t          j                    sJ t          j                     t          j                    5  t          j                    sJ t          j                    5  t          j                    rJ 	 d d d            n# 1 swxY w Y   t          j                    sJ 	 d d d            n# 1 swxY w Y   t          j                    rJ t          j                    5  t          j                    5  t          j                    sJ 	 d d d            n# 1 swxY w Y   d d d            n# 1 swxY w Y   t          j                    rJ t          j                    5  t          j                     d d d            n# 1 swxY w Y   t          j                    rJ d S r1   )r   rT   rV   r   rU   r2   r+   r)   test_nested_ion_ioffr\   v   sH   GIII 
 ( (%'''''WYY 	( 	(%''''''	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	(%''''''	( ( ( ( ( ( ( ( ( ( ( ( ( ( (
  
 , ,XZZ 	, 	,)++++++	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	,, , , , , , , , , , , , , , , 	  


               HJJJ 
 $ $!#####XZZ 	, 	,)++++++	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	,!######	$ $ $ $ $ $ $ $ $ $ $ $ $ $ $
 !##### 
 ( (WYY 	( 	(%''''''	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	(( ( ( ( ( ( ( ( ( ( ( ( ( ( ( !#####	  			              !#######s   )B A3'B 3A7	7B :A7	;B  B$'B$D!'D
>D!
D	D!D	D!!D%(D%E44E8;E8:)H3#H:H3H
	
H3H
	H33H7:H7&J4:JJ4J!	!J4$J!	%J44J8;J8'LLLc                      	 t          j        d           d S # t          $ r } t          |           dk    sJ Y d } ~ d S 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`      s    B	# B B B1vv B B B B B B B B B B BBs    
A=A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 d S )Ny   z   )r   rQ   gcaax1ax2ax3s      r)   test_subplot_reuseri      s    
+c

C#'))
+c

C#'))
+c

C#'))#::::::r+   c                  0   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                     d S )Npolar
projectionrectilinear)r   figureaxesr^   namerE   rf   s     r)   test_axes_kwargsrs      s    JLLL	B
(**C>>>b====IKKKJLLL	W	%	%	%B
(g
&
&
&C>>>b====IKKKJLLL	W	%	%	%B
(**C>>>8}$$$$b====IKKKKKr+   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 d S )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'
2
2
2C
+aA'
2
2
2C>>>"9999b====b====#::::>>>>#(????#(????7m####8}$$$$8wr+   c                     t          j        dd          } t          j        dd          }| |u sJ |                                  t          j        dd          }| |usJ | t          j                    j        vsJ d S )Nrk   r   )rm   theta_offsetrH   )r   rQ   removegcfrp   re   s      r)   test_subplot_kwarg_collisionr{      s    
+q
9
9
9C
+q
9
9
9C#::::JJLLL
+q
9
9
9Cc>>>>cgiin$$$$$$r+   c                      t          j                     t          j                    } t          j                    }| J || u sJ t          j                     d S r1   )r   ro   rd   r^   rr   s     r)   test_gcar}      sH    JLLL	B
'))C>>>"9999IKKKKKr+   c                  <   t          j        d          } | t          j                    u sJ | t          j        d          u sJ |                                  t          j        dd          }|t          j                    u sJ | t          j                    j        vsJ |t          j        d          u sJ |                                 t          j        dd          }|t          j                    u sJ ||usJ |t          j                    j        vsJ d S )No   rk   rl   rn   )r   rQ   rd   ry   rz   rp   re   s      r)   test_subplot_projection_reuser      s   
+c

C#'))#+c""""""JJLLL
+cg
.
.
.C#'))cgiin$$$$#+c""""""JJLLL +cm
4
4
4C#'))c>>>>cgiin$$$$$$r+   c                  :   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            d S # 1 swxY w Y   d S )
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>
@ 
@ 
@ < <k#Td;;;< < < < < < < < < < < < < < < < < <s   +BBBc                     t                      } t          j                    }|                     |           d}|D ]d}|                                 t          j        |          }|t          j                    u sJ |j        |k    sJ |                     |           et          |           dt          |          z   k    sJ d S )N)aitoffhammerlambert	mollweiderk   rn   r   rl   rH   )setr   rQ   addry   rq   len)created_axesrE   projectionsprojs       r)   test_subplot_change_projectionr     s    55L	BR1K  
		[D)))S[]]""""w$|C$4$4 4444444r+   c                  
   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 d S )Ng        g      ?rogQ?      ?bo)r   rk   
isinstancer   linesLine2Drp   )ln1ln2s     r)   test_polar_second_callr   .  s}    9RT""DCc39+,,,,,9T2t$$DCc39+,,,,,8sxr+   c                     t          j        g d          } t          j        g d          }t          j                            |j                                        | j                                                   t          j        g d          } t          j        g dg d          }t          j                            |j                                        | j                                                   d S )N)皙?r   r   r   )position)皙?r   皙?r   )r   rp   nptestingassert_allclosebbox
get_points)axrefaxtests     r)   test_fallback_positionr   8  s    H)))**EX333444FJv{5577$z44668 8 8 H)))**EX***5I5I5IJJJFJv{5577$z44668 8 8 8 8r+   c                  $   t          j                    } |                     d          }t          j                     t          j                    | k    sJ t          j        |d                   }t          j                    | k    sJ || k    sJ d S )Nr	   rH   )r   ro   
subfiguresrz   )fig1subfigscurrents      r)   %test_set_current_figure_via_subfigurer   F  s{    :<<Dooa  GJLLL799j$$G799d??????r+   c                  V   t          j                    } |                     d          }|d                             dd          }|d                             dd           t          j                    |k    sJ t          j        |           t          j                    |k    sJ d S )Nr	   r   rH   T)squeeze)r   ro   r   rA   rd   sca)rD   r   rE   s      r)   "test_set_current_axes_on_subfigurer   R  s    
*,,CnnQG			Q		-	-BAJ4(((799????GBKKK799??????r+   c                      t          j        d          } t          j                            | j        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   r   subprocess_run_helperstart_ipythonr   )r   s    r)   test_pylab_integrationr   ^  sb    !),,GK%% 
 	 	  & 	 	 	 	 	r+   c                     t          t                    j        dz  } |                                 st	          j        d           d }|                                                     d          }t           ||                    }t          t          j
                              }|                    |          }|rt          d|          |                    |          }|rt          d|          dS )z6Test that pyplot_summary lists all the plot functions.z#../../../doc/api/pyplot_summary.rstz#Documentation sources not availablec                    g }d}| D ]x}|s|                     d          rd}|r|                     d          r4|d                                         sd}Q|                    |                                           y|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  s      	 	/ 	/D! /??#566 *%)N tv6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44U;;<<M02233M&&}55G    	 $$]33E NMCHM MN N 	NN Nr+   c                  b   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
                    }|                    d          } |                    d          }t          j        | t          j        ddg          k              sJ d |D             dd	gk    sJ d S )NrH   
   T)minor)dtypeg      @g      @ab)tickslabelsr   c                 6    g | ]}|                                 S r2   )get_text).0ls     r)   
<listcomp>z$test_minor_ticks.<locals>.<listcomp>  s     ...QAJJLL...r+   )r   ro   plotr   arangexticksallarrayfloat64yticksrd   
get_yticksget_yticklabels)tick_postick_labelsrE   s      r)   test_minor_ticksr     s"   JLLLHRYq"JT222Hk6+"BJ!?!?!??@@@@@"Jc3Zc
$????	B}}4}((H$$4$00K6(bhSz22233333..+...3*<<<<<<r+   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 d S )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| _         d S )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            n# 1 swxY w Y   |j        sJ d S )Nzfigure.hooksz0matplotlib.tests.test_pyplot:figure_hook_example)r   
rc_contextr   ro   r   )test_rcrD   s     r)   test_figure_hookr     s     	KLG 
	 	   jll               s   :>>c                     t          j        dd          } t          j        t          d          5  t          j        dt          j        ddg                    }d d d            n# 1 swxY w Y   t          j        t          d          5  t          j        | t          j        dd	g                     d d d            n# 1 swxY w Y   | |u sJ t          j        d          }| |u sJ d S )
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	U	U 7 7z!RXq!f%5%56667 7 7 7 7 7 7 7 7 7 7 7 7 7 7	k)T	U	U	U 2 2
3!Q 0 011112 2 2 2 2 2 2 2 2 2 2 2 2 2 2$;;;;:a==D$;;;;;;s#   +A))A-0A-+CC
C
c                      t          j                    } t          j        t          d          5  t          j        d          }d d d            d S # 1 swxY w Y   d S )Nzcloses all existing figuresr   r   )r   ro   r   r<   r   )r   r   s     r)   test_close_all_warningr     s    :<<D 
k)F	G	G	G ! !z%  ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !s   AAAc                  r    t          j                    } ddgddgg}t          j        || j                   d S )Nr   rH   r	   )fignum)r   ro   matshownumber)rD   arrs     r)   test_matshowr    s>    
*,,Cq6Aq6
C KCJ''''''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     sB        



            9 9 9 9 9 9 $ $ $ $ $ $
 
 
>! ! !*	 	 	( ( (
  $ $ $     )$ )$ )$XB B B    2  0% % %  % % %2	< 	< 	<5 5 5      8 8 8	 	 		 	 	  5N 5N 5Np= = =' ' '! ! !    ! ! !( ( ( ( (r+   