
    Owgg0              	          d dl Z d dlZd dlZd dlZd dlmZ d dl	m
Z
 d dlmZ ej                  j                  ddg dfdg dfgddg	      d
        Zd Zd Zej                  j                  dg d      d        Zd Zd Zd Zd Zd Zd Zej                  j                  dd dg      d        Zd Zd Zej                  j                  dd ej8                  d      g      d        Zd Zej                  j                  ddg      d         Zej                  j                  d!g d"g d#g d"fg d$g d%g d$fg d&g d'g d(fg      d)        Z d* Z!d+ Z"y),    N)ops)FloatingArrayzopname, expadd)      NN	   mul)r      NN   )idsc                 X   t        j                  g d|       }t        j                  g d|       }t        j                  ||       }t        t        |      } |||      }t	        j
                  ||       t        t        d|z         } |||      }t	        j
                  ||       y )Nr   r   Nr      dtyper   r
   r   N   r)pdarraygetattroperatortmassert_extension_array_equalr   )r   opnameexpabexpectedopresults           b/var/www/horilla/myenv/lib/python3.12/site-packages/pandas/tests/arrays/integer/test_arithmetic.pytest_add_mulr#      s     	#51A
#51A xx5)H	6	"B1XF##FH5	cFl	#B1XF##FH5    c                     t        j                  g d|       }t        j                  g d|       }||z
  }t        j                  g d|       }t        j                  ||       y )Nr   r   r   )r   r   NNr   r   r   r   r   r   r   r   r!   r   s        r"   test_subr(   $   N    
#51A
#51AUFxx-U;H##FH5r$   c                     t        j                  g d|       }t        j                  g d|       }||z  }t        j                  t        j                  dd d dgd      }t	        j
                  ||       y )Nr   r   r   r
   g      ?Float64)r   r   npinfr   r   r'   s        r"   test_divr.   -   s\    
#51A
#51AUFxxD$5YGH##FH5r$   zzero, negative))r   F)g        F)g       Tc                 D   t        j                  g dd      }|| z  }t        t        j                  t        j                  t        j
                  t        j
                   dgd      t        j                  g d            }|r|dz  }t        j                  ||       y )N)r   r   NInt64r   r   float64)FFFTr0   )r   r   r   r,   nanr-   r   r   )zeronegativer   r!   r   s        r"   test_divide_by_zeror6   6   sx     	!1AXF
"&&"&&266'1-Y?
,-H B##FH5r$   c                     t        j                  g d|       }t        j                  g d|       }||z  }t        j                  g d|       }t        j                  ||       y )Nr   r   r   )r   r
   NNr   r&   r'   s        r"   test_floordivr8   D   sN    
#51A
#51A!VFxx-U;H##FH5r$   c                 x   t        j                  ddg|       }d|z  }t        j                  t        j                  dgd      }t	        j
                  ||       |j                  |j                  j                        }d|z  }|j                  t        j                        }t	        j
                  ||       y )Nr   r   r         ?r+   )
r   Seriesr,   r-   r   assert_series_equalastyper   numpy_dtyper2   )any_int_ea_dtypeserr!   r   ser_non_nullables        r"   !test_floordiv_by_int_zero_no_maskrB   N   s     ))QF"2
3C#XFyy"&&#i8H68,zz#))"7"78""Frzz*H68,r$   c                     t        j                  g d|       }t        j                  g d|       }||z  }t        j                  g d|       }t        j                  ||       y )Nr   r   r   )r   r   NNr   r&   r'   s        r"   test_modrD   ]   r)   r$   c            	      :   t        j                  g dd      } | dz  }t        j                  g dd      }t        j                  ||       | dz  }t        j                  g dd      }t        j                  ||       | t         j                  z  }t        j                  g dd      }t        j                  ||       | t
        j                  z  }t        t        j                  t
        j                  t
        j                  dt
        j                  t
        j                  gd      t        j                  g d	            }t        j                  ||       | dd  } d| z  }t        j                  g d
d      }t        j                  ||       d| z  }t        j                  g dd      }t        j                  ||       t         j                  | z  }t        j                  g dd      }t        j                  ||       t
        j                  | z  }t        t        j                  dt
        j                  t
        j                  t
        j                  gd      t        j                  g d            }t        j                  ||       y )N)r0   r   r   Nr
   r1   r   r   )r   r   r   r   r   r   )NNr   NNr2   )FFFTF)r   r   Nr   )r   r   r   r   )r   NNN)FFTF)r   r   r   r   NAr,   r3   r   )r   r!   r   s      r"   test_pow_scalarrG   f   s   
$G4ATFxxw7H##FH5TFxx+7;H##FH5XFxx37CH##FH5YF
"&&"&&!RVVRVV4IF
34H ##FH5 	
!"ATFxxw7H##FH5TFxxG4H##FH5UUAXFxx-W=H##FH5VVQYF
!RVVRVVRVV,I>
,-H ##FH5r$   c                      t        j                  g d      } t        j                  g d      }| |z  }t        j                  g d      }t        j                  ||       y )N)	r   r   r   r   r   r   NNN)	r   r   Nr   r   Nr   r   N)	r   r   Nr   r   r   r   NNr&   )r   r   r!   r   s       r"   test_pow_arrayrI      sH    
56A
56ATFxx<=H##FH5r$   c                     t        j                  t        j                  t        j                  gd      } t        j                  ddg      | z  }t        j                  dt        j                  gd      }t	        j
                  ||       y )Nr1   r   r:   g       @r+   )r   r   r,   r3   r   r   )arrr!   r   s      r"   test_rpow_one_to_narL      s`     ((BFFBFF#7
3CXXsCj!S(FxxbffY7H##FH5r$   otherg      ?c                     t        j                  g d      }|t        j                  |       z   }|| z   }t        j                  ||       y )N)r   Nr
   )r   r   r,   r   assert_equal)rM   rK   r!   r   s       r"   test_numpy_zero_dim_ndarrayrP      s9    
((<
 C288E?"FU{HOOFH%r$   c                 V   |}t        j                  |       }t        ||      }|r&dd l}t        |j
                  j                  t        f}nt        }dj                  g d      }t        j                  ||      5   |d       d d d        t        j                  ||      5   |t        j                  d             d d d        t        j                  d|j                        }	|dv rr|sp ||	      }
t        j                  | D cg c]  }d|z  	 c}|j                        }|j                  t        j                        }t!        j"                  |
|       n(t        j                  ||      5   ||	       d d d        dj                  g d	      }t        j                  ||      5   |t        j                  t        j$                  dt'        |      
                   d d d        y # 1 sw Y   qxY w# 1 sw Y   CxY wc c}w # 1 sw Y   xY w# 1 sw Y   y xY w)Nr   |)(can only perform ops with numeric valuesz-IntegerArray cannot perform the operation modunsupported operand type/can only concatenate str \(not \"int\"\) to str)not all arguments converted during stringzFufunc '.*' not supported for the input types, and the inputs could notz?ufunc '.*' did not contain a loop with signature matching typeszBAddition/subtraction of integers and integer-arrays with Timestamphas no kernelnot implementedzDThe 'out' kwarg is necessary. Use numpy.strings.multiply without it.matchfoo20180101index)__mul____rmul__)	rS   z5cannot perform .* with this index type: DatetimeArrayz`Addition/subtraction of integers and integer-arrays with DatetimeArray is no longer supported. *rT   rU   rV   z*cannot subtract DatetimeArray from ndarrayrW   rX   )periods)r   r;   r   pyarrow	TypeErrorlibArrowNotImplementedErrorNotImplementedErrorjoinpytestraises	Timestampr^   fillnar,   r3   r   r<   
date_rangelen)dataall_arithmetic_operatorsusing_infer_stringr    sr   paerrsmsgstr_serresxr   s                r"   test_error_invalid_valuesrx      s   	!B
		$A
!R.C266::<OP ((	
C 
t3	' E
	t3	' &BLL$%& iiQWW-G 	!
	

 #'l996Aeai6aggF??266* 	sH-]]4s+ 	L	 ((	
C 
t3	' BBIIbmmJA?@AB BS & & 7	 	"B Bs6   <	G4$H
H6	H1:H4G>HHH(c                 ~   t        j                  |      }t        j                  |       }d} |||      } ||j	                  t
              |      }|j	                  d      }|dk(  r@|dk(  j                  d      j                  t              }d|j                  j                  |<   t        j                  ||       y )Ng{Gz?r+   __rmod__r   F)r   get_op_from_namer   r;   r=   floatrk   to_numpyboolr   _maskr<   )rn   ro   r    rq   rM   r!   r   masks           r"   test_arith_coerce_scalarr      s    			5	6B
		$AE5\F!((5/5)Hy)H  :-Qu%..t4%*T"68,r$   r:   c                     t        j                  |       }t        j                  g dd      } |||      }|j                  dk(  sJ y )Nr   r
   r   r1   r   r+   )r   r{   r   r;   r   )ro   rM   r    rq   r!   s        r"   test_arithmetic_conversionr     sB     
		5	6B
		)7+A5\F<<9$$$r$   c                     t        j                  t        j                  ddt        j                  gd      t        j                  dt        j                  dgd      g dd      } | j
                  | j                  z   }t        j                  dd	t        j                  gd      }t        j                  ||       | j
                  | j                  z   dz  d
k(  }t        j                  g dd      }t        j                  ||       | j
                  | j                  z   }t        j                  dt        j                  t        j                  gd      }t        j                  ||       y )Nr   r
   r1   r   r   UInt8r   ABCr      )FTNboolean)
r   	DataFramer;   r,   r3   r   r   r   r<   r   )dfr!   r   s      r"   test_cross_type_arithmeticr     s   	Aq"&&>9Arvvq>9	

B TTBDD[Fyy!Qw7H68,ddRTTkQ"$Fyy,I>H68,TTBDD[Fyy!RVVRVV,G<H68,r$   r    meanc                    t        j                  g dg dt        j                  g dd      d      } t        |j                  |              }t        |t              sJ  t        |j                  d      |              }t        j                  t        j                  ddg      t        j                  d	d
gd      dt        j                  ddgd            }t        j                  ||       y )N)r   r   r   )r   Nr   r1   r   r   r   r:   g      @r   r   r+   )r   r   r   r   )namer]   )r   r   r   r   r   
isinstancer|   groupbyr,   Indexr   assert_frame_equal)r    r   r!   r   s       r"   test_reduce_to_floatr   1  s     
 ,g6	

B WRTT2 Ffe$$$ *WRZZ_b)+F||hhSz"1a&	)JKhhSz,H &(+r$   zsource, neg_target, abs_targetr   )r0   )r   r
   N)r0   r   N)r0   r   r   )r   r   r0   )r   r   r   c                 h   | }t        j                  ||      }| |t        |      }}}t        j                  ||      }t        j                  ||      }t        j                  ||       t        j                  ||       t        j
                  ||      rJ t        j                  ||       y )Nr   )r   r   absr   r   shares_memory)	any_signed_int_ea_dtypesource
neg_target
abs_targetr   rK   
neg_result
pos_result
abs_results	            r"   test_unary_int_operatorsr   K  s     $E
((6
'C*-tSXJ
J*E2J*E2J##J
;##J4
C000##J
;r$   c                      t         j                  t        j                  t        j                  d            z  } t        j                  t         j                  gdz        }t        j                  | |       y )Ni'  )r   rF   r;   r,   zerosr   r<   )r!   r   s     r"   *test_values_multiplying_large_series_by_NAr   `  sK     UURYYrxx//Fyy"%%5)H68,r$   c                     t        j                  g d|       }t        j                  g d|       }||z  }t        j                  g d|       }t        j                  ||       ||z  }t        j                  g d|       }t        j                  ||       ||z  }t        j                  g d|       }t        j                  ||       |j	                  d      }t        j                  t        d	      5  ||z   d d d        t        j                  t        d	      5  ||z   d d d        t        j                  t        d	      5  ||z   d d d        y # 1 sw Y   \xY w# 1 sw Y   ?xY w# 1 sw Y   y xY w)
N)r   Nr   r   r   )Nr   r   r   )NN   r   )NNr   r   )NN   r   r+   rT   rY   )r   r   r   r   r=   rh   ri   rc   )r   leftrightr!   r   floatss         r"   test_bitwiser   i  s6   88O51DHH_E2EE\Fxx2%@H##FH5E\Fxx2%@H##FH5E\Fxx2%@H##FH5 \\)$F	y(B	C v	y(B	C v	y(B	C v 	   s$   ;E$E(E4E%(E14E=)#r   numpyr,   rh   pandasr   pandas._testing_testingr   pandas.corer   pandas.core.arraysr   markparametrizer#   r(   r.   r6   r8   rB   rD   rG   rI   rL   rP   rx   r   r   r   r   r   r   r   r    r$   r"   <module>r      s         , "#e-C%DE	  
6
6 66 )+ST
6 U
66-6)6X66 1c(+& ,&FB`-" 3"67% 8%-, x(, ),2 $	L),	~|4	Z+
<
<-r$   