a
    Pf                     @  s2  U d dl mZ d dlmZ d dlZd dlZd dlZd dl	m
Z dd ejD Zdgee Zded< ed	d ejD 7 Zed
d
g7 Zeejg dddg7 Zedg7 Zejeeedd eD d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ej d%g d&d'd( Z!dS ))    )annotations)AnyNc                 C  s   g | ]}t jg d |dqS ))         Ndtypepdarray.0r    r   c/var/www/ai-form-bot/venv/lib/python3.9/site-packages/pandas/tests/arrays/masked/test_arithmetic.py
<listcomp>       r   r   z	list[Any]scalarsc                 C  s   g | ]}t jg d |dqS ))g?皙?g333333?Nr   r	   r   r   r   r   r      r   r   )TFTNbooleanr   Fc                 C  s   g | ]}|j jqS r   )r   name)r   ar   r   r   r      r   )paramsZidsc                 C  s   | j S )zFixture returning parametrized (array, scalar) tuple.

    Used to test equivalence of scalars, numpy arrays with array ops, and the
    equivalence of DataFrame and Series ops.
    )param)requestr   r   r   data   s    r   c                 C  s$   t | jtjr d|v r td d S )Nsubz$subtract not implemented for boolean)
isinstancer   r
   ZBooleanDtypepytestskipr   Zop_namer   r   r   
check_skip    s    r    c                 C  s    | j jdko|dddv S )Nb_r)powtruedivfloordiv)r   kindstriplstripr   r   r   r   is_bool_not_implemented%   s    r*   c              	   C  s   | \} }t |}t| | tj|gt|  | jd}|| j|fD ]}t| |rd}t	j
t|d || | W d    n1 s0    Y  t	j
t|d || | W d    q1 s0    Y  qF|| |}|| |}t || qFd S Nr   -operator '.*' not implemented for bool dtypesmatch)tmget_op_from_namer    r
   r   lenr   typer*   r   raisesNotImplementedErrorassert_extension_array_equal)r   all_arithmetic_operatorsscalaropscalar_arraymsgresultexpectedr   r   r   "test_array_scalar_like_equivalence2   s    


(*

r=   c           
      C  s   | \} }t |}t| | tj}tjtjgt|  | jd}| j	 }t
| |rd}tjt|d || | W d    n1 s0    Y  t || j d S || |}t || j || |}	t || j t ||	 d S r+   )r/   r0   r    r
   ZNAr   r1   r   Z_maskcopyr*   r   r3   r4   Zassert_numpy_array_equalr5   )
r   r6   r"   r8   r7   r9   maskr:   r;   r<   r   r   r   test_array_NAG   s"    



(

r@   c           	      C  s   | \} }t |}t| | tj|gt|  | jjd}tj|| jd}t	| |rd}t
jt|d || | W d    n1 s0    Y  t
jt|d || | W d    n1 s0    Y  d S || |}|| |}t || d S r+   )r/   r0   r    npr   r1   r   numpy_dtyper
   r*   r   r3   r4   r5   )	r   r6   r7   r8   Znumpy_arrayZpd_arrayr:   r;   r<   r   r   r   test_numpy_array_equivalencec   s    


((

rC   c                 C  s   | \} }t |}t| | td| i}t| |rd}tjt|d ||| W d    n1 sf0    Y  tjt|d || | W d    n1 s0    Y  d S |||}td|| |i}t 	|| d S )NAr,   r-   )
r/   r0   r    r
   	DataFramer*   r   r3   r4   Zassert_frame_equal)r   r6   r7   r8   Zdfr:   r;   r<   r   r   r   
test_frame|   s    


((
rF   c           
   	   C  s   | \} }t |}t| | t| }|tj|gt|  | jj	dtj|gt|  | jdtj|gt|  | jdg}|D ]r}t
| |rd}tjt|d ||| W d    q1 s0    Y  qz|||}t|| |}	t ||	 qzd S r+   )r/   r0   r    r
   SeriesrA   r   r1   r   rB   r*   r   r3   r4   assert_series_equal)
r   r6   r7   r8   serZothersotherr:   r;   r<   r   r   r   test_series   s"    



*
rK   c                 C  s   | \} }|}t | |}|td| i}|tu s4J d}tjt|d. |tt	| 
dt	|  W d    n1 sz0    Y  d S )NrD   z(can only perform ops with 1-d structuresr-   )getattrr
   rE   NotImplementedr   r3   r4   rA   Zaranger1   Zreshape)r   r6   r"   r8   opar;   r:   r   r   r   test_error_invalid_object   s    
rP   c              	   C  s   | \} }t |}|gt| d  }t}dddg}| jjdkrZ|ddv rZt}d}nt	| |rld	}t
}|t|fD ]~}tj||d
 || | W d    n1 s0    Y  t| }tj||d
 ||| W d    qz1 s0    Y  qzd S )Nr   |zBoperands could not be broadcast together with shapes \(3,\) \(4,\)zBoperands could not be broadcast together with shapes \(4,\) \(3,\)r!   r"   )r   Zrsubznumpy boolean subtract, the `\-` operator, is not supported, use the bitwise_xor, the `\^` operator, or the logical_xor function insteadr,   r-   )r/   r0   r1   
ValueErrorjoinr   r'   r(   	TypeErrorr*   r4   rA   r   r   r3   r
   rG   )r   r6   r7   r8   rJ   errr:   sr   r   r   test_error_len_mismatch   s,    

(
rW   r8   )__neg____abs__
__invert__c                 C  s  | \} }t | }|dkr| jjdkrd}tjt|d t||  W d    n1 sZ0    Y  tjt|d t| |  W d    n1 s0    Y  tjt|d t| j|  W d    n1 s0    Y  d S t|| }|j	dd}d |d< t
|| d S )NrZ   fz0ufunc 'invert' not supported for the input typesr-   T)deepr   )r
   rG   r   r'   r   r3   rT   rM   _datar>   r/   rH   )r   r8   r"   rI   r:   r;   r<   r   r   r   %test_unary_op_does_not_propagate_mask   s    
**,r^   )"
__future__r   typingr   numpyrA   r   Zpandasr
   Zpandas._testingZ_testingr/   ZALL_INT_EA_DTYPESZarraysr1   r   __annotations__ZFLOAT_EA_DTYPESr   Zfixturezipr   r    r*   r=   r@   rC   rF   rK   rP   rW   markZparametrizer^   r   r   r   r   <module>   s0   

	$