o
    ҷh                     @   sj   d dl m Z mZ d dlZd dlZd dlmZ d dlm	Z	m
Z
 ejdd ZG dd dZG dd	 d	ZdS )
    )datetime	timedeltaN)Index
RangeIndexc                  C   s   g d} t | tjdS )N)               
                              l           dtype)r   npuint64)large r   [/var/www/html/venv/lib/python3.10/site-packages/pandas/tests/indexes/numeric/test_setops.pyindex_large   s   r   c                   @   s   e Zd Zejdg ddd Zdd Zejdddgd	d
 Zdd Z	dd Z
dd Zdd Zejdeg ddddfeg ddddfgdd Zdd ZdS )
TestSetOpsr   )f8u8i8c                 C   s   t tjd|d|d}|j|ksJ t dd tdD td}||}t t||f}t	|| ||}t t||f}t	|| d S )N   r
   c                 S   s   g | ]
}t  t| qS r   )r   nowr   ).0ir   r   r   
<listcomp>   s    z5TestSetOps.test_union_non_numeric.<locals>.<listcomp>   )
r   r   aranger   rangeobjectunionconcatenatetmassert_index_equal)selfr   indexotherresultexpectedr   r   r   test_union_non_numeric   s   

z!TestSetOps.test_union_non_numericc              	   C   s   t tdtjd}t g d}||}t tt|j|j}t	|| ||}t tt
t|j|j}t	|| d S )Nr   r
   )         r   r   )r   r   r   int64intersectionsortintersect1dvaluesr!   r"   asarrayr#   r$   r%   r&   r'   r   r   r   test_intersection'   s   

zTestSetOps.test_intersectionr,   r   c                 C   sd   t g d|d}t ddgtjd}t g dtjd}||}t|| ||}t|| d S )N)r   r*   r+   r
         ?      ?)        r4   r5          @g      @)r   r   float64r   r!   r"   )r#   r   r$   r%   r'   r&   r   r   r   test_int_float_union_dtype5   s   

z%TestSetOps.test_int_float_union_dtypec                 C   s`   t ddd}tddgtjd}||}tg dtjd}t|| ||}t|| d S )Nr   r+   startstopr4   r5   r
   )r6   r4   r)   r5   r7   )r   r   r   r8   r   r!   r"   r2   r   r   r   test_range_float_union_dtypeB   s   

z'TestSetOps.test_range_float_union_dtypec                 C   s^   t ddd}tddgtjd}||}tg dtd}t|| ||}t|| d S )Nr   r+   r:   
   r
   )r   r)   r*   r>   )r   r   r   r   r   r   r!   r"   r2   r   r   r   test_range_uint64_union_dtypeM   s   

z(TestSetOps.test_range_uint64_union_dtypec                 C   sH   t g d}t g d}||}t|| ||}t|| d S )N)g      ?r*   r+   )123)r   
differencer!   r"   )r#   float_indexstring_indexr&   r   r   r   test_float64_index_differenceX   s   

z(TestSetOps.test_float64_index_differencec              	   C   sv   t g d}||}t tt|j|j}t|| ||}t ttt|j|j}t|| d S )N)r   l           r   r   r	   )	r   r-   r   r.   r/   r0   r!   r"   r1   )r#   r   r%   r&   r'   r   r   r   ,test_intersection_uint64_outside_int64_rangec   s   

z7TestSetOps.test_intersection_uint64_outside_int64_rangezindex2,keeps_name)r         r   r+   r$   nameTr%   Fc                 C   sT   t g ddd}t g d}|rd|_|j||d}|d u r"| }t|| d S )N)r   r+   r*   r   r)   r$   rJ   )r   r+   r   r.   )r   rK   r-   sort_valuesr!   r"   )r#   index2
keeps_namer.   index1r'   r&   r   r   r   test_intersection_monotonico   s   z&TestSetOps.test_intersection_monotonicc                 C   st   t g ddd}t g d}|j||d}t ddg}t||s#J |jd u s*J |d u r2| }t|| d S )N)r   r*   r+   r   rP   rJ   )r*   r+   r   r)   rL   r   r)   )r   symmetric_differencer!   equalContentsrK   rM   r"   )r#   r.   rP   rN   r&   r'   r   r   r   test_symmetric_difference   s   z$TestSetOps.test_symmetric_differenceN)__name__
__module____qualname__pytestmarkparametrizer(   r3   r9   r=   r?   rF   rG   r   rQ   rT   r   r   r   r   r      s$    


r   c                   @   sP   e Zd Zejdededgdd Zejdededgdd ZdS )TestSetOpsSortslice_Nr   c                 C   sR   t g d}|| }t||| t||| t|j|dd| d S )Nr)   r   r*   FrL   )r   r!   r"   r   )r#   r\   idxr%   r   r   r   test_union_sort_other_special   s
   z,TestSetOpsSort.test_union_sort_other_specialc                 C   s>   t g d}|| }|j|dd}t g d}t|| d S )Nr]   TrL   )r   r)   r*   )r   r   r!   r"   )r#   r\   r^   r%   r&   r'   r   r   r   test_union_sort_special_true   s
   z+TestSetOpsSort.test_union_sort_special_true)	rU   rV   rW   rX   rY   rZ   slicer_   r`   r   r   r   r   r[      s
    
r[   )r   r   numpyr   rX   pandas._testing_testingr!   pandas.core.indexes.apir   r   fixturer   r   r[   r   r   r   r   <module>   s    
x