o
    8ήc
                     @   sl   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r4e
  dS dS )	    N)jitnjit)TestCasec                   @       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   ;/tmp/pip-target-vg8gfxp4/lib/python/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   	vectorizeguvectorizer   
NumbaError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                   @   r   )TestJitDecoratorz*
    Test the jit and njit decorators
    c                 C   s   |  t}tddd W d    n1 sw   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 r   r   xr   r   r   py_func.      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 sw   Y  | t|d | dt|d j	 t jdd}t dt tdd W d    n1 sPw   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   r    r   r   r!   r   r   r   r#   L   r$   z=TestJitDecorator.test_njit_nopython_forceobj.<locals>.py_func)warningscatch_warningssimplefilterRuntimeWarningr   r,   r-   r   r*   messager.   )r   wr#   r0   r   r   r   test_njit_nopython_forceobj;   s.   z,TestJitDecorator.test_njit_nopython_forceobjN)r   r   r   r   r1   r:   r   r   r   r   r   "   s    r   __main__)r4   r
   r   r   numba.tests.supportr   unittestr   r   r   mainr   r   r   r   <module>   s    7