U
    *if                     @   sP  d dl Z d dlZd dlZd dlmZmZmZ d dlm	Z
 ejdddgddggdd Zejjdd	 Zejd
dedddddgfdedddddgfdedddddgfgdd Zejjddejd
dedddddgfdedddddgfdedddddgfgdd Zejddddgdgdd Zdd Zdd ZdS )    N)	DataFrameSeries
date_rangesubsetaBc              	   C   sT   t dddgdddgdddgd}td}tjt|d ||  W 5 Q R X d S )Nr      Ar   CzIndex(['a'], dtype='object'))match)r   reescapepytestZraisesKeyError
duplicated)r   dfmsg r   ]/home/mars/bis/venv/lib/python3.8/site-packages/pandas/tests/frame/methods/test_duplicated.py+test_duplicated_with_misspelled_column_name   s    "
r   c                  C   sF   dd t dD } t| j}| }t|ts2t|jtj	ksBtd S )Nc                 S   s&   i | ]}d |dt jdddqS )Zcol_02dr   i  i0u  )nprandomrandint).0ir   r   r   
<dictcomp>   s     
 zBtest_duplicated_do_not_fail_on_wide_dataframes.<locals>.<dictcomp>d   )
ranger   Tr   
isinstancer   AssertionErrordtyper   Zbool_)datar   resultr   r   r   .test_duplicated_do_not_fail_on_wide_dataframes   s
    
r&   zkeep, expectedfirstFTlastc                 C   s>   t dddddgdddddgd}|j| d}t|| d S )	Nr   r      r   bc)r
   r   keep)r   r   tmassert_series_equalr-   expectedr   r%   r   r   r   test_duplicated_keep(   s    	"r2   z+GH#21720; nan/None falsely considered equal)reasonc                 C   s:   t dtjddd tjgitd}|j| d}t|| d S )Nr      )r#   r,   )r   r   nanobjectr   r.   r/   r0   r   r   r   test_duplicated_nan_none7   s    
r7   r
   c                 C   s   t dddddgdddddgtjddd tjgd}| d krFt|j} nt| trV| g} ||  j|d	}|j|| d
}t	|| d S )Nr   r   r)   r   r*   r+   r4   r	   r,   )r-   r   )
r   r   r5   listcolumnsr!   strr   r.   r/   )r   r-   r   r1   r%   r   r   r   test_duplicated_subsetG   s    
r;   c                  C   s8   t ddgd} | d}| | }|  }t|| d S )Nr   r*   )r9   )r   r   copyr.   Zassert_frame_equal)r   Zdupesr%   r1   r   r   r   test_duplicated_on_empty_frame]   s
    
r=   c                  C   s\   t ddd} td| d}|ddg}|  s6ttd| i}| }|  sXtd S )Nz
2010-07-01z
2010-08-05)endZAAA)symboldater@   r?   )r   r   r   allr"   )datesZtstr%   r   r   r    test_frame_datetime64_duplicatedh   s    rC   )r   numpyr   r   Zpandasr   r   r   Zpandas._testingZ_testingr.   markZparametrizer   Zslowr&   r2   Zxfailr7   r;   r=   rC   r   r   r   r   <module>   s:   
	


