U
    -e                     @  s8  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ddddg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%d&d'd(gd)d* Z!dS )+    )annotations)AnyNc                 C  s"   g | ]}t jd dddg|dqS )         Ndtypepdarray.0r    r   k/var/www/html/Darija-Ai-Train/env/lib/python3.8/site-packages/pandas/tests/arrays/masked/test_arithmetic.py
<listcomp>   s     r   r   z	list[Any]scalarsc                 C  s"   g | ]}t jd dddg|dqS )g?皙?g333333?Nr   r	   r   r   r   r   r      s     r   TFbooleanr   c                 C  s   g | ]}|j jqS r   )r   name)r   ar   r   r   r      s     )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|k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k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 5 Q R X t	j
t|d || | W 5 Q R X 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 5 Q R X t || j d S || |}t || j || |}	t || j t ||	 d S r*   )r.   r/   r   r
   ZNAr   r0   r   Z_maskcopyr)   r   r2   r3   Zassert_numpy_array_equalr4   )
r   r5   r!   r7   r6   r8   maskr9   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 5 Q R X t
jt|d || | W 5 Q R X d S || |}|| |}t || d S r*   )r.   r/   r   npr   r0   r   numpy_dtyper
   r)   r   r2   r3   r4   )	r   r5   r6   r7   Znumpy_arrayZpd_arrayr9   r:   r;   r   r   r   test_numpy_array_equivalencec   s    




rB   c              	   C  s   | \} }t |}t| | td| i}t| |rd}tjt|d ||| W 5 Q R X tjt|d || | W 5 Q R X d S |||}td|| |i}t 	|| d S )NAr+   r,   )
r.   r/   r   r
   	DataFramer)   r   r2   r3   Zassert_frame_equal)r   r5   r6   r7   Zdfr9   r:   r;   r   r   r   
test_frame|   s    



rE   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 ]^}t
| |rd}tjt|d ||| W 5 Q R X qz|||}t|| |}	t ||	 qzd S r*   )r.   r/   r   r
   Seriesr@   r   r0   r   rA   r)   r   r2   r3   assert_series_equal)
r   r5   r6   r7   serZothersotherr9   r:   r;   r   r   r   test_series   s"    




rJ   c              	   C  st   | \} }|}t | |}|td| i}|tks4td}tjt|d$ |t	t
| dt
|  W 5 Q R X d S )NrC   z(can only perform ops with 1-d structuresr,   )getattrr
   rD   NotImplementedAssertionErrorr   r2   r3   r@   Zaranger0   Zreshape)r   r5   r!   r7   opar:   r9   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krZt}d}nt	| |rld	}t
}|t|fD ]V}tj||d
 || | W 5 Q R X t| }tj||d
 ||| W 5 Q R X 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.   r/   r0   
ValueErrorjoinr   r&   r'   	TypeErrorr)   r3   r@   r   r   r2   r
   rF   )r   r5   r6   r7   rI   errr9   sr   r   r   test_error_len_mismatch   s,    


rW   r7   __neg____abs__
__invert__c              	   C  s   | \} }t | }|dkr| jjdkrd}tjt|d t||  W 5 Q R X tjt|d t| |  W 5 Q R X tjt|d t| j|  W 5 Q R X d S t|| }|j	dd}d |d< t
|| d S )NrZ   fz0ufunc 'invert' not supported for the input typesr,   T)deepr   )r
   rF   r   r&   r   r2   rT   rL   _datar=   r.   rG   )r   r7   r!   rH   r9   r:   r;   r   r   r   %test_unary_op_does_not_propagate_mask   s    
r^   )"
__future__r   typingr   numpyr@   r   Zpandasr
   Zpandas._testingZ_testingr.   ZALL_INT_EA_DTYPESZarraysr0   r   __annotations__ZFLOAT_EA_DTYPESr   Zfixturezipr   r   r)   r<   r?   rB   rE   rJ   rP   rW   markZparametrizer^   r   r   r   r   <module>   s2    

	$