3
Êb_ø  ã               @   s0  d Z ddlZddlZddlZddlmZ ddlZ	ddlm
Z
mZmZmZ ddljZddlmZ ddlmZ eefejejfe
efejejfe
efejejfe
efejejfiZejejedƒdjd	�d
d„ ƒZdd„ Zdd„ Zej j!dej"ƒ ƒdd„ ƒZ#ej j!ddddd d!d"d#d$d%d&d'd(d)d*d+gƒdd„ ƒZ$dS ),zX
The tests in this package are to ensure the proper resultant dtypes of
set operations.
é    N)Úis_dtype_equal)ÚFloat64IndexÚ
Int64IndexÚ
RangeIndexÚUInt64Index)Úpandas_dtype)Úindices_dicté   ú-)ÚparamsÚidsc             C   s   t | jd  t | jd  fS )z3
    Create all combinations of 2 index types.
    r   é   )r   Úparam)Úrequest© r   úB/tmp/pip-build-jkwsxyiy/pandas/pandas/tests/indexes/test_setops.pyÚ
index_pair   s    r   c             C   s*   | j ƒ }| j ƒ }|j|ƒj|jks&t‚d S )N)Úsort_valuesÚunionÚdtypeÚAssertionError)ÚindicesÚidx1Úidx2r   r   r   Útest_union_same_types"   s    r   c             C   s¶   | \}}t tt|ƒt|ƒgdd„ d�ƒ}|tkr:tjdƒ tdd„ | D ƒƒrVtjdƒ t|j|jƒrntjdƒ |j	ƒ }|j	ƒ }|j
|ƒjtjd	ƒks˜t‚|j
|ƒjtjd	ƒks²t‚d S )
Nc             S   s   t | ƒS )N)Ústr)Úxr   r   r   Ú<lambda>-   s    z,test_union_different_types.<locals>.<lambda>)Úkeyz0This test only considers non compatible indexes.c             s   s   | ]}t |tjƒV  qd S )N)Ú
isinstanceÚpdZ
MultiIndex)Ú.0Úidxr   r   r   ú	<genexpr>1   s    z-test_union_different_types.<locals>.<genexpr>z(This test doesn't consider multiindixes.z-This test only considers non matching dtypes.ÚO)ÚtupleÚsortedÚtypeÚCOMPATIBLE_INCONSISTENT_PAIRSÚpytestZxfailÚanyr   r   r   r   Únpr   )r   r   r   Z	type_pairr   r   r   Útest_union_different_types*   s     


r,   zidx_fact1,idx_fact2c             C   sT   | dƒ}|dƒ}|j |ƒ}|j |ƒ}|j|j|jfks:t‚|j|j|jfksPt‚d S )Né
   é   )r   r   r   )Z	idx_fact1Z	idx_fact2r   r   Zres1Zres2r   r   r   Ú"test_compatible_inconsistent_pairsD   s    

r/   zleft, right, expectedÚint64Úuint64ÚobjectÚfloat64údatetime64[ns]údatetime64[ns, CET]ú	Period[D]c             C   sF   t | ƒ} t |ƒ}tjg | d�}tjg |d�}||B j}||ksBt‚d S )N)r   )r   r    ÚIndexr   r   )ÚleftÚrightÚexpectedÚaÚbÚresultr   r   r   Útest_union_dtypesQ   s    
r>   )r0   r0   r0   )r0   r1   r2   )r0   r3   r3   )r1   r3   r3   )r1   r1   r1   )r3   r3   r3   )r4   r0   r2   )r4   r1   r2   )r4   r3   r2   )r5   r0   r2   )r5   r1   r2   )r5   r3   r2   )r6   r0   r2   )r6   r1   r2   )r6   r3   r2   )%Ú__doc__Ú	itertoolsÚitZnumpyr+   r)   Zpandas.core.dtypes.commonr   Zpandasr    r   r   r   r   Zpandas._testingZ_testingÚtmZpandas.api.typesr   Zpandas.tests.indexes.conftestr   ZmakeIntIndexZmakeRangeIndexZmakeFloatIndexZmakeUIntIndexr(   ZfixtureÚcombinationsÚjoinr   r   r,   ÚmarkZparametrizeÚvaluesr/   r>   r   r   r   r   Ú<module>   sD   
 