3
���h~ � @ s� d dl Zd dlZd dljjZd dlmZm Z d dl
jZd dl
mZ ejdd�ejjd�G dd� d���Zejdd�d d
� �ZdS )� N)�Series�option_context)�NUMBA_FUNC_CACHE�numbaz0.46.0zignore:\nThe keyword argumentc @ s@ e Zd Zejjdddg�dd� �Zejjdddg�dd� �ZdS ) � TestApply�jitTFc
C s� dd� }|rdd l }|j|�}|||d�}d
} ttd��}
|
jd|d�j|| d|d d
�}|
jd|d�j|d| d d�}tj||� d S )Nc W s( d}x|D ]}||7 }q
W t j| �| S )Nr )�np�mean)�x�argsZarg_sum�arg� r
�@/tmp/pip-build-5_djhm0z/pandas/pandas/tests/window/test_numba.py�f s
z)TestApply.test_numba_vs_cython.<locals>.fr )�nogil�parallel�nopython� �
)�centerr T)r �engine�
engine_kwargs�raw�cython)r r r )r )r r r �range�rolling�apply�tm�assert_series_equal)
�selfr r r r r r r r r �s�result�expectedr
r
r �test_numba_vs_cython s
zTestApply.test_numba_vs_cythonc C s� dd� }dd� }|r0dd l }|j|�}|j|�}|||d�}ttd��jd�} | j|d |d
d�}
| j|dd
d
�}tj|
|� |dftks�t �| j|d |d
d�}
| j|dd
d
�}tj|
|� | j|d |d
d�}
| j|dd
d
�}tj|
|� d S )Nc S s t j| �d S )N� )r r )r
r
r
r �func_1+ s z$TestApply.test_cache.<locals>.func_1c S s t j| �d S )N� )r Zstd)r
r
r
r �func_2. s z$TestApply.test_cache.<locals>.func_2r )r r r r r r T)r r r r )r r Z
rolling_apply)
r r r r r r r r r �AssertionError)r r r r r r% r' |