a
    j=ic|
                     @   s`   d dl Z d dlZd dlZd dlmZmZ d dlmZ dd Z	dd Z
dd Zd	d
 Zdd ZdS )    N)VERSIONSimport_optional_dependencyc                  C   sh   d} t jt| d}td W d    n1 s00    Y  t|jjtsLJ tddd}|d u sdJ d S )Nz3Missing .*notapackage.* pip .* conda .* notapackagematchZnotapackageignoreerrors)pytestraisesImportErrorr   
isinstancevalue__context__)r   exc_inforesult r   v/home/droni/.local/share/virtualenvs/DPS-5Je3_V2c/lib/python3.9/site-packages/pandas/tests/test_optional_dependency.pytest_import_optional   s    &r   c                   C   s   t d td d S )NZxlrd)r	   Zimportorskipr   r   r   r   r   test_xlrd_version_fallback   s    
r   c                 C   s   d}t |}d|_|tj|< | t|d d}tjt	|d t
d W d    n1 s\0    Y  t
ddd}||u s~J tt t
ddd	}W d    n1 s0    Y  |d u sJ d|_t
d}||u sJ d S )
N
fakemodule0.9.01.0.01Pandas requires .*1.0.0.* of .fakemodule.*'0.9.0'r   z0.8)min_versionwarnr   )types
ModuleType__version__sysmodulessetitemr   r	   r
   r   r   tmassert_produces_warningUserWarning)monkeypatchnamemoduler   r   r   r   r   test_bad_version   s     

&*r'   c                 C   s   d}t |}d|_|tj|< d}t |}t||| |tj| d| < | t|d d}tj	t
|d td W d    n1 s0    Y  tt tdd	d
}W d    n1 s0    Y  |d u sJ d|_td}||u sJ d S )Nr   r   	submodule.r   r   r   zfakemodule.submoduler   r   )r   r   r   r   r   setattrr    r   r	   r
   r   r   r!   r"   r#   )r$   r%   r&   Zsub_namer(   r   r   r   r   r   test_submodule6   s$    


&*r+   c                 C   s`   d}t |}|tj|< | t|d tjtdd t	| W d    n1 sR0    Y  d S )Nr   r   zCan't determine .* fakemoduler   )
r   r   r   r   r    r   r	   r
   r   r   )r$   r%   r&   r   r   r   test_no_version_raisesO   s    

r,   )r   r   r	   Zpandas.compat._optionalr   r   Zpandas._testingZ_testingr!   r   r   r'   r+   r,   r   r   r   r   <module>   s   