U
    e»{j4  ã                   @   st   d dl mZ d dlmZ d dlZd dlZd dlmZ d dlm	Z	m
Z
mZ dd„ Zdd	„ Zd
d„ Zdd„ Zdd„ ZdS )é    )Ú
namedtuple)ÚmockN)Úintrospection)Úfind_current_moduleÚfind_mod_objsÚ
minversionc                  C   sH   d} d}d}t dƒj| kst‚t dƒj|ks0t‚t ddƒj|ksDt‚dS )z†
    Tests that the `find_current_module` function works. Note that
    this also implicitly tests compat.misc._patched_getmodule
    úastropy.utils.introspectionú&astropy.utils.tests.test_introspectionr   é   TN)r   Ú__name__ÚAssertionError©Zmod1Zmod2Zmod3© r   úe/var/www/html/bwave/python/venv/lib/python3.8/site-packages/astropy/utils/tests/test_introspection.pyÚtest_pkg_finder   s    r   c               	   C   s®   ddl m}  t}tdƒtks t‚tdƒj|ks2t‚t| ƒ d ƒd ksHt‚tddƒj|ks\t‚tdtgƒj|ksrt‚tddgƒj|ksˆt‚t t¡� tddgƒ W 5 Q R X d S )Nr   )Úgetrecursionlimitr
   Tr   Z&faddfdsasewrweriopunjlfiurrhujnkflgwhu)	Úsysr   r   r   r   r   ÚpytestZraisesÚImportError)r   Z	thismodnmr   r   r   Útest_find_current_mod   s    r   c                  C   s    t dƒ\} }}dd l}d| ks"t‚|j|ks0t‚t tdd�\} }}d| ksNt‚d|ksZt‚t|ksft‚t tdd�\} }}d| ks„t‚d|ks�t‚t|ksœt‚d S )	NÚastropyr   ÚtestF)Z
onlylocalsr   zcollections.namedtupleT)r   r   r   r   r   r   )ZlnmsZfqnsZobjsr   r   r   r   Útest_find_mod_objs,   s    r   c                  C   sˆ   dd l } ddddg}ddg}|D ] }t| |ƒs2t‚td|ƒs t‚q |D ] }t| |ƒrXt‚td|ƒrFt‚qFttd	ƒsvt‚td
d	ƒs„t‚d S )Nr   z1.16z1.16.1z
1.16.0.devz1.16devZ100000z100000.2rc1Únumpyz3.1Úyaml)r   r   r   r   )r   Zgood_versionsZbad_versionsÚversionr   r   r   Útest_minversionC   s    r   c               	   C   sb   t jddd��J d} d}d}tdƒj| ks.t‚tdƒj|ks@t‚tddƒj|ksTt‚W 5 Q R X dS )	a  
    Tests that the `find_current_module` function would work if used inside
    an application bundle. Since we can't test this directly, we test what
    would happen if inspect.getmodule returned `None`, which is what happens
    inside PyInstaller and py2app bundles.
    zinspect.getmoduleN)Zreturn_valuer   r	   r   r
   T)r   Úpatchr   r   r   r   r   r   r   Útest_find_current_module_bundleS   s    r   )Úcollectionsr   Zunittestr   r   r   Zastropy.utilsr   Zastropy.utils.introspectionr   r   r   r   r   r   r   r   r   r   r   r   Ú<module>   s   