U
    f/e                     @   sJ   d dl Zd dlZd dlmZmZmZmZmZ d dl	m
Z G dd dZdS )    N)CategoricalCategoricalIndex	DataFrameIndexSeriesc                
   @   s   e Zd Zdd Zdd Zdd Zdd Zej	d	e
g d
gded
ged
gfe
g d
gdedgedgfe
g d
gde
d
ge
d
gfe
g d
gde
dge
dgfgdd ZdS )TestReindexc                 C   s  t ddddg}|ddg\}}tj|tdddgdd t|tjdddgtjd	 t ddddg}|t	ddg\}}t dddgddgd
}tj||dd t|tjdddgtjd	 t ddddgddddg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dgddddgd
}|t	ddg\}}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 )NabcTexactr         Zdtype
categoriesdobject)
r   reindextmassert_index_equalr   assert_numpy_array_equalnparrayintpr   )selfr
   resindexerexp r   Q/tmp/pip-unpacked-wheel-tiezk1ph/pandas/tests/indexes/categorical/test_reindex.pytest_reindex_dtype   s&    zTestReindex.test_reindex_dtypec                 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_index7   s    z$TestReindex.test_reindex_empty_indexc              	   C   sN   t ddddgdd}d}tjt|d |jddddd	gd
d W 5 Q R X d S )N   r   r   categoryr   z?'fill_value=-1' is not present in this Categorical's categories)match      r$   )Z
fill_value)r   pytestZraises	TypeErrorr   )r   Zsermsgr   r   r    test_reindex_missing_category>   s    z)TestReindex.test_reindex_missing_categoryzindex_df,index_res,index_expAr   Bc                 C   s0   t |d}|j|d}t |d}t|| d S )N)index)r   r   r   Zassert_frame_equal)r   Zindex_dfZ	index_resZ	index_expZdfresultexpectedr   r   r    test_reindex_not_categoryE   s    

z%TestReindex.test_reindex_not_categoryN)__name__
__module____qualname__r!   r#   r%   r.   r+   markZparametrizer   r   r4   r   r   r   r    r      s2   r   )Znumpyr   r+   Zpandasr   r   r   r   r   Zpandas._testingZ_testingr   r   r   r   r   r    <module>   s   