a
    –§»a
  ã                   @   sh   d dl Z d dlZd dlmZmZ d dlmZ d dlZG dd„ deƒZG dd„ deƒZe	dkrde 
¡  dS )	é    N)ÚjitÚnjit)ÚTestCasec                   @   s    e Zd ZdZdd„ Zdd„ ZdS )ÚTestNumbaModulez@
    Test the APIs exposed by the top-level `numba` module.
    c                 C   s$   |   tt|ƒ|¡ |  |tj¡ d S ©N)Ú
assertTrueÚhasattrÚnumbaÚassertInÚ__all__)ÚselfÚname© r   úN/home/yuhw/wc/pochoir/venv/lib/python3.9/site-packages/numba/tests/test_api.pyÚcheck_member   s    zTestNumbaModule.check_memberc                 C   sP   |   d¡ |   d¡ |   d¡ |   d¡ |   d¡ |   d¡ |   d¡ tj d S )Nr   Z	vectorizeZguvectorizer   Z
NumbaErrorZTypingErrorÚint32)r   r	   Ú__version__)r   r   r   r   Útest_numba_module   s    






z!TestNumbaModule.test_numba_moduleN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r   
   s   r   c                   @   s    e Zd ZdZdd„ Zdd„ ZdS )ÚTestJitDecoratorz*
    Test the jit and njit decorators
    c                 C   s¤   |   t¡�}tddd� W d   ƒ n1 s,0    Y  |  dt|jƒ¡ dd„ }tdd�|ƒ}|dƒ |  t|jƒd¡ tdd�|ƒ}|dƒ |  t|jƒd	¡ d S )
NT)ÚnopythonÚforceobjz1Only one of 'nopython' or 'forceobj' can be True.c                 S   s   | S r   r   ©Úxr   r   r   Úpy_func.   s    z<TestJitDecorator.test_jit_nopython_forceobj.<locals>.py_func©r   é   ©r   r   )	ÚassertRaisesÚ
ValueErrorr   r
   ÚstrÚ	exceptionÚassertEqualÚlenÚnopython_signatures)r   Úcmr   Újit_funcr   r   r   Útest_jit_nopython_forceobj&   s    *þz+TestJitDecorator.test_jit_nopython_forceobjc                 C   s,  t jdd��&}t  dt¡ tdd� W d   ƒ n1 s80    Y  |  t|ƒd¡ |  dt|d j	ƒ¡ t jdd��&}t  dt¡ tdd� W d   ƒ n1 s 0    Y  |  t|ƒd¡ |  d	t|d j	ƒ¡ d
d„ }tdd�|ƒ}|dƒ |  t|j
ƒd¡ tdd�|ƒ}|dƒ |  t|j
ƒd¡ d S )NT)ÚrecordÚalwaysr    r   z'forceobj is set for njit and is ignoredr   r   z'nopython is set for njit and is ignoredc                 S   s   | S r   r   r   r   r   r   r   L   s    z=TestJitDecorator.test_njit_nopython_forceobj.<locals>.py_func)ÚwarningsÚcatch_warningsÚsimplefilterÚRuntimeWarningr   r%   r&   r
   r#   Úmessager'   )r   Úwr   r)   r   r   r   Útest_njit_nopython_forceobj;   s*    (ÿ(ÿz,TestJitDecorator.test_njit_nopython_forceobjN)r   r   r   r   r*   r3   r   r   r   r   r   "   s   r   Ú__main__)r-   r	   r   r   Znumba.tests.supportr   Zunittestr   r   r   Úmainr   r   r   r   Ú<module>   s   7