U
    sVc                     @   sL   d dl Zd dlZd dlmZmZ d dlmZ d dl	m
Z
 dd Zdd ZdS )    N)	DataFrameIndex)
Int64Indexc               	   C   s   t jd} tddddddddg| d| dd}dd }dd	 }|d
||}tddgdd
d}tj	ddgd|d}t
|| d S )NiIZfoobar   )ABCc                 S   s   | j  | j   S N)r   maxr	   min)dfgb r   B/tmp/pip-unpacked-wheel-xj8nt62q/pandas/tests/groupby/test_pipe.pyf   s    ztest_pipe.<locals>.fc                 S   s   | d S )N   r   )Zsrsr   r   r   square   s    ztest_pipe.<locals>.squarer   object)Zdtypenameg֮vq!@g	֯Y @r   )r   index)nprandomZRandomStater   Zrandngroupbypiper   pdSeriestmassert_series_equal)Zrandom_statedfr   r   resultr   expectedr   r   r   	test_pipe   s    r!   c                  C   s   t dddddgdddddgdd	d
ddgd} dd }dd }dd }| d|d|d|d}tdddgdd}tjdddg|d}t|| tddddddg}||d d! }tjd"d#d$gtdddgd}t|| d S )%Nr   r   r	   g      ?g       @g      @g      @g      $@g      Y@g     @@g      Yg     @)groupxyc                    s   | j  fdddd| jS )Nc                    s   | j   kS r
   )r$   Zmeangrparg1r   r   <lambda>:       z+test_pipe_args.<locals>.f.<locals>.<lambda>F)Zdropna)filterr   Zgrouper)r   r(   r   r'   r   r   9   s    ztest_pipe_args.<locals>.fc              
   S   sB   d}t jt|d& |  |    | W  5 Q R  S Q R X d S )Nz!The default value of numeric_only)match)r   Zassert_produces_warningFutureWarningsum)r   Zarg2msgr   r   r   g>   s    ztest_pipe_args.<locals>.gc                 S   s   | j | j | S r
   )r#   r$   )r   Zarg3r   r   r   hC   s    ztest_pipe_args.<locals>.hr"   r   
   d   )r   g#SgbeSi)r      r      c                 S   s   |   |   S r
   )r.   countr%   r   r   r   r)   P   r*   z test_pipe_args.<locals>.<lambda>   r      )	r   r   r   r   r   r   r   r   r   )r   r   r0   r1   r   r   r    Zserr   r   r   test_pipe_args-   s"    "r9   )Znumpyr   Zpandasr   r   r   Zpandas._testingZ_testingr   Zpandas.core.apir   r!   r9   r   r   r   r   <module>   s   !