U
    cf                     @   sL   d dl Zd dlmZmZmZmZmZmZm	Z	 G dd dZ
G dd dZdS )    N)CategoricalCategoricalIndexSeries
date_rangeoption_contextperiod_rangetimedelta_rangec                   @   s   e Zd Zdd ZdS )TestCategoricalReprWithFactorc                 C   s*   ddg}d |}t|}||ks&td S )Nz(['a', 'b', 'b', 'a', 'a', 'c', 'c', 'c']z)Categories (3, object): ['a' < 'b' < 'c']
)joinreprAssertionErrorselfZfactorexpectedactual r   M/tmp/pip-unpacked-wheel-g7fro6k3/pandas/tests/arrays/categorical/test_repr.py
test_print   s    
z(TestCategoricalReprWithFactor.test_printN)__name__
__module____qualname__r   r   r   r   r   r	      s   r	   c                   @   s   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d Z
dd Zdd Zdd Zdd Zdd Zdd Zd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 ).TestCategoricalReprc                 C   sP   t ddddddgd dddgdd	}d
ddg}d|}t|}||ksLtd S )Nr         d   abcT)Zfastpathz7['a', 'b', 'c', 'a', 'b', ..., 'b', 'c', 'a', 'b', 'c']zLength: 600z'Categories (3, object): ['a', 'b', 'c']r
   )r   r   r   r   r   r   r   r   test_big_print   s    $
z"TestCategoricalRepr.test_big_printc                 C   s   t g dddg}d}t|}||ks(t||ks4tt g dddgdd}d}t|}||ks`tt g g }d}|t|ks~td S )	Nr   r   r   z+[], Categories (3, object): ['a', 'b', 'c']Torderedz-[], Categories (3, object): ['a' < 'b' < 'c']z[], Categories (0, object): [])r   r   r   r   r   r   r   test_empty_print'   s    
z$TestCategoricalRepr.test_empty_printc              	   C   sB   t tddddg}d}tdd  |t|ks4tW 5 Q R X d S )Nr   r         zO0    1
1    2
2    3
3    4
dtype: category
Categories (4, int64): [1, 2, 3, 4]zdisplay.width)r   r   r   r   r   )r   r   expr   r   r   test_print_none_width7   s
    z)TestCategoricalRepr.test_print_none_widthc              	   C   s   t dddgd }d}t||ks&tt dddgd }d	}t||ksLttd
d, t dddgd }d	}t||ks~tW 5 Q R X d S )NZaaaaaZbbZcccc   z['aaaaa', 'bb', 'cccc', 'aaaaa', 'bb', ..., 'bb', 'cccc', 'aaaaa', 'bb', 'cccc']
Length: 60
Categories (3, object): ['aaaaa', 'bb', 'cccc']u   ああああu   いいいいいu   うううううううu,  ['ああああ', 'いいいいい', 'ううううううう', 'ああああ', 'いいいいい', ..., 'いいいいい', 'ううううううう', 'ああああ', 'いいいいい', 'ううううううう']
Length: 60
Categories (3, object): ['ああああ', 'いいいいい', 'ううううううう']z display.unicode.east_asian_widthT)r   r   r   r   )r   r   r   r   r   r   test_unicode_printB   s    z&TestCategoricalRepr.test_unicode_printc                 C   s   t dddg}d}t||ks"tt ddddddgdddgd}d}t||ksTtt dddddgd	 }d
}t||ks~tt td}d}t||kstd S )Nr   r   r#   z*[1, 2, 3]
Categories (3, int64): [1, 2, 3]
categoriesz3[1, 2, 3, 1, 2, 3]
Categories (3, int64): [1, 2, 3]r$      
   zU[1, 2, 3, 4, 5, ..., 1, 2, 3, 4, 5]
Length: 50
Categories (5, int64): [1, 2, 3, 4, 5]r'   zm[0, 1, 2, 3, 4, ..., 15, 16, 17, 18, 19]
Length: 20
Categories (20, int64): [0, 1, 2, 3, ..., 16, 17, 18, 19]r   r   r   nparanger   r   r%   r   r   r   test_categorical_repr^   s    z)TestCategoricalRepr.test_categorical_reprc                 C   s   t dddgdd}d}t||ks&tt ddddddgdddgdd}d}t||ksZtt dddd	d
gd dd}d}t||kstt tddd}d}t||kstd S )Nr   r   r#   Tr    z,[1, 2, 3]
Categories (3, int64): [1 < 2 < 3]r*   r!   z5[1, 2, 3, 1, 2, 3]
Categories (3, int64): [1 < 2 < 3]r$   r+   r,   zY[1, 2, 3, 4, 5, ..., 1, 2, 3, 4, 5]
Length: 50
Categories (5, int64): [1 < 2 < 3 < 4 < 5]r'   zq[0, 1, 2, 3, 4, ..., 15, 16, 17, 18, 19]
Length: 20
Categories (20, int64): [0 < 1 < 2 < 3 ... 16 < 17 < 18 < 19]r-   r0   r   r   r   test_categorical_repr_orderedy   s     z1TestCategoricalRepr.test_categorical_repr_orderedc                 C   s   t dddd}t|}d}t||ks*tt|||d}d}t||ksPtt ddddd	}t|}d
}t||ks|tt|||d}d}t||kstd S )N2011-01-01 09:00Hr+   freqperiodsa  [2011-01-01 09:00:00, 2011-01-01 10:00:00, 2011-01-01 11:00:00, 2011-01-01 12:00:00, 2011-01-01 13:00:00]
Categories (5, datetime64[ns]): [2011-01-01 09:00:00, 2011-01-01 10:00:00, 2011-01-01 11:00:00,
                                 2011-01-01 12:00:00, 2011-01-01 13:00:00]r)   a}  [2011-01-01 09:00:00, 2011-01-01 10:00:00, 2011-01-01 11:00:00, 2011-01-01 12:00:00, 2011-01-01 13:00:00, 2011-01-01 09:00:00, 2011-01-01 10:00:00, 2011-01-01 11:00:00, 2011-01-01 12:00:00, 2011-01-01 13:00:00]
Categories (5, datetime64[ns]): [2011-01-01 09:00:00, 2011-01-01 10:00:00, 2011-01-01 11:00:00,
                                 2011-01-01 12:00:00, 2011-01-01 13:00:00]
US/Easternr7   r8   tza  [2011-01-01 09:00:00-05:00, 2011-01-01 10:00:00-05:00, 2011-01-01 11:00:00-05:00, 2011-01-01 12:00:00-05:00, 2011-01-01 13:00:00-05:00]
Categories (5, datetime64[ns, US/Eastern]): [2011-01-01 09:00:00-05:00, 2011-01-01 10:00:00-05:00,
                                             2011-01-01 11:00:00-05:00, 2011-01-01 12:00:00-05:00,
                                             2011-01-01 13:00:00-05:00]a  [2011-01-01 09:00:00-05:00, 2011-01-01 10:00:00-05:00, 2011-01-01 11:00:00-05:00, 2011-01-01 12:00:00-05:00, 2011-01-01 13:00:00-05:00, 2011-01-01 09:00:00-05:00, 2011-01-01 10:00:00-05:00, 2011-01-01 11:00:00-05:00, 2011-01-01 12:00:00-05:00, 2011-01-01 13:00:00-05:00]
Categories (5, datetime64[ns, US/Eastern]): [2011-01-01 09:00:00-05:00, 2011-01-01 10:00:00-05:00,
                                             2011-01-01 11:00:00-05:00, 2011-01-01 12:00:00-05:00,
                                             2011-01-01 13:00:00-05:00]r   r   r   r   appendr   idxr   r%   r   r   r   test_categorical_repr_datetime   s$    	z2TestCategoricalRepr.test_categorical_repr_datetimec                 C   s   t dddd}t|dd}d}t||ks.tt|||dd}d	}t||ksVtt dddd
d}t|dd}d}t||kstt|||dd}d}t||kstd S )Nr4   r5   r+   r6   Tr    a  [2011-01-01 09:00:00, 2011-01-01 10:00:00, 2011-01-01 11:00:00, 2011-01-01 12:00:00, 2011-01-01 13:00:00]
Categories (5, datetime64[ns]): [2011-01-01 09:00:00 < 2011-01-01 10:00:00 < 2011-01-01 11:00:00 <
                                 2011-01-01 12:00:00 < 2011-01-01 13:00:00]r2   a  [2011-01-01 09:00:00, 2011-01-01 10:00:00, 2011-01-01 11:00:00, 2011-01-01 12:00:00, 2011-01-01 13:00:00, 2011-01-01 09:00:00, 2011-01-01 10:00:00, 2011-01-01 11:00:00, 2011-01-01 12:00:00, 2011-01-01 13:00:00]
Categories (5, datetime64[ns]): [2011-01-01 09:00:00 < 2011-01-01 10:00:00 < 2011-01-01 11:00:00 <
                                 2011-01-01 12:00:00 < 2011-01-01 13:00:00]r9   r:   a  [2011-01-01 09:00:00-05:00, 2011-01-01 10:00:00-05:00, 2011-01-01 11:00:00-05:00, 2011-01-01 12:00:00-05:00, 2011-01-01 13:00:00-05:00]
Categories (5, datetime64[ns, US/Eastern]): [2011-01-01 09:00:00-05:00 < 2011-01-01 10:00:00-05:00 <
                                             2011-01-01 11:00:00-05:00 < 2011-01-01 12:00:00-05:00 <
                                             2011-01-01 13:00:00-05:00]a   [2011-01-01 09:00:00-05:00, 2011-01-01 10:00:00-05:00, 2011-01-01 11:00:00-05:00, 2011-01-01 12:00:00-05:00, 2011-01-01 13:00:00-05:00, 2011-01-01 09:00:00-05:00, 2011-01-01 10:00:00-05:00, 2011-01-01 11:00:00-05:00, 2011-01-01 12:00:00-05:00, 2011-01-01 13:00:00-05:00]
Categories (5, datetime64[ns, US/Eastern]): [2011-01-01 09:00:00-05:00 < 2011-01-01 10:00:00-05:00 <
                                             2011-01-01 11:00:00-05:00 < 2011-01-01 12:00:00-05:00 <
                                             2011-01-01 13:00:00-05:00]r<   r>   r   r   r   &test_categorical_repr_datetime_ordered   s    z:TestCategoricalRepr.test_categorical_repr_datetime_orderedc                 C   sV   t ddtjg}d}t||ks$ttddtjgddd}d}t||ksRtd S )Nr   r   z)[1, 2, NaN]
Categories (2, int64): [1, 2]object)ZdtypecategoryzH0      1
1      2
2    NaN
dtype: category
Categories (2, int64): [1, 2])r   r.   nanr   r   r   Zastype)r   r   Zc_expsZs_expr   r   r   "test_categorical_repr_int_with_nan   s    z6TestCategoricalRepr.test_categorical_repr_int_with_nanc                 C   s   t dddd}t|}d}t||ks*tt|||d}d}t||ksPtt dd	dd}t|}d
}t||ksztt|||d}d}t||kstd S )Nr4   r5   r+   r6   z[2011-01-01 09:00, 2011-01-01 10:00, 2011-01-01 11:00, 2011-01-01 12:00, 2011-01-01 13:00]
Categories (5, period[H]): [2011-01-01 09:00, 2011-01-01 10:00, 2011-01-01 11:00, 2011-01-01 12:00,
                            2011-01-01 13:00]r)   aF  [2011-01-01 09:00, 2011-01-01 10:00, 2011-01-01 11:00, 2011-01-01 12:00, 2011-01-01 13:00, 2011-01-01 09:00, 2011-01-01 10:00, 2011-01-01 11:00, 2011-01-01 12:00, 2011-01-01 13:00]
Categories (5, period[H]): [2011-01-01 09:00, 2011-01-01 10:00, 2011-01-01 11:00, 2011-01-01 12:00,
                            2011-01-01 13:00]2011-01Mzv[2011-01, 2011-02, 2011-03, 2011-04, 2011-05]
Categories (5, period[M]): [2011-01, 2011-02, 2011-03, 2011-04, 2011-05]z[2011-01, 2011-02, 2011-03, 2011-04, 2011-05, 2011-01, 2011-02, 2011-03, 2011-04, 2011-05]
Categories (5, period[M]): [2011-01, 2011-02, 2011-03, 2011-04, 2011-05]r   r   r   r   r=   r>   r   r   r   test_categorical_repr_period   s    z0TestCategoricalRepr.test_categorical_repr_periodc                 C   s   t dddd}t|dd}d}t||ks.tt|||dd}d	}t||ksVtt d
ddd}t|dd}d}t||kstt|||dd}d}t||kstd S )Nr4   r5   r+   r6   Tr    z[2011-01-01 09:00, 2011-01-01 10:00, 2011-01-01 11:00, 2011-01-01 12:00, 2011-01-01 13:00]
Categories (5, period[H]): [2011-01-01 09:00 < 2011-01-01 10:00 < 2011-01-01 11:00 < 2011-01-01 12:00 <
                            2011-01-01 13:00]r2   aJ  [2011-01-01 09:00, 2011-01-01 10:00, 2011-01-01 11:00, 2011-01-01 12:00, 2011-01-01 13:00, 2011-01-01 09:00, 2011-01-01 10:00, 2011-01-01 11:00, 2011-01-01 12:00, 2011-01-01 13:00]
Categories (5, period[H]): [2011-01-01 09:00 < 2011-01-01 10:00 < 2011-01-01 11:00 < 2011-01-01 12:00 <
                            2011-01-01 13:00]rG   rH   zz[2011-01, 2011-02, 2011-03, 2011-04, 2011-05]
Categories (5, period[M]): [2011-01 < 2011-02 < 2011-03 < 2011-04 < 2011-05]z[2011-01, 2011-02, 2011-03, 2011-04, 2011-05, 2011-01, 2011-02, 2011-03, 2011-04, 2011-05]
Categories (5, period[M]): [2011-01 < 2011-02 < 2011-03 < 2011-04 < 2011-05]rI   r>   r   r   r   $test_categorical_repr_period_ordered  s    z8TestCategoricalRepr.test_categorical_repr_period_orderedc                 C   s   t ddd}t|}d}t||ks(tt|||d}d}t||ksNtt ddd}t|}d	}t||ksvtt|||d}d
}t||kstd S )N1 daysr+   r8   zr[1 days, 2 days, 3 days, 4 days, 5 days]
Categories (5, timedelta64[ns]): [1 days, 2 days, 3 days, 4 days, 5 days]r)   z[1 days, 2 days, 3 days, 4 days, 5 days, 1 days, 2 days, 3 days, 4 days, 5 days]
Categories (5, timedelta64[ns]): [1 days, 2 days, 3 days, 4 days, 5 days]1 hoursr'   a  [0 days 01:00:00, 1 days 01:00:00, 2 days 01:00:00, 3 days 01:00:00, 4 days 01:00:00, ..., 15 days 01:00:00, 16 days 01:00:00, 17 days 01:00:00, 18 days 01:00:00, 19 days 01:00:00]
Length: 20
Categories (20, timedelta64[ns]): [0 days 01:00:00, 1 days 01:00:00, 2 days 01:00:00,
                                   3 days 01:00:00, ..., 16 days 01:00:00, 17 days 01:00:00,
                                   18 days 01:00:00, 19 days 01:00:00]a  [0 days 01:00:00, 1 days 01:00:00, 2 days 01:00:00, 3 days 01:00:00, 4 days 01:00:00, ..., 15 days 01:00:00, 16 days 01:00:00, 17 days 01:00:00, 18 days 01:00:00, 19 days 01:00:00]
Length: 40
Categories (20, timedelta64[ns]): [0 days 01:00:00, 1 days 01:00:00, 2 days 01:00:00,
                                   3 days 01:00:00, ..., 16 days 01:00:00, 17 days 01:00:00,
                                   18 days 01:00:00, 19 days 01:00:00]r   r   r   r   r=   r>   r   r   r   test_categorical_repr_timedelta8  s    z3TestCategoricalRepr.test_categorical_repr_timedeltac                 C   s   t ddd}t|dd}d}t||ks,tt|||dd}d}t||ksTtt d	d
d}t|dd}d}t||kstt|||dd}d}t||kstd S )NrL   r+   rM   Tr    zv[1 days, 2 days, 3 days, 4 days, 5 days]
Categories (5, timedelta64[ns]): [1 days < 2 days < 3 days < 4 days < 5 days]r2   z[1 days, 2 days, 3 days, 4 days, 5 days, 1 days, 2 days, 3 days, 4 days, 5 days]
Categories (5, timedelta64[ns]): [1 days < 2 days < 3 days < 4 days < 5 days]rN   r'   a  [0 days 01:00:00, 1 days 01:00:00, 2 days 01:00:00, 3 days 01:00:00, 4 days 01:00:00, ..., 15 days 01:00:00, 16 days 01:00:00, 17 days 01:00:00, 18 days 01:00:00, 19 days 01:00:00]
Length: 20
Categories (20, timedelta64[ns]): [0 days 01:00:00 < 1 days 01:00:00 < 2 days 01:00:00 <
                                   3 days 01:00:00 ... 16 days 01:00:00 < 17 days 01:00:00 <
                                   18 days 01:00:00 < 19 days 01:00:00]a  [0 days 01:00:00, 1 days 01:00:00, 2 days 01:00:00, 3 days 01:00:00, 4 days 01:00:00, ..., 15 days 01:00:00, 16 days 01:00:00, 17 days 01:00:00, 18 days 01:00:00, 19 days 01:00:00]
Length: 40
Categories (20, timedelta64[ns]): [0 days 01:00:00 < 1 days 01:00:00 < 2 days 01:00:00 <
                                   3 days 01:00:00 ... 16 days 01:00:00 < 17 days 01:00:00 <
                                   18 days 01:00:00 < 19 days 01:00:00]rO   r>   r   r   r   'test_categorical_repr_timedelta_orderedY  s    z;TestCategoricalRepr.test_categorical_repr_timedelta_orderedc                 C   sP   t tdddg}d}t||ks&tt ttd}d}t||ksLtd S )Nr   r   r#   zRCategoricalIndex([1, 2, 3], categories=[1, 2, 3], ordered=False, dtype='category')r,   z{CategoricalIndex([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], categories=[0, 1, 2, 3, ..., 6, 7, 8, 9], ordered=False, dtype='category')r   r   r   r   r.   r/   )r   r?   r%   ir   r   r   test_categorical_index_reprz  s    z/TestCategoricalRepr.test_categorical_index_reprc                 C   sX   t tdddgdd}d}t||ks*tt ttddd}d}t||ksTtd S )	Nr   r   r#   Tr    zQCategoricalIndex([1, 2, 3], categories=[1, 2, 3], ordered=True, dtype='category')r,   zzCategoricalIndex([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], categories=[0, 1, 2, 3, ..., 6, 7, 8, 9], ordered=True, dtype='category')rR   )r   rS   r%   r   r   r   #test_categorical_index_repr_ordered  s    z7TestCategoricalRepr.test_categorical_index_repr_orderedc                 C   sb   t dddd}tt|}d}t||ks.tt ddddd}tt|}d}t||ks^td S )	Nr4   r5   r+   r6   aQ  CategoricalIndex(['2011-01-01 09:00:00', '2011-01-01 10:00:00',
                  '2011-01-01 11:00:00', '2011-01-01 12:00:00',
                  '2011-01-01 13:00:00'],
                 categories=[2011-01-01 09:00:00, 2011-01-01 10:00:00, 2011-01-01 11:00:00, 2011-01-01 12:00:00, 2011-01-01 13:00:00], ordered=False, dtype='category')r9   r:   a  CategoricalIndex(['2011-01-01 09:00:00-05:00', '2011-01-01 10:00:00-05:00',
                  '2011-01-01 11:00:00-05:00', '2011-01-01 12:00:00-05:00',
                  '2011-01-01 13:00:00-05:00'],
                 categories=[2011-01-01 09:00:00-05:00, 2011-01-01 10:00:00-05:00, 2011-01-01 11:00:00-05:00, 2011-01-01 12:00:00-05:00, 2011-01-01 13:00:00-05:00], ordered=False, dtype='category'))r   r   r   r   r   r   r?   rS   r%   r   r   r   $test_categorical_index_repr_datetime  s    z8TestCategoricalRepr.test_categorical_index_repr_datetimec                 C   s   t dddd}tt|dd}d}t||ks2tt ddddd	}tt|dd}d
}t||ksfttt||dd}d}t||kstd S )Nr4   r5   r+   r6   Tr    aP  CategoricalIndex(['2011-01-01 09:00:00', '2011-01-01 10:00:00',
                  '2011-01-01 11:00:00', '2011-01-01 12:00:00',
                  '2011-01-01 13:00:00'],
                 categories=[2011-01-01 09:00:00, 2011-01-01 10:00:00, 2011-01-01 11:00:00, 2011-01-01 12:00:00, 2011-01-01 13:00:00], ordered=True, dtype='category')r9   r:   a  CategoricalIndex(['2011-01-01 09:00:00-05:00', '2011-01-01 10:00:00-05:00',
                  '2011-01-01 11:00:00-05:00', '2011-01-01 12:00:00-05:00',
                  '2011-01-01 13:00:00-05:00'],
                 categories=[2011-01-01 09:00:00-05:00, 2011-01-01 10:00:00-05:00, 2011-01-01 11:00:00-05:00, 2011-01-01 12:00:00-05:00, 2011-01-01 13:00:00-05:00], ordered=True, dtype='category')aA  CategoricalIndex(['2011-01-01 09:00:00-05:00', '2011-01-01 10:00:00-05:00',
                  '2011-01-01 11:00:00-05:00', '2011-01-01 12:00:00-05:00',
                  '2011-01-01 13:00:00-05:00', '2011-01-01 09:00:00-05:00',
                  '2011-01-01 10:00:00-05:00', '2011-01-01 11:00:00-05:00',
                  '2011-01-01 12:00:00-05:00', '2011-01-01 13:00:00-05:00'],
                 categories=[2011-01-01 09:00:00-05:00, 2011-01-01 10:00:00-05:00, 2011-01-01 11:00:00-05:00, 2011-01-01 12:00:00-05:00, 2011-01-01 13:00:00-05:00], ordered=True, dtype='category'))r   r   r   r   r   r=   rV   r   r   r   ,test_categorical_index_repr_datetime_ordered  s    z@TestCategoricalRepr.test_categorical_index_repr_datetime_orderedc                 C   s  t dddd}tt|}d}t||ks.tt dddd}tt|}d}t||ks\tt dddd}tt|}d	}t||kstt ddd
d}tt|}d}t||ksttt||}d}t||kstt ddd
d}tt|}d}t||kstd S )Nr4   r5   r   r6   zfCategoricalIndex(['2011-01-01 09:00'], categories=[2011-01-01 09:00], ordered=False, dtype='category')r   zCategoricalIndex(['2011-01-01 09:00', '2011-01-01 10:00'], categories=[2011-01-01 09:00, 2011-01-01 10:00], ordered=False, dtype='category')r#   zCategoricalIndex(['2011-01-01 09:00', '2011-01-01 10:00', '2011-01-01 11:00'], categories=[2011-01-01 09:00, 2011-01-01 10:00, 2011-01-01 11:00], ordered=False, dtype='category')r+   a!  CategoricalIndex(['2011-01-01 09:00', '2011-01-01 10:00', '2011-01-01 11:00',
                  '2011-01-01 12:00', '2011-01-01 13:00'],
                 categories=[2011-01-01 09:00, 2011-01-01 10:00, 2011-01-01 11:00, 2011-01-01 12:00, 2011-01-01 13:00], ordered=False, dtype='category')a  CategoricalIndex(['2011-01-01 09:00', '2011-01-01 10:00', '2011-01-01 11:00',
                  '2011-01-01 12:00', '2011-01-01 13:00', '2011-01-01 09:00',
                  '2011-01-01 10:00', '2011-01-01 11:00', '2011-01-01 12:00',
                  '2011-01-01 13:00'],
                 categories=[2011-01-01 09:00, 2011-01-01 10:00, 2011-01-01 11:00, 2011-01-01 12:00, 2011-01-01 13:00], ordered=False, dtype='category')rG   rH   zCategoricalIndex(['2011-01', '2011-02', '2011-03', '2011-04', '2011-05'], categories=[2011-01, 2011-02, 2011-03, 2011-04, 2011-05], ordered=False, dtype='category'))r   r   r   r   r   r=   rV   r   r   r   "test_categorical_index_repr_period  s.    z6TestCategoricalRepr.test_categorical_index_repr_periodc                 C   sh   t dddd}tt|dd}d}t||ks2tt dd	dd}tt|dd}d
}t||ksdtd S )Nr4   r5   r+   r6   Tr    a   CategoricalIndex(['2011-01-01 09:00', '2011-01-01 10:00', '2011-01-01 11:00',
                  '2011-01-01 12:00', '2011-01-01 13:00'],
                 categories=[2011-01-01 09:00, 2011-01-01 10:00, 2011-01-01 11:00, 2011-01-01 12:00, 2011-01-01 13:00], ordered=True, dtype='category')rG   rH   zCategoricalIndex(['2011-01', '2011-02', '2011-03', '2011-04', '2011-05'], categories=[2011-01, 2011-02, 2011-03, 2011-04, 2011-05], ordered=True, dtype='category'))r   r   r   r   r   rV   r   r   r   *test_categorical_index_repr_period_ordered  s    z>TestCategoricalRepr.test_categorical_index_repr_period_orderedc                 C   s\   t ddd}tt|}d}t||ks,tt ddd}tt|}d}t||ksXtd S )NrL   r+   rM   zCategoricalIndex(['1 days', '2 days', '3 days', '4 days', '5 days'], categories=[1 days, 2 days, 3 days, 4 days, 5 days], ordered=False, dtype='category')rN   r,   a  CategoricalIndex(['0 days 01:00:00', '1 days 01:00:00', '2 days 01:00:00',
                  '3 days 01:00:00', '4 days 01:00:00', '5 days 01:00:00',
                  '6 days 01:00:00', '7 days 01:00:00', '8 days 01:00:00',
                  '9 days 01:00:00'],
                 categories=[0 days 01:00:00, 1 days 01:00:00, 2 days 01:00:00, 3 days 01:00:00, ..., 6 days 01:00:00, 7 days 01:00:00, 8 days 01:00:00, 9 days 01:00:00], ordered=False, dtype='category')r   r   r   r   r   rV   r   r   r   %test_categorical_index_repr_timedelta  s    z9TestCategoricalRepr.test_categorical_index_repr_timedeltac                 C   sd   t ddd}tt|dd}d}t||ks0tt ddd}tt|dd}d	}t||ks`td S )
NrL   r+   rM   Tr    zCategoricalIndex(['1 days', '2 days', '3 days', '4 days', '5 days'], categories=[1 days, 2 days, 3 days, 4 days, 5 days], ordered=True, dtype='category')rN   r,   a  CategoricalIndex(['0 days 01:00:00', '1 days 01:00:00', '2 days 01:00:00',
                  '3 days 01:00:00', '4 days 01:00:00', '5 days 01:00:00',
                  '6 days 01:00:00', '7 days 01:00:00', '8 days 01:00:00',
                  '9 days 01:00:00'],
                 categories=[0 days 01:00:00, 1 days 01:00:00, 2 days 01:00:00, 3 days 01:00:00, ..., 6 days 01:00:00, 7 days 01:00:00, 8 days 01:00:00, 9 days 01:00:00], ordered=True, dtype='category')r[   rV   r   r   r   -test_categorical_index_repr_timedelta_ordered  s    zATestCategoricalRepr.test_categorical_index_repr_timedelta_orderedc                 C   s(   t tddddg}d}||ks$td S )Nr   2r#   r$   z5[1, '2', 3, 4]
Categories (4, object): [1, 3, 4, '2'])r   r   r   )r   resultr   r   r   r   test_categorical_str_repr  s    z-TestCategoricalRepr.test_categorical_str_reprN)r   r   r   r   r"   r&   r(   r1   r3   r@   rA   rF   rJ   rK   rP   rQ   rT   rU   rW   rX   rY   rZ   r\   r]   r`   r   r   r   r   r      s,   >!!!		'r   )Znumpyr.   Zpandasr   r   r   r   r   r   r   r	   r   r   r   r   r   <module>   s   $