U
    NZf                     @   sF   d dl Z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   s@   d}t ddddg}tjt|d |ddg W 5 Q R X d S N/cannot reindex on an axis with duplicate labelsabcmatchr   pytestraises
ValueErrorreindexselfmsgci r   Q/tmp/pip-unpacked-wheel-nbcvw55c/pandas/tests/indexes/categorical/test_reindex.pytest_reindex_list_non_unique   s    z(TestReindex.test_reindex_list_non_uniquec              	   C   sD   d}t ddddg}tjt|d |tddg W 5 Q R X d S r   r   r   r   r   r   r   r   r   r   r   #test_reindex_categorical_non_unique   s    z/TestReindex.test_reindex_categorical_non_uniquec              	   C   sL   d}t ddddgddddgd}tjt|d |ddg W 5 Q R X d S Nr   r	   r
   r   d
categoriesr   r   r   r   r   r   ,test_reindex_list_non_unique_unused_category   s    z8TestReindex.test_reindex_list_non_unique_unused_categoryc              	   C   sP   d}t ddddgddddgd}tjt|d |tddg W 5 Q R X d S 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   objectZdtypeTexactr      )	r   r   r   tmassert_index_equalassert_numpy_array_equalnparrayintp)r   catresindexerexpr   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_index6   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ordered      )r   r   r   r'   r(   )r   r   Zci_addresult_expectedr   r   r   'test_reindex_categorical_added_category=   s    	z3TestReindex.test_reindex_categorical_added_categoryN)
__name__
__module____qualname__r   r   r    r!   r1   r3   r<   r   r   r   r   r      s   r   )Znumpyr*   r   Zpandasr   r   r   r   Zpandas._testingZ_testingr'   r   r   r   r   r   <module>   s   