o
    i                     @   s^  d dl Z d dlmZ d dlZd dlZd dlZd dlZd dlm	Z
 d dlmZmZ d dlmZ ejjdejjjvddZejjed d	dZejjd
dejdddgejjdddi fddddifddddifddddifddi fddddifddddifgg dddd Zdd Zeedd Zedgd d! Zed"d# Zed$d% ZdS )&    N)Path)cbookpatheffects)image_comparisonepsz*This test needs a ghostscript installation)reasonTz"This test needs a TeX installation   )rerunsorientationportrait	landscapezformat, use_log, rcParamspsFps.usedistillerghostscriptxpdftext.usetexz	ps.useafm)r   zps with distiller=ghostscriptzps with distiller=xpdfzps with usetexr   zeps afmzeps with usetex)idsc                 C   s  t j| |dd t \}}t }t }|r#|	d |
ddgddg d}	t jd s8|	d7 }	||	 g }
|d	rJ|
t j |drT|
t z|j|| |d
 |j|| |d
 W n t|
y } ztt| W Y d }~nd }~ww | d}| }|d	s|drtdd|}tdd|}||ddksJ W d    n1 sw   Y  W d    d S W d    d S 1 sw   Y  d S )NSOURCE_DATE_EPOCH0log      u	   Déjà vur   u    −€r   )formatr
   asciis   (?<=
%%CreationDate: ).*    s   
   
)mplrcParamsupdatesetenvpltsubplotsioStringIOBytesIO
set_yscaleplot	set_titlegetappendExecutableNotFoundErrorRuntimeErrorsavefigtuplepytestskipstrgetvalueencoderesubreplace)r   use_logr   r
   monkeypatchfigaxs_bufb_buftitleallowable_exceptionsexcs_valb_val rA   [/var/www/edux/Edux_v2/venv/lib/python3.10/site-packages/matplotlib/tests/test_backend_ps.pytest_savefig_to_stringio   s<   





PrC   c                  C   sl   t jdddgtjd< t \} }|g d t }| j	|dd W d    d S 1 s/w   Y  d S )N   w)	linewidth
foregroundzpath.effects)r   r   r   r   r   )
r   
withStroker   r   r    r!   r&   r"   r$   r,   )r8   r9   r   rA   rA   rB   test_patheffectsS   s   

"rJ   c                 C   s~   t | d}|  tjtt|d# dtjd< t	g d t
d tj|d dd	 W d    d S 1 s8w   Y  d S )
Nzshort-1)tempdirTr   )r   r   r   rD   z\textbf{time} (s)ztex_demo.epsr   rH   )r   mkdirr   _setattr_cmtempfiler0   r   r   r    r&   xlabelr,   )tmpdirbase_tempdirrA   rA   rB   test_tilde_in_tempfilename\   s   


"rR   z	empty.epsc                  C   s@   t  \} }|  |jddgddd |jdddddd d S )Nr   r   r)coloralpha      ?foo)r    r!   set_axis_offr&   text)r8   r9   rA   rA   rB   test_transparencyo   s   rZ   c                   C   sV   dt jd< td tt tjt	 dd W d   dS 1 s$w   Y  dS )z"Test failing latex subprocess callTr   z$22_2_2$r   rH   N)
r   r   r    rO   r.   raisesr+   r,   r"   r$   rA   rA   rA   rB   test_failing_latexw   s
   

"r\   c                 C   sP   |  d tjddddd tjt dd | jr$tdd	 | jD s&J d S )
NWARNINGrV   rW   T)usetexr   rH   c                 s   s    | ]	}d |  v V  qdS )zas if usetex=FalseN)
getMessage).0recordrA   rA   rB   	<genexpr>   s    z&test_partial_usetex.<locals>.<genexpr>)	set_levelr    figtextr,   r"   r$   recordsall)caplogrA   rA   rB   test_partial_usetex   s   
rh   )r"   pathlibr   r3   rN   r.   
matplotlibr   matplotlib.pyplotpyplotr    r   r   matplotlib.testing.decoratorsr   markskipiftestingcompare	converterneeds_ghostscriptcheckdep_usetexneeds_usetexflakyparametrizerC   rJ   rR   rZ   r\   rh   rA   rA   rA   rB   <module>   sR    
)	

	