U
    Âmœdõ  ã                   @   sx   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d	„ Zd
d„ Zdd„ Zdd„ ZdS )zL
Backend-loading machinery tests, using variations on the template backend.
é    N)ÚSimpleNamespace)Ú	MagicMock)Úpyplot)Úbackend_template)ÚFigureCanvasTemplateÚFigureManagerTemplatec                   C   s$   t  d¡ tt ¡ jƒtks t‚d S )NÚtemplate)ÚmplÚuseÚtypeÚpltÚfigureÚcanvasr   ÚAssertionError© r   r   ú_/home/sam/Atlas/atlas_env/lib/python3.8/site-packages/matplotlib/tests/test_backend_template.pyÚtest_load_template   s    
r   c                 C   s^   t f ttƒŽ}tjjdœdd„|_|  tj	d|¡ t 
d¡ tt ¡ jƒtksRt‚t ¡  d S )N)ÚFigureClassc                _   s   t t|||Žƒ| ƒS )N)r   r   )Únumr   ÚargsÚkwargsr   r   r   Ú<lambda>   s     ÿz#test_load_old_api.<locals>.<lambda>Úmpl_test_backendúmodule://mpl_test_backend)r   Úvarsr   r	   r   ZFigureZnew_figure_managerÚsetitemÚsysÚmodulesr
   r   r   r   r   r   Zdraw_if_interactive)Úmonkeypatchr   r   r   r   Útest_load_old_api   s    ÿ
r   c                 C   sR   t f ttƒŽ}tƒ }|  |jd|¡ |  tjd|¡ t	 
d¡ t ¡  | ¡  d S )NZpyplot_showr   r   )r   r   r   r   Úsetattrr   r   r   r   r	   r
   r   ÚshowÚassert_called_with©r   r   Z	mock_showr   r   r   Ú	test_show!   s      ÿ
r$   c                 C   sT   t f ttƒŽ}tƒ }| j|d|dd� |  tjd|¡ t 	d¡ t
 ¡  | ¡  d S )Nr!   F)Zraisingr   r   )r   r   r   r   r    r   r   r   r	   r
   r   r!   r"   r#   r   r   r   Útest_show_old_global_api,   s    
r%   )Ú__doc__r   Útypesr   Zunittest.mockr   Z
matplotlibr	   r   r   Zmatplotlib.backendsr   Z$matplotlib.backends.backend_templater   r   r   r   r$   r%   r   r   r   r   Ú<module>   s   