3
Udw                 @   sN  d dl Z d dlZd dlZd dlmZmZmZ d dlj	Z
ejjdddgddggdd Zejjdd	 Zej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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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jd}tjt|d |j|  W d Q R X d S )Nr      )Ar   CzIndex(['a'], dtype='object'))match)r   reescapepytestZraisesKeyError
duplicated)r   dfmsg r   ^/var/www/html/virt/lib64/python3.6/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}|j }t|ts2t|jtj	ksBtd S )Nc             S   s&   i | ]}t jjd ddd|dqS )r   i  i0u  Zcol_Z02d)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j|| 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    	"r.   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j|| d S )Nr
      )r!   )r*   )r   r   nanobjectr   r+   r,   )r*   r-   r   r#   r   r   r   test_duplicated_nan_none3   s    
r3   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j	|| d S )Nr   r   r'   r   r(   r)   r0   )r	   r   r
   )r*   )r*   r   )
r   r   r1   listcolumnsr   strr   r+   r,   )r   r*   r   r-   r#   r   r   r   test_duplicated_subsetC   s    
r7   c              C   s8   t ddgd} | jd}| | }| j }tj|| d S )Nr   r(   )r5   )r   r   copyr+   Zassert_frame_equal)r   Zdupesr#   r-   r   r   r   test_duplicated_on_empty_frameY   s
    
r9   c              C   s\   t ddd} td| d}|jddg}| j s6ttd| i}|j }| j 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_duplicatedd   s    r?   )r   Znumpyr   r   Zpandasr   r   r   Zpandas._testingZ_testingr+   markZparametrizer   Zslowr$   r.   Zxfailr3   r7   r9   r?   r   r   r   r   <module>   s(   
"
"
$
 