a
    j=ic                     @   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g d| 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I)foobarr   r   r   r   r   r      ABCc                 S   s   | j  | j   S N)r
   maxr   min)dfgb r   o/home/droni/.local/share/virtualenvs/DPS-5Je3_V2c/lib/python3.9/site-packages/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	   r   r   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 g dg dg dd} dd }dd }d	d
 }| d|d|d|d}tg ddd}tjg d|d}t|| tg d}||dd }tjg dtg dd}t|| d S )N)r	   r	   r
   r
   r   )g      ?       @g      @r$   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'   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   sN   d}t jt|d( |  |    | W  d    S 1 s@0    Y  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   )r   )g#SgbeSi)r   )   r8   r   r      r9   c                 S   s   |   |   S r   )r2   countr)   r   r   r   r-   P   r.   z test_pipe_args.<locals>.<lambda>)   r      )r8   r   r9   )	r   r   r   r   r   r   r   r   r   )r    r   r4   r5   r!   r   r"   Zserr   r   r   test_pipe_args-   s"    "r=   )numpyr   Zpandasr   r   r   Zpandas._testingZ_testingr   Zpandas.core.apir   r#   r=   r   r   r   r   <module>   s   !