
    g                     v    d Z ddlZddlmZ ddlmZ ddlZddlmZ	 ddl
mZ ddlmZmZ d Zd	 Zd
 Zd Zd Zy)zL
Backend-loading machinery tests, using variations on the template backend.
    N)SimpleNamespace)	MagicMock)pyplot)backend_template)FigureCanvasTemplateFigureManagerTemplatec                      t        j                  d       t        t        j                         j
                        t        k(  sJ y )Ntemplate)mplusetypepltfigurecanvasr        c/var/www/dash_apps/app1/venv/lib/python3.12/site-packages/matplotlib/tests/test_backend_template.pytest_load_templater      s.    GGJ

##$(<<<<r   c                 n   t        di t        t              }t        j                  j
                  dd|_        | j                  t        j                  d|       t        j                  d       t        t        j                         j                        t        k(  sJ t        j                          y )N)FigureClassc          	      8    t        t         ||i |      |       S )N)r   r   )numr   argskwargss       r   <lambda>z#test_load_old_api.<locals>.<lambda>   s$     d!=f!=>	E r   mpl_test_backendmodule://mpl_test_backendr   )r   varsr   r   r   Figurenew_figure_managersetitemsysmodulesr   r   r   r   r   draw_if_interactive)monkeypatchr   s     r   test_load_old_apir&      s    &@.>)?@'*zz'8'8 	E ' %79IJGG'(

##$(<<<<r   c                 6   t        di t        t              }t               }| j	                  |j
                  d|       | j                  t        j                  d|       t        j                  d       t        j                          |j                          y )Npyplot_showr   r   r   r   r   r   r   setattrr   r!   r"   r#   r   r   r   showassert_called_withr%   r   	mock_shows      r   	test_showr/   !   s    &@.>)?@I..yJ%79IJGG'(HHJ  "r   c                 &   t        di t        t              }t               }| j	                  |d|d       | j                  t        j                  d|       t        j                  d       t        j                          |j                          y )Nr+   F)raisingr   r   r   )r   r   r   r   r*   r!   r"   r#   r   r   r   r+   r,   r-   s      r   test_show_old_global_apir3   ,   so    &@.>)?@I(&)UK%79IJGG'(HHJ  "r   c                 6   t        di t        t              }t               }| j	                  |j
                  d|       | j                  t        j                  d|       t        j                  d       t        j                          |j                          y )Nr(   mpl_Test_Backendzmodule://mpl_Test_Backendr   r)   r-   s      r   test_load_case_sensitiver6   6   r0   r   )__doc__r"   typesr   unittest.mockr   
matplotlibr   r   r   matplotlib.backendsr   $matplotlib.backends.backend_templater   r   r   r&   r/   r3   r6   r   r   r   <module>r=      s<     ! #  $ 01=
	###r   