+
     ]iI  c                   sj   ^ RI H t  ^ RIt^ RIt^ RIt^ RIHt ^ RIH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 ^ RIHt ^ RIHt ^ R	IHt ^ RIHt  ^ R
I!H"t"H#t# ^ RI$H%t% ^ RI&H't'H(t(H)t) ]	! ]
PT                  4      t+]#! R.4      R 4       t,]#! R.4      R 4       t-]#! R.RR7      R 4       t.]#! R.RR7      R 4       t/R t0]#! R.4      R 4       t1R t2]Pf                  Pi                  R]5]6R3]5^ ^ .R3]7RR3]7R R!3]7R"R#3]7R$R%334      R& 4       t8]#! R'.4      R( 4       t9]#! R).RR7      R* 4       t:]#! R+.4      R, 4       t;R- t<R. t=]Pf                  Pi                  R/R0R1.R2R3.R47      R5 4       t>R6 t?R7 t@R8 tAR9 tBR: tCR; tD]Pf                  Pi                  R<. RO4      ]Pf                  Pi                  R=. RO4      R> 4       4       tE]#! R?.4      R@ 4       tF]#! RA.4      RB 4       tG]#! RC.4      RD 4       tHRE tI]#! RF.4      RG 4       tJRH tK]#! RI.4      RJ 4       tL]Pf                  Pi                  RK. RO4      RL 4       tMRM tNRN tORO tP]%RP 4       tQ]%RQ 4       tR]Pf                  Pi                  RR. RO4      RT 4       tS]#! RU.4      RV 4       tT]#! RW.4      RX 4       tURY tVRZ tW]"! RS.R[7      R\ 4       tX]#! R].RR7      R^ 4       tY]Pf                  Pi                  R_. RO4      R` 4       tZRa t[Rb t\Rc t]Rd t^]"! RS.R[7      Re 4       t_Rf t`Rg taRh tb]Pf                  Pi                  RiRj^Z..4      Rk 4       tcRl td]#! Rm.RR7      Rn 4       teRo tf]Pf                  P                  ]+P                  R8H  RpRq7      Rr 4       ti]Pf                  P                  ]+P                  R8H  RpRq7      Rs 4       tj]#! Rt.RR7      Ru 4       tk]#! Rv.RR7      Rw 4       tl]%Rx 4       tmRy tnRz toR{ tp]"! RS.R[7      R| 4       tq]"! 4       R} 4       tr]"! 4       R~ 4       tsR ttR tuR tvR tw]#! R.RS.R7      R 4       tx]#! R.RS.R7      R 4       tyR# )    )datetimeN)assert_almost_equal)parse)
MouseEvent)RendererAgg)Figure)FontProperties)GridSpec)check_figures_equalimage_comparison)needs_usetex)Text
Annotation
OffsetFromZfont_stylesc            	      s0  a	a
 V	V
3R  lp ^ RI Ho	Ho
 \        P                  ! RR\
        RR7       \        P                  ! 4       w  rV ! RRR^R7      pVP                  R	RR
VR7      pV ! RRRRR^R7      pVP                  RRR
VR7       V ! RRRRR^R7      pVP                  RRR
VR7       V ! RRR^R^R7      pVP                  RRR
VR7       V ! RRRR^d^R7      pVP                  RRR
VR7       VP                  . 4       VP                  . 4       R# )c                  s`   < S! R/ V B pS! V\         P                  ! 4       R 7      pS! VR7      # ))Z	directory)Zfname )mplZget_data_path)kwZpropZpathr   findfonts   ,  A/usr/lib64/python3.14/site-packages/matplotlib/tests/test_text.pyfind_matplotlib_fontZ.test_font_styles.<locals>.find_matplotlib_font   s0    ##(9(9(;<D))    )r   r   Zignorez>findfont: Font family \[u?'Foo'\] not found. Falling back to .zmatplotlib.font_manager)Zmodulez
sans-serifZnormal)familystylevariantsizezNormal Fontaxes fraction)xycoordsfontpropertiesZFooboldi  )r   r   r   weightZstretchr   z	Bold Font
sans serifitalici  zBold Italic Fontz
Light FontzCondensed FontN)皙?r!   )r!   皙?)r!   333333?)r!   皙?)r!         ?)matplotlib.font_managerr   r   warningsZfilterwarningsZUserWarningpltsubplotsannotate
set_xticks
set_yticks)r   figaxZnormal_fontaZ	bold_fontZbold_italic_fontZ
light_fontZcondensed_fontr   r   s            @@r   test_font_stylesr0      s}   *
 AI(	* llnGC&	K
 	 "	 	 	$A %I KK  	  " , KK '	  ) &J KK !	  # *N KK %	  ' MM"MM"r   Z	multilinec            	      s   \         P                  ! 4        \         P                  ! ^^^4      p V P                  R4       \         P                  ! RRR^RRR7       \         P                  ! RRR^RRR7       \         P                  ! R	RR
^RRR7       \         P
                  ! ^ ^4       \         P                  ! ^ R	4       V P                  . 4       V P                  . 4       R# )   zmultiline
text alignmentr"   r%   zTpTpTp
$M$
TpTpTpcentertop)r   havazTpTpTp
$M^{M^{M^{M}}}$
TpTpTpg?zTpTpTp
$M_{q_{q_{q}}}$
TpTpTpN)	r(   figuresubplot	set_titletextZxlimZylimr+   r,   r.       r   test_multiliner<   t   s    JJL	Q1	BLL,-HHS'bX%I HHS3" HHS3" HHQNHHQMM"MM"r   Z
multiline2Zmpl20)r   c            
      s6  a ^\         P                  R&   \         P                  ! 4       w  rVP                  ^ R.4       VP	                  ^ ^.4       VP                  RRRR7       . ROpV P                  P                  4       oV3R lpRp\        V4       F0  w  rVVP                  R	V,          R
,           RWdRR7      pV! W4       K2  	  VP                  RRRRR7       VP                  RRRR7       \        V4       F0  w  rVVP                  R	V,          R
,           RWdRR7      pV! W4       K2  	  VP                  RRRRR7       VP                  RRRR7       \        V4       F0  w  rVVP                  R	V,          R
,           RWdRR7      pV! W4       K2  	  VP                  RRRRR7       VP                  R
RRR7       \        V4       F1  w  rVVP                  R	V,          R
,           R
WdR^R7      pV! W4       K3  	  VP                  RR
RRR7       R# )   text.kerning_factorgffffff?r%   ZC2r#   )colorZ	linewidthc                 s  < \         P                  ! R^^RV P                  R7      pVP                  VP	                  S4      P                  V P                  P                  4       4      P                  4       V P                  V4       R# )r    F)clip_on	transformNr    r    )	mpatchesZ	Rectangle	transAxesZ
set_boundsget_window_extentZtransformedZinvertedZboundsZ	add_patch)r.   ttrrenderers   && r   draw_boxZ!test_multiline2.<locals>.draw_box   se    vq!U)+7	  *[..01V	 	Qr   leftr"   r!   bottom)horizontalalignmentverticalalignmentg333333?zBottom alignr?   g?r3   z	Top aligng?baselinezBaseline align)rL   rM   rotationzBot align, rot20N)ZLinez2 Lineg
 2 Lgz$\sum_i x $zhi $\sum_i x $
testztest
 $\sum_i x $z$\sum_i x $
 $\sum_i x $)
r(   rcParamsr)   set_xlimset_ylimZaxhlinecanvasget_renderer	enumerater9   )	r-   r.   ZstsrI   ZhoralZnnZstrF   rH   s	           @r   test_multiline2rW      s    +,CLL&'llnGCKKCKKAJJs$#J.ACzz&&(H EC.WWS2X^S"'/  1 ! GGCnDG1JJs$#J.C.WWS2X^S"',  . ! GGCkG.JJs$#J.C.WWS2X^S"'1  3 ! GGC&dG3JJs$#J.C.WWS2X^S"'/"  > ! GGC(G5r   zantialiased.pngc            	      s^   R \         P                  R&   \        P                  ! RR7      p V P	                  RRRRRRR7       V P	                  RR	R
RRRR7       R\         P                  R&   V P	                  RRRRRR R7       V P	                  RR	R
RRR R7       R \         P                  R&   R# )Ftext.antialiased      ?figsizer#   antialiasedr2   T)rL   rM   r\         ?z
$\sqrt{x}$ffffff?znot antialiasedN)g      @rY   )r   rQ   r(   r6   r9   r-   r;   r   test_antialiasingr`      s    ',CLL#$
**\
*CHHS$8'T  ;HHS$8'T  ; (,CLL#$HHS$)x'U  <HHS$8'U  < (-CLL#$r   c                  s    \         P                  P                  R RR7      p \        V R4      ;_uu_ 4       p\         P                  P                  V4      pRRR4       R#   + '       g   i     R# ; i)Z	Helveticaafm)ZfontextZrbN)r   font_managerr   ZopenZ_afmZAFM)ZfnZfhra         r   test_afm_kerningrd      sH    				"	";	"	>B	b$2hhll2 
s    A  A1	ztext_contains.pngc            	      s$   \         P                  ! 4       p \         P                  ! 4       p\        R V P                  RR^R4      p\
        P                  ! RR^4      p\
        P                  ! RR^4      p\
        P                  ! W44      w  r4\         P                  ! RRRR^^R7      pV P                  P                  4        \        VP                  VP                  4       F  w  rg\         P                  ! 4       P                  P                  Wg.4      w  Vn        Vn        VP#                  V4      w  rV'       d   R	MR
p
VP$                  P'                  4       pVP)                  WgRV
R7       VP$                  P+                  V4       K  	  R# )button_press_eventr%   Nr]   rY   r$   zhello worldr2   )r4   fontsizerP   ZyellowZredorN   )r(   r6   Zaxesr   rT   npZlinspaceZmeshgridr9   drawzipZflatgcarD   rA   xycontainsZviewLimZfrozenplotset)r-   r.   ZmeventZxsystxtrl   rm   rn   _r?   Zvls               r   test_containsrt      s"   
**,C	B,cjj#sAtLF	T4	$B	T4	$B[[ FB
((S-HrBHC JJOOBGGRWW% WWY00::A6B&(ll6*$% ZZ 
c'


r &r   c                  s    \         P                  ! 4       w  rVP                  R RRRR/R7      pV P                  P	                  4        \        RV P                  .VP                  P                  R4      O5!  pR# )	ZhelloZ
arrowstylez->)xyxytext
arrowpropsre   N)r$   r$   )333333?rx   )r%   rx   )r(   r)   r*   rT   ri   r   Z	transDatarA   )r-   r.   annZevent       r   test_annotation_containsr{      sm     llnGC
++HX<:N  PCJJOOcjjM+-<<+A+A(+KMEr   zerr, xycoords, matchz<xycoords callable must return a BboxBase or Transform, not az,'xycoords' must be an instance of str, tuplefooz'foo' is not a valid coordinatezfoo barz#'foo bar' is not a valid coordinatez
offset fooz'xycoords cannot be an offset coordinatezaxes fooz'foo' is not a recognized unitc           	      s
   \         P                  ! 4       w  r4\        P                  ! WR 7      ;_uu_ 4        VP	                  RRRVR7       VP
                  P                  4        RRR4       R#   + '       g   i     R# ; i)matchru   )rv   r   NrB   r%   r%   )r(   r)   pytestraisesr*   rT   ri   )Zerrr   r~   r-   r.   s   &&&  r   test_annotate_errorsr     sQ     llnGC	s	(	(
D&hG

 
)	(	(	(s   0A11B	Ztitlesc                  s    \         P                  ! 4        \         P                  ! ^^^4      p V P                  RRR7       V P                  RRR7       V P	                  . 4       V P                  . 4       R# )r1   z
left titlerJ   loczright titlerightN)r(   r6   r7   r8   r+   r,   r:   r;   r   test_titlesr     sW     JJL	Q1	BLL6L*LLGL,MM"MM"r   Ztext_alignmentc                  s   \         P                  ! 4        \         P                  ! ^^^4      p RpR FS  pR FJ  pV P                  VRVR,           W2\	        RRRR7      R7       V P                  VRR	W2R
7       VR,          pKL  	  KU  	  V P                  ^ ^.RR.4       V P                  ^ ^.RR.4       V P                  ^ ^4       V P                  ^ R4       V P                  . 4       V P                  . 4       R# )r1   r!   r%   z TjZroundZwheat)boxstyle	facecoloralpha)r5   rP   bboxg      ?z$\sum_{i=0}^{j}$)r5   rP   g      ?N)r       )r3   rK   rO   r2   )
r(   r6   r7   r9   dictro   rR   rS   r+   r,   )r.   rl   rP   Z	alignmentrz   r   test_alignmentr     s    JJL	Q1	BA@IGG3	E)i7gSI  K GG3+	  NHA A  GGQFS#JGGQFS#JKK1KK3MM"MM"r   zaxes_titles.pngc                  s    \         P                  ! 4        \         P                  ! ^^^4      p V P                  RR^RR7       V P                  RR^RR7       V P                  RR^RR7       R# )r1   r2   i  )r   rf   Z
fontweightrJ   i  r   N)r(   r6   r7   r8   r:   r;   r   test_axes_titlesr   7  s[     JJL	Q1	BLLx"LELLVbSLALLgsLCr   c                  s`   \         P                  ! 4       w  rVP                  R RRRR7      pV P                  P	                  4        VP                  V P                  P                  4      p^pVP                  WD34       V P                  P	                  4        VP                  V P                  P                  4      p\        VP                  VP                  4       F  w  rgK  	  VP                  R RRRR7      pV P                  P	                  4        VP                  V P                  P                  4      p^pWD3Vn
        V P                  P	                  4        VP                  V P                  P                  4      p\        VP                  VP                  4       F  w  rgK  	  R# )testfigure pixels)rv   
textcoordsNrB   )r(   r)   r*   rT   ri   rE   rH   Zset_positionrj   ZminZxyann)r-   r.   ry   Zinit_posZ	shift_valZpost_posr/   Zb           r   test_set_positionr   A  sH   llnGC ++v/  CCJJOO$$SZZ%8%89HIi+,JJOO$$SZZ%8%89HHLL(,,/1/ ++v/  CCJJOO$$SZZ%8%89HI&CIJJOO$$SZZ%8%89HHLL(,,/1/r   c                  s   \         P                  ! 4       p V P                  R RR4      pVP                  R4       VP	                  4       pVP
                  VP                  ,
          pVP                  R4       VP	                  4       pVP
                  VP                  ,
          pVP                  R4       VP	                  4       pVP                  pR# )r!   ? iZmZiiiimmmmN)r(   r6   r9   Zset_textrE   Zx1Zx0)r-   r9   r   Zsize_iZsize_mZorigin         r   test_char_index_atr   a  s    
**,C88Cb!DMM#!!#DWWtwwFMM#!!#DWWtwwFMM*!!#DWWFr   r9   r   ZOZemptyz	non-empty)Zidsc                 s   \         P                  ! 4       w  rVP                  R R V RRR7      pVP                  P	                  4        VP
                  pVP                  4       pVP                  V^
,          R7      p\        P                  P                  VP                  4       VP                  4       ^
,          RR7       R# )r%   rJ   rK   )r4   r5   dpi皙?ZrtolN)r(   r)   r9   rT   ri   r   rE   rh   testingassert_allclose
get_points)r9   r-   r.   t1r   Zbbox1Zbbox2s   &      r   test_non_default_dpir   {  s    llnGC	c4Fx	8BJJOO
''C  "E  S2X .EJJu//153C3C3E3J$(  *r   c                      R # Nr   r   r   r   test_get_rotation_stringr         r   c                      R F  p K  	  R# )      .@N)r   g333330@gYS@r   r   r;   r   test_get_rotation_floatr     s
    r   c                  r   )C   N)r   i   i)   r   r   r;   r   test_get_rotation_intr     s	    \r   c                  s    \         P                  ! \        4      ;_uu_ 4        \        R R7       RRR4       R#   + '       g   i     R# ; i)Z
hozirontalrP   Nr   r   
ValueErrorr   r   r   r   test_get_rotation_raisesr     s(    	z	"	"l# 
#	"	"	"s	   :A	c                  r   r   r   r   r   r   test_get_rotation_noner     r   r   c                  s    \        . RO. RO4       F)  w  r\        \        V R7      P                  4       V4       K+  	  R# )     v@r   N)r   g     w@g	@)        g      1@gfffff&f@)rj   r   r   get_rotation)r   Zj     r   test_get_rotation_mod360r     s/    +-=>D!,99;Q? ?r   r4   r5   c                 s   \         P                  ! 4       w  r#\        ^ WR7      pVP                  ! RRR/VB pVP                  ! RRR/VB pVP                  P                  4        \        VP                  VP                  P                  4      P                  4       VP                  VP                  P                  4      P                  4       4       R# )r    )rP   r5   r4   Zrotation_modeZanchorZdefaultN)r%   r%   r   )
r(   r)   r   r9   rT   ri   r   rE   rH   r   )r4   r5   r-   r.   r   Zt0r   s   &&     r   %test_null_rotation_with_rotation_moder     s     llnGC	qR	'B		>x	>2	>B		?y	?B	?BJJOO,,SZZ-@-@ALLN,,SZZ-@-@ALLNPr   Ztext_bboxclipc                  s    \         P                  ! R RRRRR7       \         P                  ! R RRRR7      p V P                  R	R
/4       R# )r   r"   zIs bbox clipped?rG   T)Zbackgroundcolorr@   r%   zIs fancy bbox clipped?r@   r   zround, pad=0.1N)r(   r9   Zset_bbox)tr;   r   test_bbox_clippingr     s>    HHS#)3Mc3TBAJJ
,-.r   z!annotation_negative_ax_coords.pngc            
      s~   \         P                  ! 4       w  rVP                  R ^^.R^^.R^ R7       VP                  R^R.R^R.R^ RR7       VP                  RRR.R	RR.R	^ R7       VP                  R
RR.R	RR.R	^ RR7       VP                  R^^.R^^.R^ R7       VP                  R^R.R^R.R^ RR7       R# )+ ptszaxes pointsrv   r   ru   r   rf   - ptsr3   rv   r   ru   r   rf   r5   + fracrY   r   r   - frac+ pixelszaxes pixels- pixelsNi皙ir(   r)   r*   r-   r.   r   r   "test_annotation_negative_ax_coordsr     s   llnGCKKBxM8mb  B KKCy]9}r   KKd|$</B  H KKe}%=?R  
 KK
Ry]9}r  C KK
Szm:  r   z"annotation_negative_fig_coords.pngc            
      s~   \         P                  ! 4       w  rVP                  R ^
^x.R^
^x.R^ R7       VP                  RR^.RR^.R^ RR7       VP                  RRR.R	RR.R	^ R7       VP                  R
RR.R	RR.R	^ RR7       VP                  R^2^2.R^2^2.R^ R7       VP                  RR^d.RR^d.R^ RR7       R# )r   zfigure pointsr   r   r3   r   r   r   g?zfigure fractionr   r%   r   r   r   Nr   ir   r   r   r   #test_annotation_negative_fig_coordsr     s   llnGCKKCy_9  E KKSzo:"   KKd|0A$<*;b  J KKs|0A3<*;b  
 KK
BxO8o  D KK
Szo:"  r   c                  s    \         P                  ! ^^4      w  p w  r\         P                  ! 4        VP                  RRR4      pVP	                  RRR.R7      p\         P                  ! 4        R# )r1   r%   Zaardvarkru   N)r(   r)   Zdraw_allr9   r*   )r-   ax1ax2Ztxt1Zann1        r   test_text_staler     sX    ll1a(OC#LLN
 88BJ'D
 <<
Bx<0D
 LLNr   zagg_text_clip.pngc                  s   \         P                  P                  ^4       \        P                  ! ^4      w  p w  r\         P                  P                  ^
^4       F+  w  r4VP                  W4RRR7       VP                  W4R4       K-  	  R# )r1   r|   Tr   N)rh   ZrandomZseedr(   r)   Zrandr9   )r-   r   r   rl   rm   r   r   test_agg_text_clipr     s`    IINN1ll1oOC#		r1%ud+u &r   c                  s    ^
\         P                  R&   \         P                  P                  RR7      p V P	                  4       p^d\         P                  R&   R# )
   z	font.sizeZlarger   N)r   rQ   rb   r   Zget_size_in_points)ZfpZsz1r   r   test_text_size_bindingr     sE     "CLL				(	(g	(	6B



!C #CLLr   zfont_scaling.pdfc                  s   ^*\         P                  R&   \        P                  ! RR7      w  rVP                  P                  \        P                  ! 4       4       VP                  P                  \        P                  ! 4       4       VP                  R	R4       \        \        ^^+^4      4       F$  w  r#VP                  RV^,          V R2VR7       K&  	  R# )
*   pdf.fonttyperZ   iX  r!   z pt font size)rf   N)g@g(@r   )r   rQ   r(   r)   xaxisZset_major_locatorZNullLocatoryaxisrS   rV   ranger9   )r-   r.   r   Zfsrz   r   test_font_scalingr     s    #%CLL ll;/GCHHs01HHs01KKS5B?+
QrTbT/"= ,r   zspacing1, spacing2c                 sD   R p\         P                  ! 4       pVP                  P                  4       pVP	                  RRW R7      pVP	                  RRW!R7      pVP                  P                  4        VP                  VR7      pVP                  VR7      pW8X  d   R# R# )zline1
line2r]   r%   ZlinespacingrH   N)r(   r6   rT   rU   r9   ri   rE   )	Zspacing1Zspacing2Ztext_stringr-   rH   text1text2Zbox1Zbox2s	   &&       r   test_two_2line_textsr   )  s     K
**,Czz&&(HHHT3HBEHHT3HBEJJOO""H"5D""H"5D r   c            	      s    \         P                  ! \        4      ;_uu_ 4        \        P                  ! R RRRR7       RRR4       R#   + '       g   i     R# ; i)r]   r%   r|   Zabcr   N)r   r   	TypeErrorr(   r9   r   r   r   test_validate_linespacingr   >  s2    	y	!	!b%U3 
"	!	!	!   AA	c                  s    \         P                  ! 4       w  rVP                  ^ \        P                  R4       VP                  \        P
                  ^ R4       V P                  P                  4        R# )r    naninfN)r(   r)   r9   rh   r   r   rT   ri   r   r   r   test_nonfinite_posr   C  sE    llnGCGGArvvuGGBFFAuJJOOr   c                  s   ^\         P                  R&   \         P                  ! 4       p V P                  RRR4      pV P	                  \
        P                  ! 4       RR7       VP                  4       P                  pV P	                  \
        P                  ! 4       RR7       \        P                  P                  VP                  4       P                  VRR7       R	# )
r1   ztext.hinting_factorr%   z	some textsvgZformatpngr!   r   N)r(   rQ   r6   r9   savefigioBytesIOrE   Z	intervalxrh   r   r   )r-   r   Zexpectedrc   r   test_hinting_factor_backendsr   J  s    *+CLL&'
**,Cc;'AKK

UK+""$..HKK

UK+JJq224>>$'  )r   c                  sP   \         P                  ! 4       p R \         P                  R&   V P                  ^y4      pR\         P                  R&   V P                  ^z4      pV P                  P                  4        VR 3VR33 F"  w  r4VP                  P                   F  pK  	  K$  	  R# )Ftext.usetexTN)r(   r6   rQ   add_subplotrT   ri   r   
majorTicks)r-   r   r   r.   usetexr   r   r   test_usetex_is_copiedr   X  s     **,C"'CLL
//#
C"&CLL
//#
CJJOOU|c4[1
$$A$ 2r   c                  s    \         P                  ! 4       p V P                  R R RRR7       V P                  P	                  4        R# )r%   z	$\frac12$Tr   Nr(   r6   r9   rT   ri   r_   r;   r   test_single_artist_usetexr   g  s1    
 **,CHHR\$H/JJOOr   fmtr   c                 s    R \         P                  R&   \         P                  ! 4       pVP                  RRRRR7       VP	                  \
        P                  ! 4       V R7       R# )Tr   r%   Z2_2_2Fr   r   N)r(   rQ   r6   r9   r   r   r   )r   r-      & r   test_single_artist_usenotexr   q  sG     #'CLL
**,CHHRWUH+KK

SK)r   ztext_as_path_opacity.svgc                  s   \         P                  ! 4        \         P                  ! 4       P                  4        \         P                  ! R R RR
R7       \         P                  ! R RRRR7       \         P                  ! R RRRRR7       R	# )r]   cr%   rN   r/   r   rY   rl   r   r?   Nr    r    r    r%   r    r    r    r1   )r(   r6   rk   set_axis_offr9   r   r   r   test_text_as_path_opacityr   }  sU    JJLGGIHHT4N3HHT33'HHT4C|<r   ztext_as_text_opacity.svgc                  s:   R \         P                  R&   \        P                  ! 4        \        P                  ! 4       P                  4        \        P                  ! RRRRR7       \        P                  ! RRRRR7       \        P                  ! RRR	RRR
7       R# )Znonezsvg.fonttyper]   z50% using `color`r%   rN   z50% using `alpha`r   rY   z"50% using `alpha` and 100% `color`r   Nr   r   )r   rQ   r(   r6   rk   r   r9   r   r   r   test_text_as_text_opacityr     si    #)CLL JJLGGIHHT4,NCHHT3+37HHT4=S!r   c                  s    \         P                  ! R R.^^.4       \        \         P                  ! R .RR4      4       R# )ZAZBr%   ZBooN)r(   ro   Zreprr9   r   r   r   test_text_reprr     s/    HHc3Z!Q 3%e	$%r   c                  s"   \         P                  ! ^^4      w  rVP                  RRR7      pVP                  V P                  P                  4       4      pV P                  4        VP                  V P                  P                  4       4      pR# )r1   
annotationr   Nr   )r(   r)   r*   rE   rT   rU   Ztight_layout)r-   r.   ZanZextent1Zextent2r   r   test_annotation_updater     sl    ll1a GC	\j	1B""3::#:#:#<=G""3::#:#:#<=Gr   )
extensionsc                 s   V P                  4       pVP                  \        P                  ! 4       ^R4       VP	                  R\        P                  ! 4       R3RR	RR7       VP                  4       pVP                  \        P                  ! 4       ^R4       VP	                  R\        P                  ! 4       R3RR7       R# )
r1   rg   rl   r%   offset points)r   rv   r   )r   N)datar   rB   )r   ro   r   Znowr*   fig_testfig_refr.      && r   test_annotation_unitsr    s    				BGGHLLNAs#KKhllnc*5N/  ; 
			BGGHLLNAs#KKhllnc*5NKOr   zlarge_subscript_title.pngc                  s   ^\         P                  R&   R\         P                  R&   \         P                  ! ^^RRR7      w  rV^ ,          pVP                  R4       VP                  RRR	7       VP	                  . 4       V^,          pVP                  RR
R7       VP                  RRR	7       VP	                  . 4       R# )r=   r>   Nzaxes.titleyT)r[   Zconstrained_layoutz$\sum_{i} x_i$zNew wayrJ   r   g)\(?)rm   zOld Way)i	   g      @)r(   rQ   r)   r8   Zset_xticklabels)r-   Zaxsr.   rc   r   test_large_subscript_titler    s     +,CLL&'"&CLL||Aq(tLHC	QBLL"#LLL'r	QBLL"dL+LLL'rr   zx, rotation, halignc           	      s    \         P                  ! RR7      p\        ^^VR7      pVP                  VR	,          4      pRpVP	                  V RVRWR7      pVP
                  P                  4        R# )
   rZ   )ZnrowsZncolsr6   z?This is a very long text that should be wrapped multiple times.r^   T)wraprP   r4   N)r  r  r1   r1   )r(   r6   r   Zadd_subfigurer9   rT   ri   )rl   rP   Zhalignr-   ZgsZsubfigsr9   s   &&&     r   	test_wrapr    sb     **X
&C	3	/Br$x(F 	JA;;q#qth;JDJJOOr   c                  s    \         P                  ! RR7      p RpV P                  ^ RV^(RR7      pV P                  P	                  4        R# )r=   rZ   z;This is a very $\overline{\mathrm{long}}$ line of Mathtext.r%   T)r   r	  Nr=   i   r   )r-   r  r9   rc   r   test_mathwrapr    s;    
**V
$CFA88AsABT82DJJOOr   c                  s   \         P                  ! RR7      p V P                  RRR7       V P                  P	                  4       p\         P                  ! RR7      pVP                  R4       VP                  P	                  4       pR# )   rZ   z.suptitle that is clearly too long in this caseTr	  z.suptitle that is clearly
too long in this caseN)r  r  )r(   r6   ZsuptitleZ	_suptitlerE   )Zfig1Zwindow_extent_testZfig2Zwindow_extent_refrz   r   test_get_window_extent_wrappedr    sd     ::f%DMMBMN99;::f%DMMCD88:r   c                  s    \         P                  ! RR7      p V P                  R^RRR7      pV P                  P	                  4        R# )r=   rZ   g      #@ZAlonglineoftexttowrapTr  Nr  r   r-   r9   r   r   test_long_word_wrapr    s5    
**V
$C88C3$8?DJJOOr   c                  s    \         P                  ! RR7      p V P                  ^ ^ RRR7      pV P                  P	                  4        R# )r=   rZ   znon wrapped textTr  Nr  r   r  r   r   test_wrap_no_wrapr    s5    
**V
$C88Aq,488DJJOOr   c                 sJ   V P                  4       pVP                  ^ ^.4       VP                  RR.4       VP                  P                  ^,          P
                  P                  R4       VP                  4       pVP                  ^ ^.4       VP                  RR.4       R# )r    u   €r/   Zwr   N)r   r,   Zset_yticklabelsr   r   Zlabel1Z	set_colorr  r  r   test_buffer_sizer    s    
 
			BMM1a&s|$HH!!++C0				BMM1a&r{#r   c                 s    \         P                  ! 4        \         P                  ! RRRR7      p \         P                  ! RRRR7      pR# )z>Test that kwargs take precedence over fontproperties defaults.ZvaluezTimes New Romang      D@)r   r   Zcounts)r   r   N)r(   r6   ZxlabelZylabel)r   r   r   r   $test_fontproperties_kwarg_precedencer  
  s1    JJLJJw/@tLEJJxd;LMEr   c                  s    \         P                  ! 4       p \        P                  ! 4       P	                  ^4      pV P                  ^ ^ RVRR7      pVP                  4       p\        V^4       R# )r   r   T)rA   Ztransform_rotates_textN)r(   rk   mtransformsZAffine2DZ
rotate_degr9   r   r   )r.   rA   r9   Zresultrz   r   test_transform_rotates_textr    s\    	B$$&11"5I771a9*.  0D F#r   c                  s    \        \        R R7      RR7      p \        V 4      p\        4       pVP                  V 4       R# )r   )r   N)r   r   )r   r   r   Zupdate)ZinpZcacher   rc   r   test_update_mutate_inputr    s1    
nF;CIEAHHSMr   rP   zinvalid stringc           	      s    \         P                  ! \        R R7      ;_uu_ 4        \        ^ ^ RV R7       RRR4       R#   + '       g   i     R# ; i)z5rotation must be 'vertical', 'horizontal' or a numberr}   r|   r   Nr   r   s   &r   test_invalid_rotation_valuesr  &  sD    	J
M 
M 	Q58,
M 
M 
M 
Ms	   ?A	c            	      s    \         P                  ! \        4      ;_uu_ 4        \        P                  ! R R RRR7       RRR4       R#   + '       g   i     R# ; i)r%   r|   Zfoobar)r   N)r   r   r   r(   figtextr   r   r   test_invalid_colorr  .  s2    	z	"	"BEX. 
#	"	"	"r   ztext_pdf_kerning.pdfc                  sd    \         P                  ! 4        \         P                  ! R RR^R7       R# )r!   r%   ZATATATATATATATATATAr   N)r(   r6   r  r   r   r   test_pdf_kerningr  3  s    JJLKKS/b9r   c                 s    \         P                  ! 4       pVP                  R R R4      pVP                  P	                  4        R# )r%   u   ০Nr   )Zrecwarnr-   r   s   &  r   test_unsupported_scriptr  9  s.    
**,CR12AJJOOr   z1Error messages are incorrect with pyparsing 3.1.0)Zreasonc                  sr   \         P                  ! 4       w  rVP                  ^ ^ RRR7       V P                  P	                  4        VP                  ^ ^ RRR7       \
        P                  ! \        RR7      ;_uu_ 4        V P                  P	                  4        RRR4       R#   + '       g   i     R# ; i)r    $ \wrong{math} $F)Z
parse_mathTUnknown symbolr}   N)r(   r)   r9   rT   ri   r   r   r   r   r   r   test_parse_mathr!  F  sx     llnGCGGAq%%G8JJOOGGAq%$G7	z)9	:	:

 
;	:	:	:s    B%%B6	c                  s   \         P                  ! 4       w  rVP                  ^ ^ R4       \        P                  ! \
        RR7      ;_uu_ 4        V P                  P                  4        RRR4       \        P                  ! RR/4      ;_uu_ 4        \         P                  ! 4       w  rVP                  ^ ^ R4       V P                  P                  4        RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)r    r  r   r}   Nztext.parse_mathF)
r(   r)   r9   r   r   r   rT   ri   r   Z
rc_contextr   r   r   test_parse_math_rcparamsr"  S  s     llnGCGGAq%&	z)9	:	:

 
; 
*E2	3	3,,.
1)*

 
4	3	 
;	: 
4	3	3s   C!AC4!C1	4D	ztext_pdf_font42_kerning.pdfc                  s    ^*\         P                  R&   \         P                  ! 4        \         P                  ! RRR^R7       R# )r   r   r!   r%   ZATAVATAVATAVATAVATAr   Nr(   rQ   r6   r  r   r   r   test_pdf_font42_kerningr$  c  s,    #%CLL JJLKKS/b9r   ztext_pdf_chars_beyond_bmp.pdfc                  s    ^*\         P                  R&   R\         P                  R&   \         P                  ! 4        \         P                  ! RRR^R7       R# )	r   r   Zstixsanszmathtext.fontsetr!   r%   u   Mass $m$ 𐌈r   Nr#  r   r   r   test_pdf_chars_beyond_bmpr%  j  s;    #%CLL '1CLL#$JJLKKS/b9r   c                  s  a \         P                  P                  P                  4        \        P
                  ! 4       p V P                  R RR4       V P                  R RRRR7       V P                  RRRRR7       V P                  P                  4        V P                  4       p/ oV3R lpW!n	        V P                  P                  4        \         P                  P                  P                  4       pR# )r#   r%   foo
barTr   c                  sd   < V vr#rEpSP                  V\        4       4      P                  V4       R # r   )Z
setdefaultrp   Zadd)ZargsZkwargsrH   rl   rm   r  rs   rq   s   *,     r   callZ test_metrics_cache.<locals>.call~  s*     $QA
a##A&r   N)r   r9   Z!_get_text_metrics_with_cache_implZcache_clearr(   r6   rT   ri   Z_get_rendererZdraw_texZ
cache_info)r-   rH   r'  Zinforq   s       @r   test_metrics_cacher(  r  s    HH..::<
**,CHHRZ HHRZH-HHRZH-JJOO  "H	B' JJOO 8855@@BDr   c                  s   \         P                  ! 4       w  rR R.pRR	.p\        ^4       Uu. uF&  pVP                  RR
W4,          RRW$,          R7      NK(  	  ppR V 4       w  rgV P                  P                  4        R# u upi )r   zoffset fontsizer   Z10r  )ru   rv   rf   r   r   c              3   s@   "   T F  qP                  4       x  K  	  R # 5ir   )rE   )Z.0ry   r   r   Z	<genexpr>Z0test_annotate_offset_fontsize.<locals>.<genexpr>  s     %N#&;&;&=&=s   N)r   r   r
  r   )r(   r)   r   r*   rT   ri   )r-   r.   Ztext_coordsZxy_textr   ZannsZpoints_coordsZfontsize_coordsr   r   test_annotate_offset_fontsizer)    s    llnGC"$56K G
 =B!H	F =Eq	 KK:&z!%!'#.>	  3 =E	 	 F
 &O%N"MJJOOFs   ,Bc                  sd    \        R R R4      p V P                  R4       V P                  R4       R# )r%   r&  TFN)r   set_antialiased)rr   r;   r   test_get_set_antialiasedr+    s0    
r2z
"C  r   c                  s    \        R RRR7      p \        R RRR7      p\        R RRR7      pVP                  R4       \        R R4      pR# )r&  Tr\   FNr   )r   r*  )ZannotZannot2Zannot3Zannot4rz   r   test_annotation_antialiasedr-    sL    z8>E 
H%@F 
H%@F
4  
H-Fr   c                 s   V P                  4       pVP                  ^ ^.^ ^.4      w  p\        P                  ! RR.4      pVP	                  R\        W44      RR	R7       ^VR&   VP                  4       pVP                  ^ ^.^ ^.4      w  p\        P                  ! RR.4      pVP	                  RWSRRR7       ^VR&   R# )
r    r%   r|   )r   rv   ru   :NNNr   )ru   r   rv   r   N)r   r    rB   )r   ro   rh   Zarrayr*   r   )r  r  r.   ZlZof_xyZan_xys   &&    r   'test_annotate_and_offsetfrom_copy_inputr.    s     
			B	!Q!Q	 BAHHb"XEKK*Q"6w  E!H				B	!Q!Q	 BAHHb"XEKK%GKXE!Hr   c                 |    V P                  R R RRR7       R\        P                  R&   VP                  R R R4       R# )r%   6 inches x 2 inchesFr,  rX   Nr9   r   rQ   r  r     &&r   +test_text_antialiased_off_default_vs_manualr4    s?    MM#s1).  0 (-CLL#$LLc01r   c                 r/  )r%   r0  Tr,  rX   Nr1  r2  r3  r   *test_text_antialiased_on_default_vs_manualr5    s7    MM#s1tMD'+CLL#$LLc01r   c                  s   \        ^dR7      p \        ^^^d4      p\        RRRR7      pVP                  V 4       \	        R^ ^ R7      pVP                  V 4       VP                  VR7      pVP                  VR7      pVP                  RVP                  RR	7      w   rgVP                  R
VP                  RR	7      w   rh\        Wx4      p	VP                  4       p
R# )d   r   r   r   )ru   r   )r9   rl   rm   r   r9   F)ZismathZlpNrB   )
r   r   r   
set_figurer   rE   Zget_text_width_height_descentZ_fontpropertiesZmaxr   )r6   rH   r   r9   r   	text_bboxrs   ZdZlp_dZ
below_linepoints              r   &test_text_annotation_get_window_extentr;    s    _F3S)H FvHJ&!VqA&DOOF''':D&&&9I 44
**5 5 :GAq77j(( 8 8JAqQJ __Fr   c                  s    ^p \         P                  ! ^dR7      w  rVP                  R^ ^ R7      pVP                  RRRRRRR^R	V R
R/R7      p\         P                  ! 4        VP
                  P                  pVP                  VR7      pVP                  VR7      pVP                  P                  V4      p\        P                  ! V4      p	\        P                  P                  W.4      p
\        VP                  V
P                  4       R# )i   r   r   )r  rl   rm   r   r   r   blackwidth	headwidthshrinkru   rv   r   rw   r   Nr         I@rB  rB  )r(   r)   r9   r*   ri   rT   rH   rE   Zarrow_patchr   r  ZBboxZunionr   height)r>  r-   r.   rr   ry   rH   r8  r   Z
arrow_bboxZann_txt_bboxZexpected_bboxr:  r   1test_text_with_arrow_annotation_get_window_extentrE    s    Ills#GC
''Fa1'
%C
++o'1Hc3	  4C HHJzz""H%%x%8I  ( 3D228<J))#.L  $$**L+EFM]%9%9:r   c                  s   ^dp V ^H,          p\        V R7      pVP                  R4       VP                  R4       \        ^^^d4      p\	        RRRRRRR^R	^
R
R/R7      pVP                  V4       VP                  V4       VP                  4       pVP                  4       p\        VP                  RV,          4       R# )r6  r          @r   r   r   r   r<  r=  r>  r?  r@  g      $@NrA  rC  )r   set_figwidthset_figheightr   r   r7  ri   rE   r   r   rD  )r   Zdots_per_pointr6   rH   r   r   r9  s          r   'test_arrow_annotation_get_window_extentrI  $  s    
C2XN_F

3S)H 
{</'1k2xNOJ &!OOH'')D__F TN%:;r   c                  s   \        ^dR7      p V P                  R4       V P                  R4       \        ^^^d4      p\	        RRRRR7      pVP                  V 4       VP                  V4       VP                  4       pVP                  4       pR# )r6  r   rF  r   r   )ru   rv   r   NrA  )	r   rG  rH  r   r   r7  ri   rE   r   )r6   rH   r   r   r9  r   r   'test_empty_annotation_get_window_extentrJ  =  s    _F

3S)H 
{;JJ&!OOH'')D__Fr   Zbasictext_wrap)Zbaseline_imagesr   c                  s   \         P                  ! 4       p \         P                  ! . RO4       Rp\         P                  ! ^^VR^RR7       \         P                  ! ^^VR^RR7       \         P                  ! ^^VRRRR7       \         P                  ! ^^
V^RRRRR	7       \         P                  ! ^^VR
RRRR7       \         P                  ! R^ VRRRR7       R# )r    This is a really long string that I'd rather have wrapped so that it doesn't go outside of the figure, but if it's long enough it will go off the top or bottom!rJ   T)r4   rP   r	  r   Zobliquer2   r3   )rf   r   r4   r5   r	  serifr    )r   r   r4   r	  Nr    r   r    r   r(   r6   Zaxisr9   r-   r   r   r   test_basic_wraprR  R  s     **,CHH^	*A HHQ1"48HHQ1"48HHQ13T:HHQA)D"HHQ1WHtLHHRA&3T:r   Zfonttext_wrapc                  s   \         P                  ! 4       p \         P                  ! . RO4       Rp\         P                  ! ^RV^RR^RR7       \         P                  ! ^^VRR^RR7       \         P                  ! ^^
VRR	R
RR7       \         P                  ! ^^VRRRR7       \         P                  ! R^ V^RRRRR7       R# )r    rK  rL  rJ   T)rf   r   r4   rP   r	  r   )r   r4   rP   r	  Zheavyr2   r3   )r   r4   r5   r	  Z	monospacer   )r   r4   r	  r    )rf   r   r4   rP   r	  NrM  rO  rN  rP  rQ  r   r   test_font_wraprS  c  s     **,CHH^	*A HHQA7vHHQ1\frMHHQAg(u4HHHQ1[W4@HHRA(vr   )r2   r   rJ   )r2   r3   rK   rO   Zcenter_baseline))r$      )rT  r$   )rT  rT  )r   Zpdfr   ))r^   r    rJ   )r%   i_   rJ   )r#   r    r   )r#   i   rJ   )r  r1   r    )zr   r   r'   Znumpyrh   Znumpy.testingr   Zpackaging.versionr   Zparse_versionZ	pyparsingr   Z
matplotlibr   Zmatplotlib.backend_basesr   Zmatplotlib.backends.backend_aggr   Zmatplotlib.figurer   r&   r   Zmatplotlib.patchesZpatchesrC   Zmatplotlib.pyplotZpyplotr(   Zmatplotlib.gridspecr   Zmatplotlib.transformsZ
transformsr  Zmatplotlib.testing.decoratorsr	   r
   Zmatplotlib.testing._markersr   Zmatplotlib.textr   r   r   Z__version__Zpyparsing_versionr0   r<   rW   r`   rd   rt   r{   ZmarkZparametrizer   Zprintr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  ZxfailZreleaser!  r"  r$  r%  r(  r)  r+  r-  r.  r4  r5  r;  rE  rI  rJ  rR  rS  r   r   r   <module>rU     sC    	   - 4    / 7 $ 2 %  ( + O 4 8 8!)"7"78  =/"U #Up ;-  !. <.006 106f $%W5- 6-$D &'( )<	. /UVAGH9:ABHI=>2  8*  #$G4 5. $%&D 'D"@C4 "c+0FG H;
4
;
$
5@
 :;  ? @P@ <P ?#$/ %/ 678 96 789 :6. &'( )* %&'> (> -/KL* M*(4
) 3 3    56* 7* -./= 0= -./! 0!&& (P )P ./w? @" 22=9 ?: (
$ )
$$$( &6%=>- ?-/
 )*':: ;:
	I $,,	9M  OO $,,	9M  OO 01A: B: 237C: D: # #<6 5C$ ( ) 2 2 2 29> ;F52 * #3"4#W&;&; ?"3#W&&r   