
    %Wh(                        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 ej                  j                  dg d      d        Zej                  j                  ej                  dk(  d	      ej                  j                  ej                  dk7  xr  e j                         d k(  d
	      d               Zd Zd Zd Z ed      d        Zy)    N)patch)subprocess_run_for_testingzversion_str, version_tuple))z3.5.0)      r   finalr   )z3.5.0rc2)r   r   r   	candidate   )z3.5.0.dev820+g6768ef8c4c)r   r   r   alpha4  )z3.5.0.post820+g6768ef8c4c)r   r      r
   r   c                 8    t        j                  |       |k(  sJ y )N)
matplotlib_parse_to_version_info)version_strversion_tuples     Z/var/www/html/jupyter_env/lib/python3.12/site-packages/matplotlib/tests/test_matplotlib.pytest_parse_to_version_infor      s     ,,[9]JJJ    win32z%chmod() doesn't work as is on Windows)reasonzchmod() doesn't work as rootc                    t        j                  |       j                  }	 t        j                  | d       t	        t
        j                  ddgi t         j                  dt        |       it        j                  dd      }d|j                  v sJ 	 t        j                  | |       y# t        j                  | |       w xY w)	zETest that a warning is emitted if a temporary configdir must be used.r   -czimport matplotlibMPLCONFIGDIRT)envstderrtextcheckzset the MPLCONFIGDIRN)osstatst_modechmodr   sys
executableenvironstr
subprocessPIPEr   )tmp_pathmodeprocs      r   test_tmpconfigdir_warningr+      s     778$$D!
1)^^T#67=2::=~s8}=??T; &444
4 4 s   A2B+ +Cc                 |    t        t        j                  ddgi t        j                  dt        |       id       y )Nr   zOimport pathlib; pathlib.Path.home = lambda *args: 1/0; import matplotlib.pyplotr   Tr   r   )r   r"   r#   r   r$   r%   )r(   s    r   test_importable_with_no_homer.   (   s9    	
$	% :rzz9>3x=9	Gr   c                      d } ddl m}m} t         | d            t        |j	                  |j
                              k(  sJ t         | d            t        |j	                  |j                              k(  sJ y)z
    Test that the standard backends mentioned in the docstring of
    matplotlib.use() are the same as in matplotlib.rcsetup.
    c                 <   g }t         j                  j                  j                  |       d   j                  d      D ]V  }|j	                         s |S ||j                  d      D cg c]#  }|s|j	                         j                         % c}z  }X |S c c}w )Nr   
,)r   use__doc__splitstriplower)keybackendslinees       r   parsez-test_use_doc_standard_backends.<locals>.parse5   s    NN**005a8>>tD 	JD::< DJJsOIqq*IIH	J  Js   (B0 Br   )BackendFilterbackend_registryz- interactive backends:
z- non-interactive backends:
N)matplotlib.backendsr=   r>   setlist_builtinINTERACTIVENON_INTERACTIVE)r<   r=   r>   s      r   test_use_doc_standard_backendsrD   0   s    
 D123 --m.G.GHIJ K J567 --m.K.KLMN O Nr   c                  p    d} t        t        j                  dd| gi t        j                  ddid       y)	z
    When using -OO or export PYTHONOPTIMIZE=2, docstrings are discarded,
    this simple test may prevent something like issue #17970.
    zimport matplotlib as mpl; import matplotlib.pyplot as plt; import matplotlib.cbook as cbook; import matplotlib.patches as mpatchesz-OOr   
MPLBACKEND Tr-   N)r   r"   r#   r   r$   )programs    r   test_importable_with__OOrI   E   s;    	0  	g.,rzz,<,D
r   z"matplotlib.subprocess.check_outputc                     t        j                  dgd      | _        t        j                  t
        j                  d      5  t
        j                  j                  d       ddd       y# 1 sw Y   yxY w)ze
    Test that _get_executable_info raises ExecutableNotFoundError if the
    command times out.
    mock   )cmdtimeoutz	Timed out)matchinkscapeN)	r&   TimeoutExpiredside_effectpytestraisesr   ExecutableNotFoundError_get_executable_info__wrapped__)mock_check_outputs    r    test_get_executable_info_timeoutrY   V   s^     %/$=$=6(TV$W!	z99	M @''33J?@ @ @s    A,,A5)r   r&   r"   unittest.mockr   rS   r   matplotlib.testingr   markparametrizer   skipifplatformgeteuidr+   r.   rD   rI   rY    r   r   <module>rb      s    	  
    9 5 8 KK CLLG+B  DCLLG+A


0A9  ;!;D!GO*
" +,	@ -	@r   