o
    d                     @   sT  d dl Zd dlZd dlmZmZmZmZmZm	Z	 d dl
mZ d dlmZmZ d dlmZ d dlmZ dd Zejjdejejejejejejejejejej ej!ej"ej#ej$ej%ej&ej'ej(ej)ej*ej+ej,gd	d
 ddd Z-ejjdej.ej/ej0ej1gdd
 ddd Z2ejdej3ej4gdd Z5ejdej6ej7ej8gdd Z9dS )    N)CategoricalIndexDatetimeIndexIndexPeriodIndexTimedeltaIndexisna)is_complex_dtypeis_numeric_dtype)BooleanArray)DatetimeIndexOpsMixinc                 C   sr   | | k}t j| jtd}t j| | |d t|| | js7t j| jtd}t j| j| j|d t|| d S d S )Ndtypeout)	npemptyshapeboolequaltmassert_numpy_array_equalZ	_is_multiarray)indexresultr    r   Z/app/.heroku/python/lib/python3.10/site-packages/pandas/tests/indexes/test_numpy_compat.pytest_numpy_ufuncs_out   s   r   funcc                 C      | j S N__name__xr   r   r   <lambda>=       r$   )Zidsc              	   C   s,  t | trAtttf+ tjdd ||  W d    n1 s"w   Y  W d    d S W d    d S 1 s:w   Y  d S t| rt	| rQ|tj
tjfv stjdd$ || }|| j}|jtjkrm|tj}t|| jd}W d    n1 s~w   Y  t|| t | jtjrt| rt	| r|j| jksJ d S | jdv r|jdv sJ d S | jdv r|jdksJ d S |jdksJ d S t|tu sJ d S t| d	krd S tttf+ tjdd ||  W d    n1 sw   Y  W d    d S W d    d S 1 sw   Y  d S )
Nignore)all)name)r   Zint8Zuint8)float16float32)Zint16Zuint16r*   r*   Zfloat64r   )
isinstancer   r   external_error_raised	TypeErrorAttributeErrorr   Zerrstater	   r   deg2radrad2degvaluesr   r)   Zastyper*   r   r(   assert_index_equaltypelen)r   r   r   Z
arr_resultexpr   r   r   test_numpy_ufuncs_basic#   sN   
 
"



$r6   c                 C   r   r   r    r"   r   r   r   r$   j   r%   c                 C   s  t | ttfrO|tjtjtjfv r3|| }t |tjsJ tj| j	t
d}|| |d t|| d S tt ||  W d    d S 1 sHw   Y  d S t | trptt ||  W d    d S 1 siw   Y  d S t| rt| r}|tju s|| }t | jtjst |tsJ nt |tjsJ tj| j	t
d}|| |d t | jtjst||j d S t|| d S t| dkrd S tt ||  W d    d S 1 sw   Y  d S )Nr   r   r   )r+   r   r   r   isfiniteisinfisnanZndarrayr   r   r   r   r   r,   r-   r   r	   r   signbitr   r
   _datar4   )r   r   r   r   r   r   r   test_numpy_ufuncs_otheri   sB   
"

"
"r<   c                 C   s   t | dkrd S t| tr2| jjdu r2tjtdd ||  W d    d S 1 s+w   Y  d S || }|t	j
u rC| jdd}n| jdd}t|t|u sSJ t|r_t|s]J d S ||kseJ d S )Nr   Fzis not ordered for)match)Zskipna)r4   r+   r   r   ZorderedpytestZraisesr-   reducer   maximummaxminr3   r   )r   r   requestr   expectedr   r   r   test_numpy_ufuncs_reductions   s"   


rE   c                 C   sv   t g ddd}t g ddd}td  | ||}W d    n1 s%w   Y  t | |j|j}t|| d S )N)            Zint64r   )rH   rI         )r   r   Zassert_produces_warningr1   r2   )r   Zidx1Zidx2r   rD   r   r   r   test_numpy_ufuncs_bitwise   s   rL   ):numpyr   r>   Zpandasr   r   r   r   r   r   Zpandas._testingZ_testingr   Zpandas.api.typesr   r	   Zpandas.core.arraysr
   Z pandas.core.indexes.datetimeliker   r   markZparametrizer5   Zexp2expm1loglog2log10log1psqrtsincostanZarcsinZarccosZarctansinhcoshtanhZarcsinhZarccoshZarctanhr/   r0   r6   r7   r8   r9   r:   r<   r@   minimumrE   Zbitwise_andZ
bitwise_orZbitwise_xorrL   r   r   r   r   <module>   sX     
*
/
