+
     ]iG  c                   s 
   ^ RI t ^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	t
^ RIt^ RIt^ RIHt ^ RIHt ^ RIHt ^ RIHt ]P*                  ! 4       R 4       t ! R R	]P.                  4      tR
 t]P4                  P7                  R]! ]R7      .R.R7      R 4       tR t]P>                  PA                  R4       ! R R]4      4       t!. R?Ot"R t#]P4                  P7                  R]#! 4       4      ]P4                  P7                  R]! ]R7      .R.R7      R 4       4       t$]P4                  P7                  R]#! 4       4      R 4       t%]P4                  P7                  R]PL                  ! R]P4                  PO                  ]PP                  PS                  4       '       * RR7      R7      ]PL                  ! R]P4                  PO                  ]PT                  PS                  4       '       * RR7      R7      .4      ]P4                  P7                  R. R@O4      ]P4                  P7                  R]! ]R7      .R.R7      R 4       4       4       t+]P4                  P7                  RR ^
R!],! ]-! ^4      4      /.R.R7      R" 4       t.R# t/]P4                  P7                  R$]PL                  ! R%]P4                  PO                  ]P>                  Pa                  ]Pb                  R&,          4      '       * R'R7      R7      R(.4      ]P4                  P7                  R]! ^R)7      .R.R7      R* 4       4       t2]P4                  P7                  R$]PL                  ! R%]P4                  PO                  ]P>                  Pa                  ]Pb                  R&,          4      '       * R'R7      R7      R(.4      ]P4                  P7                  R]! ^R)7      .R.R7      R+ 4       4       t3]P4                  PO                  ]Ph                  ! R,4      RJ R-R7      R. 4       t5]P4                  P7                  R/R0R1.4      R2 4       t6]P4                  P7                  R3. RAO4      R4 4       t7R5 t8R6 t9]! R7.R87      R9 4       t:]P4                  P7                  R]! ]R7      .R.R7      R: 4       t;]P4                  P7                  R]! ]R7      .R.R7      R; 4       t<]P4                  P7                  R]! ]R7      .R.R7      R< 4       t=R= t>R> t?R# )B    N)Path)pyplot)	animation)PillowWriter)check_figures_equalc           	     sZ  a \         P                  ! 4       w  rVP                  . . 4      w  oVP                  ^ ^
4       VP	                  R	^4       V3R lpV3R lp\        \        V R/ 4      4      pVP                  R\        P                  4      pRV9  d   ^VR&   V! R
RVRVRV/VB # )z)Create a simple animation (with options).c                  .   < S P                  . . 4       S 3# Nset_dataline   F/usr/lib64/python3.14/site-packages/matplotlib/tests/test_animation.pyinitZanim.<locals>.init       b"u    c                 s   < \         P                  ! ^ ^
^d4      p\         P                  ! W,           4      pSP                  W4       S3# )r    )nplinspacesinr	   )ixyr   s   &  r   animateZanim.<locals>.animate!   s7    KK2s#FF15Maur   paramklassframesfigZfunc	init_func )
pltsubplotsplotset_xlimset_ylimdictgetattrZpopr   FuncAnimation)Zrequestr   axr   r   Zkwargsr   r   s   &      @r   animr(      s     llnGCGGBOEDKK2KKA ''7B/0FJJw	 7 78EvxASAwA$A&AAr   c                   s6   a  ] tR t^/t o RtR tR tR tRtV t	R# )NullMovieWritera~  
A minimal MovieWriter.  It doesn't actually write anything.
It just saves the arguments that were given to the setup() and
grab_frame() methods as attributes, and counts how many times
grab_frame() is called.

This class doesn't have an __init__ method with the appropriate
signature, and it doesn't define an isAvailable() method, so
it cannot be added to the 'writers' registry.
c                sD    Wn         W n        W0n        W@n        ^ V n        R# )r    N)r   outfiledpiargs_count)selfr   r*   r+   r,   s   &&&&*r   setupZNullMovieWriter.setup;   s    	r   c                s`    ^ RI Hp V! V4       Wn        V ;P                  ^,          un        R# )r    )_validate_grabframe_kwargsN)matplotlib.animationr0   savefig_kwargsr-   )r.   r2   r0   s   &, r   
grab_frameZNullMovieWriter.grab_frameB   s!    C">2,qr   c                    R # r   r   r.      &r   finishZNullMovieWriter.finishH   s    r   )r-   r,   r+   r   r*   r2   N)
__name__
__module____qualname____firstlineno__Z__doc__r/   r3   r7   __static_attributes____classdictcell__Z__classdict__   @r   r)   r)   /   s     	 r   r)   c                 s    R \         P                  R&   Rp^2p\        ^ R7      p\        4       pV P	                  WVVR7       VP                  4        F  w  rVK  	  R# )Zautozsavefig.facecolorunused.null)Zfoo)r+   writerr2   N)r   rcParamsr$   r)   saveZitems)r(   filenamer+   r2   rA   kZvs   &      r   test_null_movie_writerrF   L   s[    (.CLL$%H
Ca[NFIIh+  - $$&1&r   r(   )r   )Zindirectc                 sb   \         P                  ! 4       R 8X  d   \        P                  P	                  4        \
        P                  ! R/ V B p \        P                  ! \        RR7      ;_uu_ 4        ? \        P                  P	                  4        RRR4       R#   + '       g   i     R# ; i)PyPyzAnimation was deletedZmatchNr   )
platformpython_implementationr   testingbreak_cyclesr   r&   pytestwarnsZWarningr(   r6   r   test_animation_deleterP   b   sl    %%'61 	

!""*T*D	g%<	=	=


! 
>	=	=	=s   3 BB.	c                  s     ! R  R\         P                  4      p \        P                  ! 4       pRp^pRp^pR.pV ! W4WV4      pVP	                  W4       R# )c                   s&   a  ] tR t^pt o R tRtV tR# )7test_movie_writer_dpi_default.<locals>.DummyMovieWriterc                r4   r   r   r5   r6   r   _runZ<test_movie_writer_dpi_default.<locals>.DummyMovieWriter._runq   s    r   r   N)r8   r9   r:   r;   rR   r<   r=   r>   r?   r   DummyMovieWriterrQ   p   s     	 	r   rS   r@   ZunusedN)r   ZMovieWriterr   Zfigurer/   )rS   r   rD   fpscodecbitrate
extra_argsrA   s           r   test_movie_writer_dpi_defaultrX   o   sT    900 
 **,CH
CEGJc'>F
LLr   nullc                   s:   a  ] tR t^t o RR lt]R 4       tRtV tR# )RegisteredNullMovieWriterNc                r4   r   r   )r.   rT   rU   rV   rW   Zmetadatas   &&&&&&r   __init__Z"RegisteredNullMovieWriter.__init__   s    r   c                r4   )Tr   )Zclsr6   r   isAvailableZ%RegisteredNullMovieWriter.isAvailable   s    r   r   )NNNNN)	r8   r9   r:   r;   r[   Zclassmethodr\   r<   r=   r>   r?   r   rZ   rZ      s       r   rZ   ffmpegimagemagickc               #   s  "   \          F  w  r\        P                  P                  V 4      '       gh   \        P
                  P                  R V  R24      p\        P                  ! V RW.R7      x  \        P                  ! V R\        V4      V.R7      x  K  \        P                  V ,          p\        VRR.4       F  pWV3x  W\        V4      3x  K  	  K  	  R# 5i)zwriter 'z' not available on this systemNZmarksZsupported_formats)
WRITER_OUTPUTr   writersis_availablerM   markskipr   r   r%   )rA   outputrc   Zwriter_classframe_format        r   gen_writersrh      s     '  --f55;;##6("@ACD,,vtV6BB,,vtT&\$HH ((0#L2EvNL..V44 O (s   CC!zwriter, frame_format, outputc                 sP   Ve   V\         P                  R&   \        P                  ! R/ VB pR pR pVR8X  d    VP                  P                  R4       RpRpV P                  4       ;_uu_ 4        VP                  V^VRVVR7       R R R 4       ?R #   + '       g   i     ?R # ; i)	Nanimation.frame_formatr]         Y@h264i  )rT   rA   rV   r+   rU   r   g33333%@gQk"@)r   rB   r   r&   Z_figset_size_inchesas_cwdrC   )tmpdirrA   rf   re   r(   r+   rU   s   &&&&&  r   test_save_animation_smoketestrp      s     1=-.""*T*D
CE		!!-0 
		&b# 	 	 
 		 
 	s   0BB%	c                 s   \         P                  V,          pVe   V\        P                  R&   \        P                  ! 4       w  rVR pR pVR8X  d   VP                  R4       RpRpV! 4       p	V P                  4       ;_uu_ 4        V	P                  WSV4      ;_uu_ 4        V	P                  4        R FP  p
\        P                  ! \        RV
: 2R7      ;_uu_ 4        V	P                  ! R	/ V
\        4       /B  R R R 4       KR  	  R R R 4       R R R 4       R #   + '       g   i     Kw  ; i  + '       g   i     L.; i  + '       g   i     R # ; i)
Nri   r]   rj   rk   z.grab_frame got an unexpected keyword argument rH   rl   >   r+   ZformatZbbox_inchesr   )r   ra   r   rB   r    rm   rn   Zsavingr3   rM   raisesZ	TypeErrorZobject)ro   rA   rf   re   ZWriterClassr   r'   r+   rU   Ztest_writerrE   s   &&&&       r   test_grabframerr      s   ##F+K1=-.llnGC
CEM*-K 
S11""$5]]! NqeT   **;a];	  6 2 

  	 21 
s<   E  >D-	D;D-	E D*$	D-	-D=8E  E	rA   Requires FFMpeg)Zreasonr_   zRequires ImageMagickz
html, wantc                 s   \         P                  ! 4       R 8X  d   \        P                  P	                  4        V R8X  dB   VR8X  d;   \
        P                  P                  4       '       g   \        P                  ! R4       \
        P                  ! R/ VB p\        P                  ! RV RV/4      ;_uu_ 4        VP                  4       pRRR4       VfM   \        P                  ! \        4      ;_uu_ 4        ?\        P                  P	                  4        RRR4       R# R#   + '       g   i     Lb; i  + '       g   i     R# ; i)rG   r^   html5rs   animation.writerzanimation.htmlNr   )rI   rJ   r   rK   rL   r   FFMpegWriterr\   rM   rd   r&   r   
rc_contextZ_repr_html_rN   UserWarning)rA   htmlZwantr(   s   &&&&r   test_animation_repr_htmlrz      s    " %%'61 	

!-DGO**6688%& ""*T*D	+V)41 
2 
2!
2 |\\+&&JJ##% '& 
2 
2
 '&&s   9D$8 D7$D4	7E	
save_countr   c                 s<    V P                  R \        4       R7       R# )r@   rA   N)rC   r)   rO   r6   r   test_no_length_framesr}     s     	IImO$5I6r   c                  s    R \         P                  R&   \        P                  R8w  d   RMRp V \         P                  R&   R# )Znot_available_ever_xxxxzanimation.ffmpeg_pathwin32ZtrueZwhereN)mplrB   sysrI   )Zbins    r   test_movie_writer_registryr     s4    ,ECLL() LLG+&C,/CLL()r   method_nameZto_html5_videoru   zanimation writer not installedZ	to_jshtml)r   c           	      sD   VP                  R 4       VP                  4       ;_uu_ 4        \        P                  ! RR/4      ;_uu_ 4        \	        W04      ! 4        RRR4       RRR4       VP
                  w  pR#   + '       g   i     L(; i  + '       g   i     L3; i)ZWARNINGzanimation.embed_limitgư>N)Z	set_levelrn   r   rw   r%   Zrecords)r   Zcaplogro   r(   Zrecords   &&&& r   test_embed_limitr   $  se     Y	^^4d;<<D&( = 
 nnGF =< 
s#   !BA<	B<BBB	c                 s    VP                  4       ;_uu_ 4        \        W 4      ! 4        R R R 4       R #   + '       g   i     R # ; ir   )rn   r%   )r   ro   r(   s   &&&r   test_cleanup_temporariesr   6  s&     
"$ 
s	   4A	z/bin/shzrequires a POSIX OSc           	     s   V P                  4       ;_uu_ 4        VP                  RR\        P                  R,          ,           4       \	        \        V 4      R4      pVP                  R4       \        P                  ! VR4       \        P                  ! \        P                  4      ;_uu_ 4        VP                  R4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)a  
Test that we correctly raise a CalledProcessError when ffmpeg fails.

To do so, mock ffmpeg using a simple executable shell script that
succeeds when called with no arguments (so that it gets registered by
`isAvailable`), but fails otherwise, and add it to the $PATH.
ZPATHz.:r]   s   #!/bin/sh
[[ $@ -eq 0 ]]
i  z	test.mpegN)rn   ZsetenvosZenvironr   ZstrZwrite_bytesZchmodrM   rq   
subprocessZCalledProcessErrorrC   )ro   Zmonkeypatchr(   Zexe_paths   &&& r   test_failing_ffmpegr   C  s     
64"**V*<#<=FX.;<
5!]]:8899IIk" : 

 :9 
s$   BC(1C	C(C% C((C9	cache_frame_dataFTc           	      sl  a
aa \         P                  ! 4       w  rVP                  . . 4      w  o ! R  R\        4      o
V3R lpV3R lp. oV
V3R lp^dp\        P
                  ! WVVV VR7      p\        4       pVP                  RVR7       \        P                  P                  4        S F  p	K  	  R# )	c                   s    ] tR tRtRtR# )2test_funcanimation_cache_frame_data.<locals>.FrameiZ  r   N)r8   r9   r:   r;   r<   r   r   r   Framer   Z  s    r   r   c                  r   r   r   r
   r   r   r   Z1test_funcanimation_cache_frame_data.<locals>.init^  r   r   c                 sJ   < SP                  V R ,          V R,          4       S3# r   r   r   )framer   s   &r   r   Z4test_funcanimation_cache_frame_data.<locals>.animateb  s     eCj%*-ur   c               3   s  <"   \        ^4       Fl  p \        P                  ! ^ ^
^d4      p\        P                  P	                  ^d4      pS! WR7      pSP                  \        P                  ! V4      4       Vx  Kn  	  R# 5i)   r   N)ranger   r   ZrandomZrandZappendweakrefZref)Z_r   r   r   r   frames_generateds       r   frames_generatorZ=test_funcanimation_cache_frame_data.<locals>.frames_generatorh  s_     qAAr3'A		s#AAOE ##GKK$67K s   A>B)r   r   r   r{   r@   r|   N)r   r    r!   r$   r   r&   r)   rC   r   rK   rL   )r   r   r'   r   r   r   Z
MAX_FRAMESr(   rA   Zfr   r   r   s   &         @@@r   #test_funcanimation_cache_frame_datar   U  s    llnGCGGBOED   J""34*:4D.8:D
 FIImFI+JJr   return_valuec           	      s  a a \         P                  ! 4       w  rVP                  . 4      w  oVV 3R  lp\        P                  ! \
        4      ;_uu_ 4        \        P                  ! WRRR7       RRR4       R#   + '       g   i     R# ; i)c                 sF   < SP                  ^ ^.^ V .4       SR8X  d   S# S# )r    artistr   )r   r   r      &r   r   Z test_draw_frame.<locals>.animate  s,    q!fq!f%8#Kr   TF)blitr   N)r   r    r!   rM   rq   ZRuntimeErrorr   r&   )r   r   r'   r   r   s   f   @r   test_draw_framer     s[     llnGCGGBKED  
|	$	$te	
 
%	$	$	$s   A::B	c           	      s   \         P                  ! 4       w  rR  p\        P                  ! W\	        \        ^
4      4      RRR7      pV P                  4       ;_uu_ 4        VP                  RRR7       RRR4       \        P                  ! \        RR7      ;_uu_ 4        VP                  4        RRR4       R#   + '       g   i     LO; i  + '       g   i     R# ; i)	c                     . # r   r   r   r6   r   updateZ(test_exhausted_animation.<locals>.update      	r   Fr   repeatr   test.gifpillowr|   N	exhaustedrH   )r   r    r   r&   iterr   rn   rC   rM   rN   rx   _startro   r   r'   r   r(      &    r   test_exhausted_animationr     s    llnGC ""DrOED
 
		*X	. 
 
k	5	5 
6	5 
 
6	5	5s   B:C:C
	C	c                 s   \         P                  ! 4       w  rR  p\        P                  ! W. RRR7      p\        P
                  ! \        RR7      ;_uu_ 4        VP                  4        RRR4       R#   + '       g   i     R# ; i)c                 r   r   r   r   r6   r   r   Z%test_no_frame_warning.<locals>.update  r   r   Fr   r   rH   N)r   r    r   r&   rM   rN   rx   r   r   r   r   test_no_frame_warningr     s[    llnGC ""BuD
 
k	5	5 
6	5	5	5s   A44B	Zpng)Z
extensionsc           	      s  aa VP                  4       pVP                  ^ ^\        P                  ,          4       VP	                  R^4       \        P
                  ! ^ ^\        P                  ,          ^d4      oVP                  . . 4      w  oV3R lpVV3R lp\        P                  ! WV^RRR7      pV P                  4       ;_uu_ 4        VP                  R4       RRR4       VP                  4       pVP                  ^ ^\        P                  ,          4       VP	                  R^4       VP                  S\        P                  ! SR	,           4      4       R#   + '       g   i     L; i)
r    c                  r   r   r   r
   r   r   r   Z"test_animation_frame.<locals>.init  r   r   c                 sr   < SP                  S\        P                  ! SV ^d,          ,           4      4       S3# )id   )r	   r   r   )r   r   r   r   r   r   Z%test_animation_frame.<locals>.animate  s)    aAG,-ur   TF)r   r   r   r   r   Nr   g{Gz?)Zadd_subplotr"   r   Zpir#   r   r!   r   r&   rn   rC   r   )	ro   Zfig_testZfig_refr'   r   r   r(   r   r   s	   &&&    @@r   test_animation_framer     s   
 
			BKK1ruu9KKA
Aq255y#&AGGBOED ""T!%!D 
		* 
 
			BKK1ruu9KKA GGArvva'k"# 
s   EE/	c                 s^   ^p\        \        ^4      4      pRV: R\        V4      : R2p\        P                  ! \
        \        P                  ! V4      R7      ;_uu_ 4        \        P                  ! R/ / V CRVRV/CB p RRR4       V P                  4        R#   + '       g   i     L"; i)	r   %You passed in an explicit save_count=z0 which is being ignored in favor of len(frames)=.rH   r   r{   Nr   )Zlistr   ZlenrM   rN   rx   reescaper   r&   
_init_drawr(   r{   r   match_target   &   r   ,test_save_count_override_warnings_has_lengthr     s     J%(^F
0ZM 2v;.	  
k<)@	A	A&& 
BBxzB
 
B
 	OO 
B	As   #BB,	c                 sF   ^p^pRV: R2R,           RV: R2,           p\         P                  ! \        \        P                  ! V4      R7      ;_uu_ 4        \
        P                  ! R
/ / V CRVRV/CB p R	R	R	4       V P                  4        R	#   + '       g   i     L"; i)r   r   Z z#which is being ignored in favor of frames=r   rH   r   r{   Nr   )rM   rN   rx   r   r   r   r&   r   r   r   r   (test_save_count_override_warnings_scalerr     s    JF
0ZM3-	.6)1	  
k<)@	A	A&& 
BBxzB
 
B 	OO 
B	As   BB 	c                 sL   R p\        \        ^4      4      pRV: RV: R2p\        P                  ! \        \
        P                  ! V4      R7      ;_uu_ 4        \        P                  ! R/ / V CRVRV/CB p RRR4       V P                  4        R#   + '       g   i     L"; i)	Tr   ze which we can infer the length of, did not pass an explicit *save_count* and passed cache_frame_data=z.  To avoid a possibly unbounded cache, frame data caching has been disabled. To suppress this warning either pass `cache_frame_data=False` or `save_count=MAX_FRAMES`.rH   r   r   Nr   )
r   r   rM   rN   rx   r   r   r   r&   r   )r(   r   r   r   r   r   test_disable_cache_warningr     s    %(^F6+ (&( )?	?  
k<)@	A	A&& 
NN)+;XvN
 
B
 	OO 
B	As   BB#	c                 s   \         P                  R 8X  d   RpMRp\        P                  ! \        VR7      ;_uu_ 4        V P                  R\        P                  ! 4       R7       RRR4       R#   + '       g   i     R# ; i)r~   z,\[WinError 3] .*'\\\\foo\\\\bar\\\\aardvark'z\[Errno 2] .*'/foorH   z+/foo/bar/aardvark/thiscannotreallyexist.mp4r|   N)r   rI   rM   rq   ZFileNotFoundErrorrC   r   ZFFMpegFileWriter)r(   Z	match_strs   & r   test_movie_writer_invalid_pathr   #  sY    
||wC	)		(		:	:		?"335 	 	7 
;	:	:	:s   'A00B	c                 s   \         P                  ! 4       w  r\         P                  ! R
^^RRR7      pVP                  V4       VP	                  ^ ^4       VP                  ^ ^4       \        ^R7      pVP                  V R^dR7       VP                  RR7       VP                  R,          p\         P                  ! V 4       R	# )zGTest animation exhaustion with transparency using PillowWriter directlyZredg      ?)ZcolorZalpha)rT   z
unused.gif)r+   T)ZtransparentN)r    r    r   )r   r    Z	RectangleZ	add_patchr"   r#   r   r/   r3   Z_framesZclose)r   r'   ZrectrA   r   rg   r    test_animation_with_transparencyr   -  s    llnGC==AU#>DLLKK1KK1b!F
LLlL,
$'NN2E IIcNr   ))r]   	movie.mp4)Zffmpeg_filer   )r^   	movie.gif)Zimagemagick_filer   )r   r   )ry   z
movie.html)rY   z
movie.null))ZnoneN)rt   z<video width)Zjshtmlz<script )Nstringi   )r   r   )@r   Zpathlibr   rI   r   Zshutilr   r   r   Znumpyr   rM   Z
matplotlibr   r   r   r   r1   r   Zmatplotlib.testing.decoratorsr   Zfixturer(   ZAbstractMovieWriterr)   rF   rc   Zparametrizer$   rP   rX   ra   ZregisterrZ   r`   rh   rp   rr   r   Zskipifrv   r\   ZImageMagickWriterrz   r   r   r}   r   rb   rB   r   r   Zwhichr   r   r   r   r   r   r   r   r   r   r   r   r   r   <module>r      s2   	   	   
     $   - = B B4i33 :-, $T"2!3vhG	" H	"!& F#  $"5$ 7G$T"2!3vhG H H* 7G< H<> 
LL**&&2244$ + &' LLV[[//++7799) 0 +,	$ 	  ( 
 $T"2!3vhG H	 2 
B$uQx.12X  
7
74 \\"&++*<*<**3<<8J+KLL/ += +1 2  $a.!1VHE/ F/ \\"&++*<*<**3<<8J+KLL/ += +1 2  $a.!1VHE7 F7 FLL+t3<QR# S#" +eT];,1 <,1^  * 

*$ ($ )$B $T"2!3vhG H$ $T"2!3vhG H$ $T"2!3vhG H&7r   