o
    _~#g!!                     @   sl   d Z ddlZddlZddlmZmZ ddlmZmZm	Z	 ddl
mZmZ dd Zdd	 Zd
d Zdd ZdS )z
Tests of the groupby API, including internal consistency and with other pandas objects.

Tests in this file should only check the existence, names, and arguments of groupby
methods. It should not test the results of any groupby operation.
    N)	DataFrameSeries)groupby_other_methodsreduction_kernelstransformation_kernels)DataFrameGroupBySeriesGroupByc                 C   s6   | j dd}dd t|D }h d}||ksJ d S )Nsecond)levelc                 S      h | ]	}| d s|qS _
startswith).0v r   /var/www/static.ux5.de/https/Moving-Object-Detection-with-OpenCV/env/lib/python3.10/site-packages/pandas/tests/groupby/test_api.py	<setcomp>       z&test_tab_completion.<locals>.<setcomp>>B   ABCaggallanycovewmmaxminnthsemstdsumvarcorrdiffheadhistlastmeanndimohlcpipeplotprodranksizeskewtailtakeapplybfillcountffillfirstshiftcummaxcummincumsumdtypesfillnafiltergroupsidxmaxidxminmedianngroupsampleboxplotcumprodindicesngroupsnuniquerollingcorrwithcumcountdescribequantileresample	aggregate	expanding	get_group	transform
pct_changevalue_counts)groupbydir) multiindex_dataframe_random_datagrpresultsexpectedr   r   r   test_tab_completion   s   Dr^   c                 C   s   |  | jd d df }dd t|D t| j }t|}|t8 }|t8 }|t8 }tt@ r0J tt@ r6J tt@ r<J |rHd| d}t|ttB tB }||kr^d||  d}t|d S )Nr   c                 S   r   r   r   )r   r   r   r   r   r   i   r   z/test_all_methods_categorized.<locals>.<setcomp>z?
There are uncategorized methods defined on the Grouper class:
aG  .

Was a new method recently added?

Every public method On Grouper must appear in exactly one the
following three lists defined in pandas.core.groupby.base:
- `reduction_kernels`
- `transformation_kernels`
- `groupby_other_methods`
see the comments in pandas/core/groupby/base.py for guidance on
how to fix this test.
        zI
Some methods which are supposed to be on the Grouper class
are missing:
z.

They're still defined in one of the lists that live in pandas/core/groupby/base.py.
If you removed a method, you should update them
)	rX   ilocrY   setcolumnsr   r   r   AssertionError)rZ   r[   names	new_namesmsgall_categorizedr   r   r   test_all_methods_categorizede   s2   rg   c                 C   s  | dv rd}t j|d | dv rtt| rJ d S tt| }tt| }tt|j	}| dkr3dh}ntt|j	}t t }}| dv rKh d}nl| d	v rTd
dh}nc| dv r\dh}n[| dv rih d}h d}nN| dv rvh d}ddh}nA| dv rh d}n8| dv rh d}n/| dv rddh}d
h}n#| dv rdh}n| dv rdh}dh}n| dv rd
h}n| dv rddh}||@ |ksJ ||@ |ksJ ||8 }||8 }||ksJ d S )Nr9   r)   z?first and last are entirely different between frame and groupby)reason)rN   rE   r1   selfr   r   >   axiskwargs	bool_only)r7   numeric_onlyrl   )rK   r   r   >   rl   rm   skipna   engine	min_countengine_kwargsr*   r"   r#   r$   rs   ru   rD   r/   r!   backfillr6   r8   pad   rl   inplacedowncast
limit_arear;   r<   rq   argsrH   r=   rV   rm   r0   rP   method)
pytestskiphasattrr   getattrr   r`   inspect	signature
parameters)groupby_funcre   frame_method	gb_methodresultr]   exclude_expectedexclude_resultr   r   r   test_frame_consistency   s\   







r   c                 C   s  |dv r	t d |dv rtt|rJ d S tt|}tt|}tt|j	}|dkr0dh}ntt|j	}t t }}|dv rHh d}nk|dv rPd	h}nc|d
v r]h d}h d}nV|dv rjh d}ddh}nI|dv rsh d}n@|dv r|h d}n7|dv rddh}dh}n+|dv rdh}n#|dv rdh}d	h}n|dv rdh}n|dv rddh}n|dv rdh}||@ |ksJ ||@ |ksJ ||8 }||8 }||ksJ d S )Nrh   z@first and last are entirely different between Series and groupby)rN   rM   rE   r1   rj   rk   >   rl   rm   rn   )r&   rl   rp   >   rl   rm   rq   rr   rv   rs   ru   rw   rx   r{   r   rq   r   ro   r   r   rm   r   )rC   rB   r   )
r   r   r   r   r   r   r`   r   r   r   )requestr   series_methodr   r   r]   r   r   r   r   r   test_series_consistency   sZ   








r   )__doc__r   r   pandasr   r   pandas.core.groupby.baser   r   r   pandas.core.groupby.genericr   r   r^   rg   r   r   r   r   r   r   <module>   s    J0<