a
    
d                     @   s   d dl Z d dlZd dlZd dlmZ zd dlmZ W n  e	yT   ej
ddd Y n0 ejddd Zejdd	d
 ZdS )    N)_macosxzThese are mac only testsT)Zallow_module_levelmacosxc                  C   sR   t d} | j  | j jd us(J t d} |   | j jd usNJ d S )N      )pltfigurecanvasZdrawZget_rendererZ	_rendererZdraw_without_rendering)fig r
   m/var/www/html/stable-diffusion-webui/venv/lib/python3.9/site-packages/matplotlib/tests/test_backend_macosx.pytest_cached_renderer   s    


r   c                    s    fdd}|  td| t }td iX |jj    d|j	  }t
j|sbJ tjd   dkszJ W d    n1 s0    Y  d S )Nc                    s.   |t  ksJ t| d | d| S )N/test/test/)strosmakedirs)title	directoryfilenametmp_pathr
   r   new_choose_save_file   s    z2test_savefig_rcparam.<locals>.new_choose_save_fileZchoose_save_filezsavefig.directoryr   r   )setattrr   r   r   mplZ
rc_contextr   ZtoolbarZsave_figureZget_default_filenamer   pathexistsZrcParams)Zmonkeypatchr   r   r	   Z	save_filer
   r   r   test_savefig_rcparam   s    r   )r   ZpytestZ
matplotlibr   Zmatplotlib.pyplotZpyplotr   Zmatplotlib.backendsr   ImportErrorskipmarkbackendr   r   r
   r
   r
   r   <module>   s   


