o
    i                     @   s   d Z ddlZddlZddlZddlZddlZddl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dddZej
dddddddejd	ddeegddejd	ddedg	dd Zej
dddgdd ZdS ) z
Test output reproducibility.
    N)pyplotepsz*This test needs a ghostscript installation)reasonTz"This test needs a TeX installationmhipdfFc                 C   s$  t | t jd|d t }d| v rX|ddd}td}|j|dgd dd |j|d	gd d
d |j|dgd dd |j|dgd dd |j|dgd dd d| v r|ddd	}|	tddtdd|j	tdddgd tddd }|
g d d}t||D ]	\}	}
|	|
 qd| v rg dg dg dg}|dddj|dd g dg dg dg}|dddj|dd g dg dg dg}|dddj|dd td}|ddd}||| |d |d |d ttjd tj}|j||d! d S )"Nasdf)zsvg.hashsaltztext.usetexm      
   D)marker   x   ^   H   vh)bottom)g      ?g      @g      @g      @)-+r   \*oO.i)r	   r   r   )r   r   r	   )r   r	   r   nearest)interpolation)r	   r   r   bilinear)r   r	   r   bicubiczA string $1+2+\sigma$buffer)format)mplusercParamsupdatepltfigureadd_subplotrangeplotbar
set_xtickszip	set_hatchimshow	set_title
set_xlabel
set_ylabelgetattrsysstdoutsavefig)objectsfmtusetexfigax1r   ax2barspatternsr/   patternAaxr9    rF   \/var/www/edux/Edux_v2/venv/lib/python3.10/site-packages/matplotlib/tests/test_determinism.py_save_figure   sF   
 


rH   zobjects, fmt, usetex) r   F)r   r   F)r   r   F)r   r   F)r   r   F)r   psFrJ   )marks)r   svgFrL   c                    sd    fddt dD }|dd D ]} dkr'r'||d kr&td q||d ks/J qdS )	a?  
    Output three times the same graphs and checks that the outputs are exactly
    the same.

    Parameters
    ----------
    objects : str
        Objects to be included in the test document: 'm' for markers, 'h' for
        hatch patterns, 'i' for images.
    fmt : {"pdf", "ps", "svg"}
        Output format.
    c                    sF   g | ]}t jtjd ddd d dgi tjddidqS )-R-czHfrom matplotlib.tests.test_determinism import _save_figure;_save_figure(z, )SOURCE_DATE_EPOCH	946684800env
subprocesscheck_outputr8   
executableosenviron).0_r<   r;   r=   rF   rG   
<listcomp>b   s    z*test_determinism_check.<locals>.<listcomp>r   r	   NrJ   r   z+failed, maybe due to ghostscript timestamps)r-   pytestskip)r;   r<   r=   plotsprF   r\   rG   test_determinism_checkG   s   
rb   zfmt, string)r   s!   /CreationDate (D:20000101000000Z))rJ   s(   %%CreationDate: Sat Jan 01 00:00:00 2000c                 C   s>   t jtjddd| dgi tjddid}||v sJ dS )	a  
    Test SOURCE_DATE_EPOCH support. Output a document with the environment
    variable SOURCE_DATE_EPOCH set to 2000-01-01 00:00 UTC and check that the
    document contains the timestamp that corresponds to this date (given as an
    argument).

    Parameters
    ----------
    fmt : {"pdf", "ps", "svg"}
        Output format.
    string : bytes
        Timestamp string for 2000-01-01 00:00 UTC.
    rM   rN   zMfrom matplotlib.tests.test_determinism import _save_figure; _save_figure('', rO   rP   rQ   rR   NrT   )r<   stringbufrF   rF   rG   "test_determinism_source_date_epochr   s   re   )__doc__rX   rU   r8   r^   
matplotlibr&   matplotlib.testing.comparer   r*   markskipiftestingcompare	converterneeds_ghostscriptcheckdep_usetexneeds_usetexrH   parametrizeparamrb   re   rF   rF   rF   rG   <module>   sP    

/

