o
    թZh                     @  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     g | ]}t jg d |dqS ))         Ndtypepdarray.0r	    r   a/var/www/html/lang_env/lib/python3.10/site-packages/pandas/tests/arrays/masked/test_arithmetic.py
<listcomp>       r   r   z	list[Any]scalarsc                 C  r   ))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      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|v rtd d S d S 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 ]R}t| |red}t	j
t|d || | W d    n1 sCw   Y  t	j
t|d || | W d    n1 s_w   Y  q#|| |}|| |}t || q#d 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
| |rPd}tjt|d || | W d    n1 sBw   Y  t || j d S || |}t || j || |}	t || j t ||	 d S r,   )r0   r1   r!   r   ZNAr   r2   r	   Z_maskcopyr+   r   r4   r5   Zassert_numpy_array_equalr6   )
r   r7   r#   r9   r8   r:   maskr;   r<   r=   r   r   r   test_array_NAG   s$   





rA   c           	      C  s   | \} }t |}t| | tj|gt|  | jjd}tj|| jd}t	| |rfd}t
jt|d || | W d    n1 sBw   Y  t
jt|d || | W d    d S 1 s_w   Y  d S || |}|| |}t || d S r,   )r0   r1   r!   npr   r2   r	   numpy_dtyper   r+   r   r4   r5   r6   )	r   r7   r8   r9   Znumpy_arrayZpd_arrayr;   r<   r=   r   r   r   test_numpy_array_equivalencec   s&   





rD   c                 C  s   | \} }t |}t| | td| i}t| |rWd}tjt|d ||| W d    n1 s3w   Y  tjt|d || | W d    d S 1 sPw   Y  d S |||}td|| |i}t 	|| d S )NAr-   r.   )
r0   r1   r!   r   	DataFramer+   r   r4   r5   Zassert_frame_equal)r   r7   r8   r9   dfr;   r<   r=   r   r   r   
test_frame|   s$   




rH   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 ]9}t
| |rcd}tjt|d ||| W d    n1 s]w   Y  q=|||}t|| |}	t ||	 q=d S r,   )r0   r1   r!   r   SeriesrB   r   r2   r	   rC   r+   r   r4   r5   assert_series_equal)
r   r7   r8   r9   serothersotherr;   r<   r=   r   r   r   test_series   s(   




rN   c                 C  s   | \} }|}t | |}|td| i}|tu sJ d}tjt|d |tt	| 
dt	|  W d    d S 1 s>w   Y  d S )NrE   z(can only perform ops with 1-d structuresr.   )getattrr   rF   NotImplementedr   r4   r5   rB   Zaranger2   Zreshape)r   r7   r#   r9   opar<   r;   r   r   r   test_error_invalid_object   s   
 "rS   c              	   C  s   | \} }t |}|gt| d  }t}dddg}| jjdkr-|ddv r-t}d}n	t	| |r6d	}t
}|t|fD ]?}tj||d
 || | W d    n1 sVw   Y  t| }tj||d
 ||| W d    n1 sww   Y  q=d 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.   )r0   r1   r2   
ValueErrorjoinr	   r(   r)   	TypeErrorr+   r5   rB   r   r   r4   r   rI   )r   r7   r8   r9   rM   errr;   sr   r   r   test_error_len_mismatch   s4   


rZ   r9   )__neg____abs__
__invert__c                 C  s  | \} }t | }|dkrp| jjdkrpd}tjt|d t||  W d    n1 s-w   Y  tjt|d t| |  W d    n1 sJw   Y  tjt|d t| j|  W d    d S 1 siw   Y  d S t|| }|j	dd}d |d< t
|| d S )Nr]   fz0ufunc 'invert' not supported for the input typesr.   T)deepr   )r   rI   r	   r(   r   r4   rW   rP   _datar?   r0   rJ   )r   r9   r#   rK   r;   r<   r=   r   r   r   %test_unary_op_does_not_propagate_mask   s(   

ra   )"
__future__r   typingr   numpyrB   r   Zpandasr   Zpandas._testingZ_testingr0   ZALL_INT_EA_DTYPESZarraysr2   r   __annotations__ZFLOAT_EA_DTYPESr   Zfixturezipr   r!   r+   r>   rA   rD   rH   rN   rS   rZ   markZparametrizera   r   r   r   r   <module>   s2    

	$