
    g                        d dl Z d dlZd dlmZ d dlZd dlmZ 	 d dl	m
Z
 ej                  j                  d      d        Zej                  j                  d      d	        Zej                  j                  d      d
        Zej                  j                  d      d        Zy# e$ r  ej                  dd       Y w xY w)    N)mock)_macosxzThese are mac only testsT)allow_module_levelmacosxc                  D   t        j                  d      } | j                  j                          | j                  j	                         j
                  J t        j                  d      } | j                          | j                  j	                         j
                  J y )N      )pltfigurecanvasdrawget_renderer	_rendererdraw_without_rendering)figs    a/var/www/dash_apps/app1/venv/lib/python3.12/site-packages/matplotlib/tests/test_backend_macosx.pytest_cached_rendererr      sv     **Q-CJJOO::""$..:::
**Q-C ::""$..:::    c                    fd}| j                  t        d|       t        j                         }t	        j
                  di      5  |j                  j                  j                           d|j                  j                          }t        j                  j                  |      sJ t        j                  d    dk(  sJ 	 d d d        y # 1 sw Y   y xY w)Nc                 b    |t              k(  sJ t        j                  | d       | d| S )N/test/test/)strosmakedirs)title	directoryfilenametmp_paths      r   new_choose_save_filez2test_savefig_rcparam.<locals>.new_choose_save_file   s;     CM)))
yk'(F8*--r   choose_save_filezsavefig.directoryr   r   )setattrr   r
   r   mpl
rc_contextr   toolbarsave_figureget_default_filenamer   pathexistsrcParams)monkeypatchr   r    r   	save_files    `   r   test_savefig_rcparamr-      s    . !35IJ
**,C	,h7	8 G

&&(jszz'F'F'H&IJ	ww~~i((( ||/0xj4FFFFG G Gs   	B CCc                  (    ddl m}   | dddd       y )Nr   ipython_in_subprocessosxr   MacOSX))      )   r   )matplotlib.testingr0   r/   s    r   test_ipythonr7   2   s    8%8X!FGr   c                     t        j                         \  } }|j                  dgg       d}t        j                  |d      5  | j
                  j                  j                  j                         }t        j                  d       |dk(  sJ 	 d d d        t        j                  |d       5  | j
                  j                  j                  j                         }|J 	 d d d        y # 1 sw Y   ]xY w# 1 sw Y   y xY w)Nr   z,matplotlib.backends._macosx.choose_save_filez
foobar.png)return_value)r
   subplotsimshowr   patchr   managerr%   r&   r   remove)r   axpropfnames       r   test_save_figure_returnrB   8   s    llnGCIIse9D	D|	4 %

""**668
		,$$$% 
Dt	, 

""**668}} 	% % s   AC,/3C8,C58D)r   pytestunittestr   
matplotlibr#   matplotlib.pyplotpyplotr
   matplotlib.backendsr   ImportErrorskipmarkbackendr   r-   r7   rB    r   r   <module>rN      s    	    E+
 X	; 	; XG G, XH H
 X
 
_  EFKK*tDEs   B% %C C