a
    Pf6                     @   s   d dl Z d dlZd dlZd dlm  mZ d dlZejdd Z	ejdd Z
dd Zdd	 Zd
d Zdd Zdd Zeddd Zdd ZdS )    Nc                  C   s   t d} t| ddd  | S )Npandas_dummy_backendplotc                  _   s   dS )N
used_dummy )argskwargsr   r   [/var/www/ai-form-bot/venv/lib/python3.9/site-packages/pandas/tests/plotting/test_backend.py<lambda>       zdummy_backend.<locals>.<lambda>)types
ModuleTypesetattr)dbr   r   r   dummy_backend   s    
r   c                   c   s6   t dd dV  W d   n1 s(0    Y  dS )z*Restore the plotting backend to matplotlibplotting.backend
matplotlibN)pandasoption_contextr   r   r   r   restore_backend   s    r   c                  C   sT   d} t jt| d tdd W d    n1 s40    Y  tjjjdksPJ d S )Nz9Could not find plotting backend 'not_an_existing_module'.matchr   Znot_an_existing_moduler   )pytestraises
ValueErrorr   
set_optionoptionsplottingbackendmsgr   r   r   test_backend_is_not_module   s    *r    c                 C   sH   |  tjd| tdd tddks.J tjjd|u sDJ d S )Nr   r   )	setitemsysmodulesr   r   
get_optionr   _core_get_plot_backend)monkeypatchr   r   r   r   r   test_backend_is_correct!   s
    r(   c                 C   sH   |  tjd| tg d}tddks0J |jdddksDJ d S )Nr            r   r   )r   r   )r!   r"   r#   r   	DataFramer$   r   r'   r   r   Zdfr   r   r   $test_backend_can_be_set_in_plot_call+   s    r/   c                 C   s   | | |tjd| |d }|  |d d tjj	d|u sNJ t
dd$ tjj	 |u spJ W d    n1 s0    Y  d S )Nr   zmy_backend-0.0.0.dist-infozentry_points.txts@   [pandas_plotting_backends]
my_ep_backend = pandas_dummy_backend
Zmy_ep_backendr   )Zsyspath_prependr!   r"   r#   mkdirwrite_bytesr   r   r%   r&   r   )r   Ztmp_pathr'   r   Z	dist_infor   r   r   test_register_entrypoint3   s    
r2   c                 C   s|   t d}| tjd| tjjjdks,J t	j
tdd tdd W d    n1 s\0    Y  tjjjdksxJ d S )NZpandas_plot_backendr   z6Could not find plotting backend 'pandas_plot_backend'.r   r   )r   r   r!   r"   r#   r   r   r   r   r   r   r   r   )r'   moduler   r   r   (test_setting_backend_without_plot_raisesE   s    
*r4   r   c                  C   sD   d} t jt| d tjjd W d    n1 s60    Y  d S )NzVmatplotlib is required for plotting when the default backend "matplotlib" is selected.r   r   )r   r   ImportErrorr   r   r%   r&   r   r   r   r   test_no_matplotlib_okS   s    r6   c                 C   s>   |  tjd| tdd tdg di}|jdd d S )Nr   r   Ar)   znot a real kind)kind)r!   r"   r#   r   r   r-   r   r.   r   r   r   test_extra_kinds_ok]   s    r9   )r"   r   r   Zpandas.util._test_decoratorsutilZ_test_decoratorstdr   Zfixturer   r   r    r(   r/   r2   r4   Zskip_if_installedr6   r9   r   r   r   r   <module>   s    



	