o
    :aD
                     @   s   d dl Z d dlZd dlZd dlZd dlZejdg ddd Zejje j	dkddejje j	dko8e 
 d kd	dd
d Zdd Zdd Zdd ZdS )    Nz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                 C   s   t | |ks	J d S )N)
matplotlibZ_parse_to_version_info)Zversion_strZversion_tuple r   B/usr/lib/python3/dist-packages/matplotlib/tests/test_matplotlib.pytest_parse_to_version_info
   s   r   ntz%chmod() doesn't work as is on Windows)reasonzchmod() doesn't work as rootc              
   C   sx   t | j}z.t | d tjtjddgi t jdt	| itj
ddd}d|jv s,J W t | | dS t | | w )	zETest that a warning is emitted if a temporary configdir must be used.r   -czimport matplotlibMPLCONFIGDIRT)envstderrZuniversal_newlinescheckzset the MPLCONFIGDIRN)osstatst_modechmod
subprocessrunsys
executableenvironstrPIPEr   )tmpdirmodeprocr   r   r   test_tmpconfigdir_warning   s   
r#   c                 C   s.   t jtjddgi tjdt| idd d S )Nr   zOimport pathlib; pathlib.Path.home = lambda *args: 1/0; import matplotlib.pyplotr   T)r   r   )r   r   r   r   r   r   r   )r    r   r   r   test_importable_with_no_home&   s   
r$   c                  C   sD   dd } t | dt tjjksJ t | dt tjjks J dS )z
    Test that the standard backends mentioned in the docstring of
    matplotlib.use() are the same as in matplotlib.rcsetup.
    c                 S   sL   g }t jj| d dD ]}| s |S |dd |dD 7 }q|S )Nr	   
c                 S   s   g | ]}|r|  qS r   )strip).0er   r   r   
<listcomp>8   s    zAtest_use_doc_standard_backends.<locals>.parse.<locals>.<listcomp>,)r
   Zuse__doc__splitr&   )keyZbackendsliner   r   r   parse3   s   z-test_use_doc_standard_backends.<locals>.parsez- interactive backends:
z- non-interactive backends:
N)setr
   ZrcsetupZinteractive_bkZnon_interactive_bk)r/   r   r   r   test_use_doc_standard_backends.   s   



r1   c                  C   s:   d} t jdd| g}tj|i tjddiddksJ dS )	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   Z
MPLBACKEND )r   r   N)r   r   r   callr   r   )Zprogramcmdr   r   r   test_importable_with__OOA   s   (r5   )r   r   r   Zpytestr
   ZmarkZparametrizer   Zskipifnamegeteuidr#   r$   r1   r5   r   r   r   r   <module>   s"    

