o
    7?e$                  	   @   s   d dl Zd dlZd dlZd dlmZmZ d dlmZ	 ej
ddeg dfdeg dfdeg d	fgd
d Zej
ddeg dfdeg dfdeg dfgdd Zej
dg eedgdd ZG dd dZdS )    N)CategoricalSerieszkeep, expectedfirstFFFFTTFlastFTTFFFFFFTTFTTFc                 C   s   t g dt| d}|jdkrtd t|j|d| t|j|d||   |	 }|j|dd}|d u s=J t|||   d S )N)   r         r
   r      dtypeboolz.tested separately in test_drop_duplicates_boolkeepTr   inplace)
r   npr   pytestskiptmassert_series_equal
duplicateddrop_duplicatescopy)any_numpy_dtyper   expectedtcscreturn_value r!   q/home/www/facesmatcher.com/pyenv/lib/python3.10/site-packages/pandas/tests/series/methods/test_drop_duplicates.pytest_drop_duplicates   s   	

r#   FFTTTTFFTTTTc                 C   sr   t g d}t|j| d| t|j| d||   | }|j| dd}t|||   |d u s7J d S )NTFTFr   Tr   )r   r   r   r   r   r   )r   r   r   r   r    r!   r!   r"   test_drop_duplicates_bool"   s   	r(   valuesr   c                 C   s   t |t| d}t dgt| dd}|jdkr%|d d }|d d }t|j|d| |j|d}t|| ||usAJ d S )Nr   Fr      r   )r   r   r   lenr   r   r   r   )r   r   r)   r   r   Zresult_droppedr!   r!   r"   "test_drop_duplicates_no_duplicates5   s   
r,   c                   @   s   e Zd Zejg dddd Zejdd Zdd Zd	d
 Zdd Z	ej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 ) TestSeriesDropDuplicates)int_ZuintZfloat64Zstr_ztimedelta64[h]zdatetime64[D])paramsc                 C   s   |j S )N)param)selfrequestr!   r!   r"   r   J   s   zTestSeriesDropDuplicates.dtypec                 C   J   t jg dt |d}t jg dt |d}t|||d}t|}|S )Nr	   r*   r
   r   r   r   )r	   r*   r
   r
   
categoriesorderedr   arrayr   r   r   )r1   r   r7   	cat_arrayZinput1cattc1r!   r!   r"   cat_series_unused_categoryP   
   z3TestSeriesDropDuplicates.cat_series_unused_categoryc                 C   t   |}t g d}| }t|| | }t|||   | }|jdd}|d u s/J t|||   d S )N)FFFTTr   r   r   r   r   r   r   r1   r=   r<   r   resultr   r    r!   r!   r"   )test_drop_duplicates_categorical_non_boolZ      zBTestSeriesDropDuplicates.test_drop_duplicates_categorical_non_boolc                 C   ~   |}t g d}|jdd}t|| |jdd}t|||   | }|jddd}|d u s4J t|||   d S )N)FFTFr   r   Tr   rA   rB   r!   r!   r"   2test_drop_duplicates_categorical_non_bool_keeplastj      zKTestSeriesDropDuplicates.test_drop_duplicates_categorical_non_bool_keeplastc                 C   rF   )Nr$   Fr   Tr   rA   rB   r!   r!   r"   3test_drop_duplicates_categorical_non_bool_keepfalse|   rH   zLTestSeriesDropDuplicates.test_drop_duplicates_categorical_non_bool_keepfalsec                 C   r3   )Nr4   r   )r	   r*   r
   r   r
   r*   r   r5   r8   )r1   r   r7   r:   Zinput2r;   tc2r!   r!   r"   
cat_series   r>   z#TestSeriesDropDuplicates.cat_seriesc                 C   r?   )Nr   Tr@   rA   r1   rK   rJ   r   rC   r   r    r!   r!   r"   *test_drop_duplicates_categorical_non_bool2   rE   zCTestSeriesDropDuplicates.test_drop_duplicates_categorical_non_bool2c                 C   rF   )Nr   r   r   Tr   rA   rL   r!   r!   r"   3test_drop_duplicates_categorical_non_bool2_keeplast      zLTestSeriesDropDuplicates.test_drop_duplicates_categorical_non_bool2_keeplastc                 C   rF   )Nr   Fr   Tr   rA   rL   r!   r!   r"   4test_drop_duplicates_categorical_non_bool2_keepfalse   rO   zMTestSeriesDropDuplicates.test_drop_duplicates_categorical_non_bool2_keepfalsec                 C   s^  t tg dddg|d}t g d}t| | t| ||   | }|jdd}|d u s6J t|||   t g d}t|jdd	| t|jdd	||   | }|jddd
}|d u smJ t|||   t g d}t|jdd	| t|jdd	||   | }|jddd
}|d u sJ t|||   d S )Nr'   TFr5   r$   r@   r%   r   r   r   r&   )r   r   r   r   r   r   r   )r1   r7   r   r   r   r    r!   r!   r"   %test_drop_duplicates_categorical_bool   s4   z>TestSeriesDropDuplicates.test_drop_duplicates_categorical_boolc                 C   s^   t tdddd|gddgdd}| }t tddtjgddgddg dd}t|| d S )NTFr5   )r   r	   r   )index)r   r   r   r   nanr   r   )r1   Znulls_fixtureserrC   r   r!   r!   r"   (test_drop_duplicates_categorical_bool_na   s   zATestSeriesDropDuplicates.test_drop_duplicates_categorical_bool_nac                 C   s4   t g d}|jdd}t g d}t|| d S )N)r	   r*   r*   r
   T)Zignore_index)r	   r*   r
   )r   r   r   r   r1   rT   rC   r   r!   r!   r"   !test_drop_duplicates_ignore_index   s   z:TestSeriesDropDuplicates.test_drop_duplicates_ignore_indexc                 C   sB   t d tg ddd}| }tg ddd}t|| d S )Npyarrow)TFNFzbool[pyarrow]r   )TFN)r   importorskipr   r   r   r   rV   r!   r!   r"   test_duplicated_arrow_dtype   s
   
z4TestSeriesDropDuplicates.test_duplicated_arrow_dtypec                 C   sT   t d}tddgt| d}| }tdgt| d}t|| d S )NrX   ar   )	r   rY   r   pdZ
ArrowDtypestringr   r   r   )r1   parT   rC   Zexpecetdr!   r!   r"   "test_drop_duplicates_arrow_strings  s
   
z;TestSeriesDropDuplicates.test_drop_duplicates_arrow_stringsN)__name__
__module____qualname__r   Zfixturer   r=   rD   rG   rI   rK   rM   rN   rP   rQ   rU   rW   rZ   r_   r!   r!   r!   r"   r-   I   s(    

	
	r-   )numpyr   r   Zpandasr\   r   r   Zpandas._testingZ_testingr   markZparametrizer#   r(   listranger,   r-   r!   r!   r!   r"   <module>   s0    


