U
    sVc                     @   sf   d dl Zd dlZd dlmZ d dlmZmZ d dlm	Z	m
Z
mZmZmZ d dlmZ G dd dZdS )    N)is_numpy_dev)is_complex_dtypeis_extension_array_dtype)PeriodSeries	Timedelta	Timestamp
date_rangec                   @   s\   e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd Zdd Z	dd Z
dd Zdd ZdS )TestSeriesDescribec                 C   s`   t dddddgdd}| }t dd| dddddgdd	d
ddddddgd}t|| d S )Nr               Zint_dataname   countmeanstdmin25%50%75%maxr   index)r   describer   tmassert_series_equalselfserresultexpected r$   M/tmp/pip-unpacked-wheel-xj8nt62q/pandas/tests/series/methods/test_describe.pytest_describe_ints   s    z%TestSeriesDescribe.test_describe_intsc                 C   sL   t dddddgdd}| }t ddddgddd	d
dgd}t|| d S )NTFZ	bool_datar   r   r   r   r   uniquetopfreqr   r   r   r   r   r   r$   r$   r%   test_describe_bools    s    
  
z&TestSeriesDescribe.test_describe_boolsc                 C   sL   t dddddgdd}| }t dddd	gdd
dddgd}t|| d S )NabcdZstr_datar   r   r   r   r   r'   r(   r)   r   r*   r   r$   r$   r%   test_describe_strs(   s    
  
z%TestSeriesDescribe.test_describe_strsc                 C   s   t tdtdtdtdtdgdd}| }t d|d	 | |d
 |d |d	 |d |d gdddddddddgd}t|| d S )Nz1 daysz2 daysz3 daysz4 daysz5 daysZtimedelta_datar   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   )r   r   r   r   r   r   r   r$   r$   r%   test_describe_timedelta641   s     
.z,TestSeriesDescribe.test_describe_timedelta64c                 C   s^   t tddtddtddgdd}| }t dd|d dgdd	d
ddgd}t|| d S )Nz2020-01Mz2019-12Zperiod_datar   r   r   r   r   r'   r(   r)   r   )r   r   r   r   r   r   r$   r$   r%   test_describe_periodD   s    
z'TestSeriesDescribe.test_describe_periodc                 C   s   t d d gtd}| }t ddtjtjgtddddgd}t|| |d d  }t|| t|jd svt	t|jd	 st	d S )
Ndtyper   r   r'   r(   r)   )r5   r   r   r   )
r   objectr   npnanr   r   isnanZilocAssertionErrorr    sr"   r#   r$   r$   r%   test_describe_empty_objectQ   s    
z-TestSeriesDescribe.test_describe_empty_objectc           	   
   C   s   |}t |}tddd}tddd}tt|||d|d}|jdd}tdtddd||||d |d	 |d ||g|d
ddddddgd}t|| d S )N  r   r   tzr   TZdatetime_is_numericr   r   r   r   r   r   r   r   r   r   )strr   r   r	   r   tz_localizer   r   )	r    Ztz_naive_fixturer@   r   startendr<   r"   r#   r$   r$   r%   test_describe_with_tzb   s&    	z(TestSeriesDescribe.test_describe_with_tzc              	   C   s   d }}t ddd}t ddd}tt|||d|d}tt | }W 5 Q R X tdd| jd d|	||	|g|dd	d
dddgd}t
|| d S )NZCETr>   r   r   r?   r   r   r   r'   r(   r)   firstlastr   )r   r   r	   r   Zassert_produces_warningFutureWarningr   Zvalue_countsr   rC   r   )r    r   r@   rD   rE   r<   r"   r#   r$   r$   r%   test_describe_with_tz_warnsy   s$    z.TestSeriesDescribe.test_describe_with_tz_warnsc              	   C   sl   t tddd}|jdd}t dtdtdtdtdtd	td
gdddddddgd}t|| d S )NZ2012r   )ZperiodsTrA   z
2012-01-02z
2012-01-01z2012-01-01T12:00:00z2012-01-02T12:00:00z
2012-01-03r   r   r   r   r   r   r   )r   )r   r	   r   r   r   r   r;   r$   r$   r%   *test_datetime_is_numeric_includes_datetime   s    	z=TestSeriesDescribe.test_datetime_is_numeric_includes_datetimec              
   C   s   t |rd}nt|rdnd }tddg|d}|dkr`tr`tjtdd |  W 5 Q R X d S | }tdd	| dd
d	ddgddddddddg|d}t	
|| d S )NZFloat64Z
complex128r   r   r4   z$^a must be an array of real numbers$)matchg       @g      ?g      ?g      ?g      ?r   r   r   r   r   r   r   r   )r   r5   )r   r   r   r   pytestZraises	TypeErrorr   r   r   r   )r    Zany_numeric_dtyper5   r!   r"   r#   r$   r$   r%   test_numeric_result_dtype   s4     
z,TestSeriesDescribe.test_numeric_result_dtypeN)__name__
__module____qualname__r&   r+   r0   r1   r3   r=   rF   rJ   rK   rO   r$   r$   r$   r%   r
      s   
	r
   )Znumpyr7   rM   Zpandas.compatr   Zpandas.core.dtypes.commonr   r   Zpandasr   r   r   r   r	   Zpandas._testingZ_testingr   r
   r$   r$   r$   r%   <module>   s   