U
    b»{j6
  ã                   @   sl   d dl Z d dlZd dlmZmZ d dlmZmZ d dlZG dd„ deƒZG dd„ deƒZ	e
dkrhe ¡  dS )	é    N)ÚjitÚnjit)ÚTestCaseÚalways_testc                   @   s$   e Zd ZdZdd„ Ze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)Z
assertTrueÚhasattrÚnumbaÚassertInÚ__all__)ÚselfÚname© r   úS/var/www/html/bwave/python/venv/lib/python3.8/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TypingErrorZ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   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 5 Q R X |  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   )	Z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 5 Q R X |  t|ƒd¡ |  dt|d j	ƒ¡ t jdd��}t  dt¡ tdd� W 5 Q R X |  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   M   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(   r1   r   r   r   r   r   #   s   r   Ú__main__)r+   r	   r   r   Znumba.tests.supportr   r   Zunittestr   r   r   Úmainr   r   r   r   Ú<module>   s   7