U
    Fvf                     @   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   J/tmp/pip-unpacked-wheel-7vhvci0g/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   