U
    iâËdÃ  ã                   @   sp   d dl Z d dlZd dlZd dlZd dlZd dlZd dl	mZ d dl
mZmZ d dlmZmZ G dd„ deƒZdS )é    N)Útypes)ÚTestCaseÚtemp_directory)Úinspect_functionÚinspect_modulec                   @   s6   e Zd Zddd„Zdd„ Zdd„ Zdd	„ Zd
d„ ZdS )ÚTestInspectorFc                 C   s~   |   |t¡ |  d|¡ |d }|d kr4|  |¡ nF|   |tj¡ |  d|¡ |   |d t¡ |  d|¡ |   |d t¡ d S )NÚ
numba_typeZ	explainedÚsource_infos)ÚassertIsInstanceÚdictÚassertInÚassertFalser   ÚTypeÚstr)ÚselfÚinfoÚmust_be_definedr   © r   úN/home/sam/Atlas/atlas_env/lib/python3.8/site-packages/numba/tests/test_help.pyÚcheck_function_descriptor   s    z'TestInspector.check_function_descriptorc                 C   s   t tƒ}| j|dd� d S )NT©r   )r   Úranger   )r   r   r   r   r   Útest_inspect_function_on_range   s    z,TestInspector.test_inspect_function_on_rangec                 C   sº   t tjƒ}| j|dd� |d }|  t|ƒd¡ d}| ¡ D ]h}|  |d t¡ |  |d t¡ |  |d t¡ |  |d t¡ |  |d	 t	¡ |  
d
|¡ |d7 }q<|  |t|ƒ¡ d S )NTr   r	   r   ÚkindÚnameÚsigÚfilenameÚlinesZ	docstringé   )r   ÚnpÚallr   ÚassertGreaterÚlenÚvaluesr
   r   Útupler   ÚassertEqual)r   r   r	   ÚcÚsrcinfor   r   r   Útest_inspect_function_on_np_all    s    

z-TestInspector.test_inspect_function_on_np_allc                 C   sh   d}t tƒD ]J}|  |d tj¡ |  |d t¡ |  t|d ƒ¡ |  |¡ |d7 }q|  	|d¡ d S )Nr   Úmoduler   Úobjr   )
r   Úbuiltinsr
   ÚpytypesÚ
ModuleTyper   Ú
assertTrueÚcallabler   r!   )r   r&   Úitr   r   r   Útest_inspect_module0   s    

z!TestInspector.test_inspect_modulec              	   C   s  t jddg}td t| jj¡ƒ}tj |d¡}|d }|d|dg }|  	tj 
|¡¡ t |¡ |  tj 
|¡¡ |d|dd	dg }|d
 }|  	tj 
|¡¡ t |¡ |  tj 
|¡¡ |d|dddg }|  tj¡�}tj|tjd� W 5 Q R X |  d|jj ¡ ¡ d S )Nz-mznumba.misc.help.inspectorz{}.{}Úoutz.htmlz--fileÚmathz--formatÚrstz.rstZfoo)Ústderrz'foo' is not supported)ÚsysÚ
executabler   ÚformatÚ__name__Ú	__class__ÚosÚpathÚjoinr   ÚisfileÚ
subprocessÚcheck_outputr.   ÚassertRaisesÚCalledProcessErrorÚSTDOUTr   Ú	exceptionÚstdoutÚdecode)r   ZcmdbaseÚdirpathr   Zexpected_fileZcmdsZraisesr   r   r   Útest_inspect_cli:   s*    ÿ


ÿzTestInspector.test_inspect_cliN)F)r9   Ú
__module__Ú__qualname__r   r   r(   r1   rH   r   r   r   r   r      s
   

r   )r6   r?   r   r,   Úos.pathr;   Únumpyr   r+   Z
numba.coreZnumba.tests.supportr   r   Znumba.misc.help.inspectorr   r   r   r   r   r   r   Ú<module>   s   