B
    Y0d                 @   st   d dl Z d dlZd dlZd dlmZ d dlmZ G dd deZ	G dd de	Z
G dd de	ZG d	d
 d
e	ZdS )    N)BaseExtensionTestsc               @   s   e Zd ZdZdd ZdS )BaseReduceTestszg
    Reduction specific tests. Generally these only
    make sense for numeric/boolean operations.
    c             C   s6   t |||d}t |d||d}t|| d S )N)skipnaZfloat64)getattrZastypetmZassert_almost_equal)selfsop_namer   resultexpected r   T/var/www/html/venv/lib/python3.7/site-packages/pandas/tests/extension/base/reduce.pycheck_reduce   s    zBaseReduceTests.check_reduceN)__name__
__module____qualname____doc__r   r   r   r   r   r   
   s   r   c               @   sD   e Zd ZdZejdddgdd Zejdddgdd Zd	S )
BaseNoReduceTestszwe don't define any reductionsr   TFc          	   C   s@   |}t |}d}tjt|d t|||d W d Q R X d S )Nzf[Cc]annot perform|Categorical is not ordered for operation|'Categorical' does not implement reduction|)match)r   )pdSeriespytestraises	TypeErrorr   )r   dataall_numeric_reductionsr   r	   r   msgr   r   r   test_reduce_series_numeric   s
    
z,BaseNoReduceTests.test_reduce_series_numericc          	   C   s@   |}t |}d}tjt|d t|||d W d Q R X d S )Nzf[Cc]annot perform|Categorical is not ordered for operation|'Categorical' does not implement reduction|)r   )r   )r   r   r   r   r   r   )r   r   all_boolean_reductionsr   r	   r   r   r   r   r   test_reduce_series_boolean&   s
    
z,BaseNoReduceTests.test_reduce_series_booleanN)	r   r   r   r   r   markparametrizer   r   r   r   r   r   r      s   r   c               @   s&   e Zd Zejdddgdd ZdS )BaseNumericReduceTestsr   TFc          	   C   s@   |}t |}t   tdt | ||| W d Q R X d S )Nignore)r   r   warningscatch_warningssimplefilterRuntimeWarningr   )r   r   r   r   r	   r   r   r   r   test_reduce_series5   s
    

z)BaseNumericReduceTests.test_reduce_seriesN)r   r   r   r   r    r!   r(   r   r   r   r   r"   4   s   r"   c               @   s&   e Zd Zejdddgdd ZdS )BaseBooleanReduceTestsr   TFc             C   s    |}t |}| ||| d S )N)r   r   r   )r   r   r   r   r	   r   r   r   r   r(   A   s    
z)BaseBooleanReduceTests.test_reduce_seriesN)r   r   r   r   r    r!   r(   r   r   r   r   r)   @   s   r)   )r$   r   Zpandasr   Zpandas._testingZ_testingr   Z pandas.tests.extension.base.baser   r   r   r"   r)   r   r   r   r   <module>   s   