a
    j=ic                     @   s   d dl Zd dlZd dlmZmZmZ d dlm  m	Z
 d dlmZmZ d dlmZ ejje ohe phe ddZe
dejdG dd	 d	ZdS )
    N)is_ci_environmentis_platform_macis_platform_windows)	DataFrameSeriesz`On GHA CI, Windows can fail with 'Windows fatal exception: stack overflow' and MacOS can timeout)reasonZnumbaignorec                	   @   s   e Zd Zdd Zejjejdee	de	dde
e	dddgdd	 Zejjed
ejdee	de	dde
e	dddgdd ZdS )TestEWMc                 C   sn   t tdtdd}|dd }tjtdd" |j|dd W d    n1 s`0    Y  d S )	N   ab         ?z;Must call mean with update=None first before passing update)match   update)	r   rangeheadewmonlinepytestraises
ValueErrormean)selfdf
online_ewm r   p/home/droni/.local/share/virtualenvs/DPS-5Je3_V2c/lib/python3.9/site-packages/pandas/tests/window/test_online.pytest_invalid_update   s    zTestEWM.test_invalid_updateobjr
   r   Zfoo)namec                 C   s   |j d||d }|||d}|dj d||dj|d}	tdD ]J}
|	 }t||d |	j|dd}t||d |	  qFd S )Nr   )adjust	ignore_nanogilparallelnopythonr   engine_kwargs   r   )	r   r   r   r   r   tmassert_equaltailreset)r   r"   r'   r(   r)   r$   r%   expectedr+   r   _resultr   r   r    test_online_vs_non_online_mean'   s    
z&TestEWM.test_online_vs_non_online_mean)r   c                 C   s   t tjg ddd}|jd||||d }	|||d}
|djd|||d|dj|
d}tdD ]R}| }t	||	d |j|
d	|
d	d
}t	||	
d	 |  qjd S )N)z
2020-01-01z
2020-01-05z
2020-01-07z
2020-01-17z
2020-01-21Z
datetime64)Zdtyper   )r$   r%   timesZhalflifer&   r   r*   r,   )r   Zupdate_times)r   nparrayr   r   r   r   r   r-   r.   r/   r0   )r   r"   r'   r(   r)   r$   r%   Zhalflife_with_timesr5   r1   r+   r   r2   r3   r   r   r    test_update_times_mean@   s<    

zTestEWM.test_update_times_meanN)__name__
__module____qualname__r!   r   markZslowZparametrizer   r   r   r4   ZxfailNotImplementedErrorr8   r   r   r   r    r	      s   	&&r	   )numpyr6   r   Zpandas.compatr   r   r   Zpandas.util._test_decoratorsutilZ_test_decoratorstdZpandasr   r   Zpandas._testingZ_testingr-   r<   ZskipifZ
pytestmarkZ
skip_if_nofilterwarningsr	   r   r   r   r    <module>   s   
