
    Owg                       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 ej                  D  cg c]  }  ej                  g d|        c} Zdg ee      z  Zded<   eej$                  D  cg c]  }  ej                  g d	|        c} z  Zed
d
gz  Ze ej                  g dd      gz  Zedgz  Z ej&                   eee      eD cg c]  }|j*                  j,                   c}      d        Zd Zd Zd Zd Zd Zd Zd Zd Zd Z ejB                  jE                  dg d      d        Z#yc c} w c c} w c c}w )    )annotations)AnyN)         Ndtyper   z	list[Any]scalars)g?皙?g333333?Nr   )TFTNbooleanF)paramsidsc                    | 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)requests    a/var/www/horilla/myenv/lib/python3.12/site-packages/pandas/tests/arrays/masked/test_arithmetic.pydatar      s     ==    c                    t        | j                  t        j                        rd|v rt	        j
                  d       y y y )Nsubz$subtract not implemented for boolean)
isinstancer	   pdBooleanDtypepytestskipr   op_names     r   
check_skipr       s1    $**boo.5G3C:; 4D.r   c                |    | j                   j                  dk(  xr" |j                  d      j                  d      dv S )Nb_r)powtruedivfloordiv)r	   kindstriplstripr   s     r   is_bool_not_implementedr)   %   s=    ::??c! gmmC&8&?&?&D I ' r   c                B   | \  } }t        j                  |      }t        | |       t        j                  |gt        |       z  | j                        }|| j                  j                  |      fD ]  }t        | |      r]d}t        j                  t        |      5   || |       d d d        t        j                  t        |      5   || |       d d d        l || |      } || |      }t        j                  ||        y # 1 sw Y   bxY w# 1 sw Y   xY wNr   -operator '.*' not implemented for bool dtypesmatch)tmget_op_from_namer   r   arraylenr	   typer)   r   raisesNotImplementedErrorassert_extension_array_equal)r   all_arithmetic_operatorsscalaropscalar_arraymsgresultexpecteds           r   "test_array_scalar_like_equivalencer>   2   s   LD&			5	6Bt-.88VHs4y0

CL 4::??623 
>"4)ABAC2#> !4 !2#> '4&' ' f%F$-H++FH=
>! !' 's   
D	
D	D	D	c                   | \  } }t        j                  |      }t        | |       t        j                  }t        j
                  t        j                  gt        |       z  | j                        }| j                  j                         }t        | |      rPd}t        j                  t        |      5   || |       d d d        t        j                  || j                         y  || |      }t        j                  || j                          || |      }	t        j                  || j                         t        j                  ||	       y # 1 sw Y   xY wr+   )r/   r0   r   r   NAr1   r2   r	   _maskcopyr)   r   r4   r5   assert_numpy_array_equalr6   )
r   r7   r!   r9   r8   r:   maskr;   r<   r=   s
             r   test_array_NArE   G   s
   GD!			5	6Bt-.UUF88RUUGc$i/tzzBL::??Dt%=>=]].c: 	tV	 	##D$**5fFdjj1$%Hdjj1##FH5	 	s   6
EEc                T   | \  } }t        j                  |      }t        | |       t        j                  |gt        |       z  | j                  j                        }t        j                  || j                        }t        | |      r]d}t        j                  t        |      5   || |       d d d        t        j                  t        |      5   || |       d d d        y  || |      } || |      }t        j                  ||       y # 1 sw Y   `xY w# 1 sw Y   y xY wr+   )r/   r0   r   npr1   r2   r	   numpy_dtyper   r)   r   r4   r5   r6   )	r   r7   r8   r9   numpy_arraypd_arrayr;   r<   r=   s	            r   test_numpy_array_equivalencerK   c   s    LD&			5	6Bt-.((F8c$i/tzz7M7MNKxx4::6Ht%=>=]].c: 	"t[!	"]].c: 	tX	k"F$!H##FH5	" 	"	s   )
D
DDD'c                   | \  } }t        j                  |      }t        | |       t        j                  d| i      }t        | |      r]d}t        j                  t        |      5   |||       d d d        t        j                  t        |      5   || |       d d d        y  |||      }t        j                  d || |      i      }t        j                  ||       y # 1 sw Y   uxY w# 1 sw Y   y xY w)NAr,   r-   )
r/   r0   r   r   	DataFramer)   r   r4   r5   assert_frame_equal)r   r7   r8   r9   dfr;   r<   r=   s           r   
test_framerQ   |   s    LD&			5	6Bt-. 
sDk	"Bt%=>=]].c: 	r6N	]].c: 	tV	F^F||S"T6"234H&(+	 		s   '
C%
C1%C.1C:c           	        | \  } }t        j                  |      }t        | |       t        j                  |       }|t        j                  |gt        |       z  | j                  j                        t        j                  |gt        |       z  | j                        t        j                  |gt        |       z  | j                        g}|D ]y  }t        | |      r0d}t        j                  t        |      5   |||       d d d        ? |||      }t        j                   || |            }	t        j                  ||	       { y # 1 sw Y   xY wr+   )r/   r0   r   r   SeriesrG   r1   r2   r	   rH   r)   r   r4   r5   assert_series_equal)
r   r7   r8   r9   serothersotherr;   r<   r=   s
             r   test_seriesrX      s!   LD&			5	6Bt-.
))D/C 	
&CI%TZZ-C-CD
&CI%TZZ8
		6(SY&djj9	F  	5"4)ABAC2#> 3  U^FyyD%1H""684	5 s   >
EE	c           	     V   | \  } }|}t        | |      } |t        j                  d| i            }|t        u sJ d}t	        j
                  t        |      5   |t        j                  t        |             j                  dt        |                    d d d        y # 1 sw Y   y xY w)NrM   z(can only perform ops with 1-d structuresr-   )getattrr   rN   NotImplementedr   r4   r5   rG   aranger2   reshape)r   r7   r!   r9   opar<   r;   s          r   test_error_invalid_objectr`      s    GD!	!B
$
C sDk*+F^###
5C	*#	6 9BIIc$i ((SY789 9 9s   >BB(c                V   | \  } }t        j                  |      }|gt        |       dz
  z  }t        }dj	                  ddg      }| j
                  j                  dk(  r|j                  d      dv r	t        }d}nt        | |      rd	}t        }|t        j                  |      fD ]i  }t        j                  ||
      5   || |       d d d        t        j                   |       }t        j                  ||
      5   |||       d d d        k y # 1 sw Y   JxY w# 1 sw Y   xY w)Nr   |zBoperands could not be broadcast together with shapes \(3,\) \(4,\)zBoperands could not be broadcast together with shapes \(4,\) \(3,\)r    r!   )r   rsubznumpy boolean subtract, the `\-` operator, is not supported, use the bitwise_xor, the `\^` operator, or the logical_xor function insteadr,   r-   )r/   r0   r2   
ValueErrorjoinr	   r&   r'   	TypeErrorr)   r5   rG   r1   r   r4   r   rS   )r   r7   r8   r9   rW   errr;   ss           r   test_error_len_mismatchri      s*   LD&			5	6BHD	A&E
C
((QQ	
C zz#":"@"@"E J # W 	 
!'?	@=!%) ]]3c* 	tUO	 IIdO]]3c* 	q%L	 		 		 	s    
D>
DD	D(	r9   )__neg____abs__
__invert__c                   | \  } }t        j                  |       }|dk(  r| j                  j                  dk(  rd}t	        j
                  t        |      5   t        ||              d d d        t	        j
                  t        |      5   t        | |              d d d        t	        j
                  t        |      5   t        | j                  |              d d d        y  t        ||             }|j                  d      }d |d<   t        j                  ||       y # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   y xY w)Nrl   fz0ufunc 'invert' not supported for the input typesr-   T)deepr   )r   rS   r	   r&   r   r4   rf   r[   _datarB   r/   rT   )r   r9   r!   rU   r;   r<   r=   s          r   %test_unary_op_does_not_propagate_maskrq      s    GD!
))D/C	\djjoo4@]]9C0 	GC	]]9C0 	 GD"	 ]]9C0 	&#GDJJ#%	& 	WS"F{{{%HCF68,	 		  	 	& 	s$   D$D0 D<$D-0D9<E)$
__future__r   typingr   numpyrG   r   pandasr   pandas._testing_testingr/   ALL_INT_EA_DTYPESr1   arraysr2   r
   __annotations__FLOAT_EA_DTYPESfixturezipr	   namer   r   r)   r>   rE   rK   rQ   rX   r`   ri   markparametrizerq   )r	   as   00r   <module>r      sT   "      ?A>R>R	SU("((?%
0	SS3v;& & REWEW
XE8288)7
X X C:  8288-Y?
@ @ E7  s67+1O1!'',,1OP Q<
>*6862,*5<9!H CD- E-o 
T Y 2Ps   D:.D?E
