B
     \                 @   sx   d dl mZ d dlZd dlmZmZmZ d dl	m
Z
 d dlmZ G dd dejZG dd dejZed	krte  dS )
    N)configjittypes)compile_isolated)override_configc               @   s   e Zd Zdd Zdd ZdS )TestJITMethodc          	   C   sx   G dd dt }|d}tj|dtjdddddgtjd |jj \}|j	d }|j \}| 
|jj d S )Nc               @   s    e Zd Zdd Zedd ZdS )zETestJITMethod.test_bound_jit_method_with_loop_lift.<locals>.Somethingc             S   s
   || _ d S )N)x0)selfr    r
   9lib/python3.7/site-packages/numba/tests/test_jitmethod.py__init__   s    zNTestJITMethod.test_bound_jit_method_with_loop_lift.<locals>.Something.__init__c             S   s>   t jdt jd}| j}x"t|jd D ]}|| ||< q&W |S )N   )shapedtyper   )npemptyfloat32r   ranger   )r	   xar   ir
   r
   r   method   s
    zLTestJITMethod.test_bound_jit_method_with_loop_lift.<locals>.Something.methodN)__name__
__module____qualname__r   r   r   r
   r
   r
   r   	Something   s   r      r      )r   r   )objectr   ZtestingZassert_array_equalr   Zarrayr   Z	overloadsvaluesZliftedZ
assertTrueZfndescZnative)r	   r   	somethingZcresZjitloopZloopcresr
   r
   r   $test_bound_jit_method_with_loop_lift   s    
z2TestJITMethod.test_bound_jit_method_with_loop_liftc             C   s.   G dd dt }|d}| ||d d S )Nc               @   s    e Zd Zdd Zedd ZdS )z8TestJITMethod.test_unbound_jit_method.<locals>.Somethingc             S   s
   || _ d S )N)r   )r	   r   r
   r
   r   r   &   s    zATestJITMethod.test_unbound_jit_method.<locals>.Something.__init__c             S   s   | j S )N)r   )r	   r
   r
   r   r   )   s    z?TestJITMethod.test_unbound_jit_method.<locals>.Something.methodN)r   r   r   r   r   r   r
   r
   r
   r   r   %   s   r   r   )r   ZassertEqualsr   )r	   r   r    r
   r
   r   test_unbound_jit_method$   s    z%TestJITMethod.test_unbound_jit_methodN)r   r   r   r!   r"   r
   r
   r
   r   r   
   s   r   c               @   s   e Zd Zdd Zdd ZdS )TestDisabledJITc          	   C   sV   t dd dd }t|}W d Q R X | || | d|d | d|d d S )NDISABLE_JITTc             S   s   | S )Nr
   )r   r
   r
   r   r   4   s    z7TestDisabledJIT.test_decorated_function.<locals>.method
   )r   r   assertEqual)r	   r   jittedr
   r
   r   test_decorated_function2   s    z'TestDisabledJIT.test_decorated_functionc          	   C   s\   t dd dd }tdd|}W d Q R X | || | d|d | d|d d S )Nr$   Tc             S   s   | S )Nr
   )r   r
   r
   r   r   >   s    zCTestDisabledJIT.test_decorated_function_with_kwargs.<locals>.method)Znopythonr%   )r   r   r&   )r	   r   r'   r
   r
   r   #test_decorated_function_with_kwargs<   s    z3TestDisabledJIT.test_decorated_function_with_kwargsN)r   r   r   r(   r)   r
   r
   r
   r   r#   1   s   
r#   __main__)Znumba.unittest_supportZunittest_supportZunittestZnumpyr   Znumbar   r   r   Znumba.compilerr   Znumba.tests.supportr   ZTestCaser   r#   r   mainr
   r
   r
   r   <module>   s   '