U
    ,d
                     @   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   8/tmp/pip-unpacked-wheel-eu7e0c37/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   
   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   )	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   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)   r2   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