U
    b                     @   s>   d dl Zd dlmZmZmZmZ d dlmZ	 G dd dZ
dS )    N)CategoricalCategoricalIndexIndexIntervalc                   @   sD   e Z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 )TestReindexc              	   C   sx   t ddddg}tjtdd |ddg\}}W 5 Q R X tj|tdddgdd t|tj	dd	d
gtj
d d S )Nabc
non-uniquematchTexactr         Zdtype)r   tmassert_produces_warningFutureWarningreindexassert_index_equalr   assert_numpy_array_equalnparrayintp)selfciresindexer r   Q/tmp/pip-unpacked-wheel-ck39h295/pandas/tests/indexes/categorical/test_reindex.pytest_reindex_list_non_unique   s
    z(TestReindex.test_reindex_list_non_uniquec              	   C   s   t ddddg}tjtdd |tddg\}}W 5 Q R X t dddgddgd}tj||dd t|tj	d	d
dgtj
d d S )Nr   r   r	   r
   r   
categoriesTr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   expr   r   r    "test_reindex_categorcal_non_unique   s     z.TestReindex.test_reindex_categorcal_non_uniquec              	   C   s   t ddddgddddgd}tjtdd |ddg\}}W 5 Q R X tdddgdd	}tj||d
d t|tj	dddgtj
d	 d S )Nr   r   r	   dr"   r
   r   objectr   Tr   r   r   r   )r   r   r   r   r   r   r   r   r   r   r   r%   r   r   r    ,test_reindex_list_non_unique_unused_category   s    z8TestReindex.test_reindex_list_non_unique_unused_categoryc              	   C   s   t ddddgddddgd}tjtdd |tddg\}}W 5 Q R X t dddgddgd}tj||dd	 t|tj	d
ddgtj
d d S )Nr   r   r	   r(   r"   r
   r   Tr   r   r   r   r   r$   r%   r   r   r    3test_reindex_categorical_non_unique_unused_category'   s     z?TestReindex.test_reindex_categorical_non_unique_unused_categoryc                 C   s   t dddgddddgd}|dddg\}}tdddgdd}tj||dd	 t|tjd
ddgtjd |t dddgddddgd\}}t dddgddddgd}tj||dd	 t|tjd
ddgtjd d S )Nr   r   r	   r(   r"   r)   r   Tr   r   r   )	r   r   r   r   r   r   r   r   r   )r   catr   r   r&   r   r   r    test_reindex_duplicate_target/   s    z)TestReindex.test_reindex_duplicate_targetc                 C   sR   t g }|ddg\}}tj|tddgdd t|tjddgtjd d S )Nr   r   Tr   r   )	r   r   r   r   r   r   r   r   r   )r   r	   r   r   r   r   r    test_reindex_empty_index>   s    z$TestReindex.test_reindex_empty_indexc              	   C   s   t tddddtddddgdd}t tddddtddddtddddtdd	ddgdd}||\}}|}t|| d S )
Nr      right)closedr   T)Zorderedr      )r   r   r   r   r   )r   r   Zci_addresult_expectedr   r   r    'test_reindex_categorical_added_categoryE   s    	z3TestReindex.test_reindex_categorical_added_categoryN)
__name__
__module____qualname__r!   r'   r*   r+   r-   r/   r7   r   r   r   r    r      s   		r   )Znumpyr   Zpandasr   r   r   r   Zpandas._testingZ_testingr   r   r   r   r   r    <module>   s   