o
    EÜhU	  ã                   @   sB   d Z ddlZddlZddlmZmZ ddlmZ	 G dd„ dƒZ
dS )z[
Tests for DataFrame cumulative operations

See also
--------
tests.series.test_cumulative
é    N)Ú	DataFrameÚSeriesc                   @   s>   e Zd Zdd„ Zdd„ Zej dg d¢¡dd„ ƒZd	d
„ Z	dS )ÚTestDataFrameCumulativeOpsc                 C   sd   t dt d¡it d¡d}| ¡  | ¡  | ¡  t t d¡ dd¡tdƒtdƒd}| ¡  d S )NÚAé   )Úindexé   é   )r   Úcolumns)r   ÚnpZarangeÚcummaxÚcumminÚcumsumZreshapeÚrange)ÚselfÚdfZdm© r   úBlib/python3.10/site-packages/pandas/tests/frame/test_cumulative.pyÚtest_cumulative_ops_smoke   s   $z4TestDataFrameCumulativeOps.test_cumulative_ops_smokec                 C   sŠ   t j|jdd…df< t j|jdd…df< t j|jdd …df< | d¡ t¡}| d¡ | d¡ | d¡ t j¡}| d¡ | d¡ d S )Nr	   é
   r   é   é   é   )r   ÚnanÚilocZfillnaZastypeÚintÚcumprodZint32)r   Údatetime_framer   r   r   r   Útest_cumprod_smoke"   s   


z-TestDataFrameCumulativeOps.test_cumprod_smokeÚmethod)r   r   r   r   c                 C   s°   t j|jdd…df< t j|jdd…df< t j|jdd …df< t||ƒƒ }| tt|ƒ¡}t ||¡ t||ƒdd}|jtt|ƒdd}t ||¡ t  |¡t  |¡ksVJ ‚d S )Nr	   r   r   r   r   r   )Zaxis)	r   r   r   ÚgetattrZapplyr   ÚtmÚassert_frame_equalÚshape)r   r   r   ÚresultÚexpectedr   r   r   Ú&test_cumulative_ops_match_series_apply1   s   zATestDataFrameCumulativeOps.test_cumulative_ops_match_series_applyc                 C   sh   t g d¢g d¢g d¢dœƒ}| ¡ }t tg d¢tjdtg d¢tjd|d  ¡ dœƒ}t ||¡ d S )N)r   r   é   )r   r   g      @)TFF)r   ÚBÚC)r   r'   é   )Zdtyper)   )r   r   r   r   Zint64Zfloat64r!   r"   )r   r   r$   r%   r   r   r   Útest_cumsum_preserve_dtypesD   s   
ýÿz6TestDataFrameCumulativeOps.test_cumsum_preserve_dtypesN)
Ú__name__Ú
__module__Ú__qualname__r   r   ÚpytestZmarkZparametrizer&   r+   r   r   r   r   r      s    
r   )Ú__doc__Znumpyr   r/   Zpandasr   r   Zpandas._testingZ_testingr!   r   r   r   r   r   Ú<module>   s    