a
    DBìjz  ã                   @   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   sP   d}t g d¢ƒ}tjt|d�� | ddg¡ W d   ƒ n1 sB0    Y  d S ©Nú/cannot reindex on an axis with duplicate labels©ÚaÚbÚcr
   ©Úmatchr
   r   ©r   ÚpytestÚraisesÚ
ValueErrorÚreindex©ÚselfÚmsgÚci© r   úl/mnt/bigstor/www/usecases/.venv/lib/python3.9/site-packages/pandas/tests/indexes/categorical/test_reindex.pyÚtest_reindex_list_non_unique   s    z(TestReindex.test_reindex_list_non_uniquec                 C   sT   d}t g d¢ƒ}tjt|d��" | tddgƒ¡ W d   ƒ n1 sF0    Y  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   sX   d}t g d¢g d¢d�}tjt|d�� | ddg¡ W d   ƒ n1 sJ0    Y  d S ©Nr   r	   ©r
   r   r   Úd©Ú
categoriesr   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\   d}t g d¢g d¢d�}tjt|d��" | tddgƒ¡ W d   ƒ n1 sN0    Y  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 g d¢g d¢d�}| g d¢¡\}}tg d¢ƒ}tj||dd� t |tjg d¢tjd�¡ | t g d¢g d¢d�¡\}}t g d¢g d¢d�}tj||dd� t |tjg d¢tjd�¡ d S )	N)r
   r   r   r   r    )r
   r   r   T©Úexact)r   é   r&   ©Zdtype)	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/   r0   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)Ú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#   r2   r4   r>   r   r   r   r   r      s   r   )Únumpyr+   r   Zpandasr   r   r   r   Zpandas._testingZ_testingr(   r   r   r   r   r   Ú<module>   s   