U
    ,d+                     @   sP   d dl Zd dlZd dlmZ G dd deZG dd deZedkrLe	
  dS )    N)TestCasec                   @   s(   e Zd ZdZdd Zdd Zdd ZdS )	Issue455z#
    Test code from issue 455.
    c                 C   s
   g | _ d S N)f)self r   =/tmp/pip-unpacked-wheel-eu7e0c37/numba/tests/test_dyn_func.py__init__   s    zIssue455.__init__c                 C   s8   d}i }t | | | jtjddd|d  d S )Nzo
        def f(x):
            n = x.shape[0]
            for i in range(n):
                x[i] = 1.
        zvoid(f8[:])T)Znopythonr   )execstripr   appendnumbaZjit)r   codedr   r   r   create_f   s    zIssue455.create_fc                 C   s"   t d}| jD ]}|| q|S )N
   )npzerosr   )r   ar   r   r   r   call_f   s    


zIssue455.call_fN)__name__
__module____qualname____doc__r	   r   r   r   r   r   r   r      s   r   c                   @   s   e Zd Zdd ZdS )TestDynFuncc                 C   s,   t  }|  | }| |t| d S r   )r   r   r   ZassertPreciseEqualr   Z	ones_like)r   instr   r   r   r   test_issue_455#   s    zTestDynFunc.test_issue_455N)r   r   r   r   r   r   r   r   r   !   s   r   __main__)Znumpyr   r   Znumba.tests.supportr   objectr   r   r   Zunittestmainr   r   r   r   <module>   s   	