
    
3j                         S SK Jr  S SKJr  S SKJr  S SKrS SKrS SK	r	S SK
rS SK
JrJr  SrSr\\0r\SS j5       rS	 rS
 rS rS rS rS rS rS rS rS rS r\	R<                  R?                  SSS/SS/S9S 5       r S r!S r"S r#S r$g)     )contextmanager)Path)TemporaryDirectoryN)pyplotstylez
image.cmappinkc              #     #    U(       d  [         nU  S3n[        R                  n [        5        n[	        XB5      R                  SR                  S UR                  5        5       5      SS9  [        R                  R                  U5        [        R                  " 5         Sv   SSS5        U[        l        [        R                  " 5         g! , (       d  f       N/= f! U[        l        [        R                  " 5         f = f7f)zAContext manager to create a style sheet in a temporary directory.	.mplstyle
c              3   4   #    U  H  u  pU S U 3v   M     g7f)z: N ).0kvs      U/home/wildlama/miniconda3/lib/python3.13/site-packages/matplotlib/tests/test_style.py	<genexpr>temp_style.<locals>.<genexpr>   s     C2B$!QCr!+2Bs   utf-8encodingN)
DUMMY_SETTINGSr   USER_LIBRARY_PATHSr   r   
write_textjoinitemsappendreload_library)
style_namesettings	temp_fileorig_library_pathstmpdirs        r   
temp_styler#      s      !,i(I11!V#..		C(..2BCC  / " $$++F3  " " $6  "! $6 s4   #D
C  A6C&C  .!D
CC   "DDc                     SS0nSn[        X!5          S S S 5        [        U R                  5      S:X  a   X R                  S   R                  5       ;   d   eg ! , (       d  f       NJ= f)Nfoobarbasename   r   )r#   lenrecords
getMessage)caplogSETTINGSr'   s      r   )test_invalid_rc_warning_includes_filenamer.   (   sa    u~HH	H	' 
( 1$NN1-88::< ;:	 
(	's   A
A&c                     S[         R                  ;  d   eS[         R                  ;   d   e[        S[        5         [        S[        5         S[         R                  ;   d   eS[         R                  ;   d   eS[         R                  ;  d   eS[         R                  ;   d   e S S S 5        S S S 5        S[         R                  ;  d   eS[         R                  ;  d   eg ! , (       d  f       NC= f! , (       d  f       NL= f)N_classic_test_patch_test_dummy)r   	availablelibraryr#   r   r       r   test_availabler6   2   s     777 EMM111	Hn	-z'>/R%//)))%--'''u...5==(((	 0S	-
 %//)))5??*** 0S/R	-	-s$   C6AC%(C6%
C3	/C66
Dc                  *   S[         R                  [        '   [        S[        5         [
        R                  " S5         [         R                  [           [        :X  d   e S S S 5        S S S 5        g ! , (       d  f       N= f! , (       d  f       g = fNgraytestmplrcParamsPARAMr#   r   r   contextVALUEr   r5   r   test_userA   @   sZ     CLL	FN	+]]6"<<&%/// # 
,	+"" 
,	+s"   B"A3"B3
B	=B
Bc                    U S-  nUR                  SSS9  [        S[        5         S[        R                  S:X  a  SOS	-   UR                  5       R                  5       -   n[        R                  " U5         [        R                  S
   S:X  d   e S S S 5        S S S 5        g ! , (       d  f       N= f! , (       d  f       g = f)Nfilezaxes.facecolor: adeader   r   r:   zfile:win32z/// zaxes.facecolorz#adeade)r   r#   r   sysplatformresolveas_posixr   r?   r<   r=   )tmp_pathpathurls      r   test_use_urlrM   G   s    fDOO,wO?	FN	+<<72%<((*+ ]]3<< 01Y>>>  	 
,	+  	 
,	+s$   AB47B#B4#
B1	-B44
Cc                 T   S[         R                  [        '   U S-  nUR                  [         S[         3SS9  [
        R                  " U5         [         R                  [           [        :X  d   e S S S 5        [         R                  [           S:X  d   eg ! , (       d  f       N,= f)Nr9   ztext.mplstylez : r   r   )r<   r=   r>   r   r@   r   r?   )rJ   rK   s     r   test_single_pathrO   R   s}     CLLo%DOOugS(7O;	t	||E"e+++ 
<<&((( 
	s   "B
B'c                  d   S[         R                  [        '   [        S[        5         [
        R                  " S5         [         R                  [           [        :X  d   e S S S 5        S S S 5        [         R                  [           S:X  d   eg ! , (       d  f       N4= f! , (       d  f       N== fr8   r;   r   r5   r   test_contextrQ   [   sr     CLL	FN	+]]6"<<&%/// # 
, <<&((( #" 
,	+s"   B!"B"B!
B	B!!
B/c                     Sn SnU [         R                  [        '   [        R                  " [        U05         [         R                  [           U:X  d   e S S S 5        [         R                  [           U :X  d   eg ! , (       d  f       N,= f)Nr9   blue)r<   r=   r>   r   r?   original_valueother_values     r   test_context_with_dictrW   d   sg    NK(CLL	{+	,||E"k111 
-<<.000 
-	,s   A==
Bc                  t   Sn SnU [         R                  [        '   [        S[        5         [
        R                  " S[        U0/5         [         R                  [           U:X  d   e S S S 5        S S S 5        [         R                  [           U :X  d   eg ! , (       d  f       N4= f! , (       d  f       N== fNr9   rS   r:   )r<   r=   r>   r#   r   r   r?   rT   s     r   'test_context_with_dict_after_namedstylerZ   m   s    NK(CLL	FN	+]]FUK$89:<<&+555 ; 
, <<.000 ;: 
,	+s#   B)B*B)
B&	"B))
B7c                  |   Sn SnU [         R                  [        '   [        S[        5         [
        R                  " [        U0S/5         [         R                  [           [        :X  d   e S S S 5        S S S 5        [         R                  [           U :X  d   eg ! , (       d  f       N4= f! , (       d  f       N== frY   r;   rT   s     r   (test_context_with_dict_before_namedstyler\   x   s    NK(CLL	FN	+]]UK0&9:<<&%/// ; 
, <<.000 ;: 
,	+s#   B-"B.B-
B*	&B--
B;c                     Sn SnSnX0nU [         R                  [        '   U(       + [         R                  U'   [        S[        5         [
        R                  " SU/5         [         R                  [           [        :X  d   e[         R                  U   U:X  d   e S S S 5        S S S 5        [         R                  [           U :X  d   e[         R                  U   U(       + :X  d   eg ! , (       d  f       NR= f! , (       d  f       N[= f)Nr9   ztext.usetexTr:   r;   )rU   other_paramrV   ds       r   .test_context_with_union_of_dict_and_namedstyler`      s    NKK	"A(CLL%0CLL	FN	+]]FA;'<<&%///<<,;;; ( 
, <<.000<<$[999	 (' 
,	+s$   	C;";C*C;*
C8	4C;;
D	c                     Sn Sn[         R                  " [        U05         [        R                  [           U:X  d   e[         R                  " [        U SS 05      n[
        R                  " [        SS9   U    S S S 5        S S S 5        [        R                  [           U:X  d   e S S S 5        g ! , (       d  f       N== f! , (       d  f       NF= f! , (       d  f       g = f)Nr9   rS   badparamz-'badparam' is not a valid value for rcParam\.)match)r   r?   r>   r<   r=   pytestraisesKeyError)rU   rV   xs      r   test_context_with_badparamrh      s    NK	{+	,||E"k111MM5.*dCD]]8!QS S ||E"k111 
-	,
 S S 
-	,s<   AC6C9B2;C%C2
C <C
C	C
C"equiv_styles)mpl20default)mpl15classicrj   rl   )idsc                 $   / nU  HO  n[         R                  " U5         UR                  [        R                  R                  5       5        S S S 5        MQ     US   n[        U SS  USS  5       H  u  pEX5:X  a  M   e   g ! , (       d  f       M  = f)Nr   r(   )r   r?   r   r<   r=   copyzip)ri   rc_dictsstyrc_basenmrcs         r   
test_aliasrw      s~    
 H]]3OOCLL--/0    qkGl12&5}} 6	  s   .B  
B	c                      [         R                  S   b   e[        R                  " 5         [         R                  S   S:X  d   e[        R
                  R                  5         [         R                  S   S:X  d   eg Nzpath.sketch)r(   d      )r<   r=   pltxkcdnptestingbreak_cyclesr   r5   r   test_xkcd_no_cmr      s^    <<&...HHJ<<&+555JJ<<&+555r5   c                      [         R                  S   b   e[        R                  " 5          [         R                  S   S:X  d   e S S S 5        [         R                  S   b   eg ! , (       d  f       N%= fry   )r<   r=   r|   r}   r   r5   r   test_xkcd_cmr      sY    <<&...	||M*k999 
<<&... 
s   A&&
A4c                      [         R                  R                  R                  1 [         R                  R
                  k::  d   eg N)r<   r   coreSTYLE_BLACKLISTrcsetup_validatorsr   r5   r   test_up_to_date_blacklistr      s.    99>>))-Gs{{/F/F-GGGGr5   c                 &   UR                  U 5        UR                  U 5        U S-  nUR                  5         US-  R                  SSS9  UR	                  S5      R                  SSS9  [
        R                  R                  S5        [
        R                  S	   S
:X  d   e[
        R                  R                  S5        [
        R                  S	   S:X  d   e[
        R                  R                  S5        [
        R                  S	   S:X  d   eg )Nmpl_test_style_pkgztest_style.mplstylezlines.linewidth: 42r   r   r
   zlines.linewidth: 84zmpl_test_style_pkg.test_stylezlines.linewidth*   zmpl_test_style_pkg.mplstyleT   z./mpl_test_style_pkg.mplstyle)	syspath_prependchdirmkdirr   with_suffixr<   r   user=   )rJ   monkeypatchpkg_paths      r   test_style_from_moduler      s    )h..HNN%%11 2 1%00 1 1IIMM12<<)*b000IIMM/0<<)*b000IIMM12<<)*b000r5   r   )%
contextlibr   pathlibr   tempfiler   rF   numpyr~   rd   
matplotlibr<   r   r|   r   r>   r@   r   r#   r.   r6   rA   rM   rO   rQ   rW   rZ   r\   r`   rh   markparametrizerw   r   r   r   r   r   r5   r   <module>r      s    %  ' 
    + 	  *<+0?))111: 
2 ..0%w/  1	16/H1r5   