o
    _~#g                     @   s   d Z ddlZddlZddlmZ ddlmZ ddlm	Z	 dd Z
dd Zejd	ejd
d
gddejjdddgdgdd ZdS )a;  
Tests that apply to all groupby operation methods.

The only tests that should appear here are those that use the `groupby_func` fixture.
Even if it does use that fixture, prefer a more specific test file if it available
such as:

 - test_categorical
 - test_groupby_dropna
 - test_groupby_subclass
 - test_raises
    N)	DataFrame)get_groupby_method_argsc           	      C   s   t g g g dg d}|jg ddd}t|| }t| |}| dkr&tnd }d}tj||d || j}W d    n1 sAw   Y  |j}t	|| d S )NabcF)
group_keysfillna%DataFrameGroupBy.fillna is deprecatedmatch)
r   	set_indexgroupbygetattrr   FutureWarningtmassert_produces_warningindexassert_index_equal)	groupby_funcdfgbmethodargswarnwarn_msgresultexpected r   /var/www/static.ux5.de/https/Moving-Object-Detection-with-OpenCV/env/lib/python3.10/site-packages/pandas/tests/groupby/test_all_methods.py,test_multiindex_group_all_columns_when_empty   s   

r    c                 C   sL  |dkrd}|  tjj|d tg dg dg dgtdd}t||}|jd	|d
}|dkr3tnd }d}t	j
||d t||| }	W d    n1 sPw   Y  |jg ddd}
t||
}|
jd	|d
}|dkrptnd }d}t	j
||d t||| }W d    n1 sw   Y  |dvr|jddid}t	|	| d S )Ncorrwithz:GH#50845 - corrwith fails when there are duplicate columns)reason)         )r#         )         abbcolumnsr   )as_indexr	   r
   r   r   r#   )axis)sizengroupcumcountr   r   )applymarkerpytestmarkxfailr   listr   r   r   r   r   r   set_axisrenameassert_equal)requestr   r.   msgr   r   r   r   r   r   expected_dfexpected_argsexpected_gbr   r   r   r   test_duplicate_columns%   s,   "

r@   idxr   foo)name)r   r   rD   bar)namesc                 C   s   | dv rt d|   tddgg|d}|dg}t| |}| dkr&tnd }d}tj||d t|| | }W d    n1 sCw   Y  |j	d	ksOJ t
|j| d S )
N>   r0   r1   r2   zNot applicable for r#   r,   r   r	   r
   r   )r#   r(   )r4   skipr   r   r   r   r   r   r   shaper   r-   )r   rA   r   grp_byr   r   r   r   r   r   r   test_dup_labels_output_shape>   s   
rJ   )__doc__r4   pandaspdr   pandas._testing_testingr   pandas.tests.groupbyr   r    r@   r5   parametrizeIndex
MultiIndexfrom_tuplesrJ   r   r   r   r   <module>   s    