
    m*i*                        S SK Jr  S SKJr  S SKrS SKrS SKJr  S SK	r
S SKJr  S SKJr   " S S5      r " S S	\5      r " S
 S\5      r " S S\5      rg)    )annotations)finalN)is_string_dtype)opsc                      \ rS rSr% \rS\S'   \rS\S'   \rS\S'   \r	S\S'       SS jr
SS jrSS	 jr\SS
 j5       r\S 5       r\\4   SS jj5       r\SS j5       rSrg)BaseOpsUtil   type[Exception] | Noneseries_scalar_excframe_scalar_excseries_array_exc
divmod_excc                8   US;   a  U R                   nU$ [        U[        R                  5      (       a-  [        U[        R                  5      (       a  U R                  nU$ [        U[        R                  5      (       a  U R
                  nU$ U R                  nU$ )N)
__divmod____rdivmod__)r   
isinstancepdSeriesr   r   r   )selfop_nameobjotherresults        _/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/pandas/tests/extension/base/ops.py_get_expected_exception#BaseOpsUtil._get_expected_exception   s     33__F  RYY''Jubii,H,H**F  RYY''++F  **F    c                    U$ N )r   r   r   r   pointwise_results        r   _cast_pointwise_result"BaseOpsUtil._cast_pointwise_result(   s
      r   c                .    [         R                  " U5      $ r   )tmget_op_from_name)r   r   s     r   r&   BaseOpsUtil.get_op_from_name1   s    ""7++r   c                p    U R                  X!U5      nU R                  U5      nU R                  XX2U5        g r   )r   r&   	_check_op)r   serr   r   excops         r   check_opnameBaseOpsUtil.check_opname:   s4    **7?""7+s4r   c                   [        U[        R                  5      (       aQ  [        UR                  5      S:w  a  [
        eUR                  S S 2S4   R                  X#5      R                  5       nU$ UR                  X#5      nU$ )N   r   )	r   r   	DataFramelencolumnsNotImplementedErroriloccombineto_frame)r   r   r   r,   expecteds        r   _combineBaseOpsUtil._combineB   sk    c2<<((3;;1$))xx1~--e8AACH  {{5-Hr   c                8   Uc_  U" X5      nU R                  XU5      nU R                  XAX75      n[        U[        U5      5      (       d   e[        R
                  " Xg5        g [        R                  " U5         U" X5        S S S 5        g ! , (       d  f       g = fr   )r9   r"   r   typer%   assert_equalpytestraises)r   r*   r,   r   r   r+   r   r8   s           r   r)   BaseOpsUtil._check_opM   sv     ;^F}}S4H227QHfd3i0000OOF-s#3 $##s   9	B
Bc                z   U[         L a  U R                  SX5      nOU R                  SX5      nUcO  U" X5      u  pVU[         L a  X-  X-  pOX1-  X1-  p[        R                  " XW5        [        R                  " Xh5        g [        R
                  " U5         [        X5        S S S 5        g ! , (       d  f       g = f)Nr   r   )divmodr   r%   assert_series_equalr>   r?   )	r   r*   r,   r   r+   
result_div
result_modexpected_divexpected_mods	            r   _check_divmod_opBaseOpsUtil._check_divmod_op_   s     <..|SHC..}cIC;%'^"JV|-0\3;l-2\5;l"":<"":<s#s" $##s   B,,
B:r    N)r   strreturnz4type[Exception] | tuple[type[Exception], ...] | None)r   rJ   )r*   	pd.Seriesr   rJ   r*   rL   )__name__
__module____qualname____firstlineno__	TypeErrorr   __annotations__r   r   r   r   r"   r&   r   r-   r9   r4   r)   rH   __static_attributes__r    r   r   r   r      s    09-9/8,8/8,8)2J&2	=& , 5 5   ;N25 " # #r   r   c                     \ rS rSr% Sr\rS\S'   \rS\S'   \r	S\S'   \r
S\S'   S rS	 rS
 rS rS rS r\R$                  R'                  S\R*                  \R,                  \R.                  /5      \R$                  R'                  S\R2                  \R4                  -    V Vs/ s H  nUR7                  S5      (       a  M  UPM     snn 5      S 5       5       rSrgs  snn f )BaseArithmeticOpsTestss   a  
Various Series and DataFrame arithmetic ops methods.

Subclasses supporting various ops should set the class variables
to indicate that they support ops of that kind

* series_scalar_exc = TypeError
* frame_scalar_exc = TypeError
* series_array_exc = TypeError
* divmod_exc = TypeError
r
   r   r   r   r   c                    US:X  a0  [        UR                  5      (       a  [        R                  " S5        Un[        R
                  " U5      nU R                  XCUR                  S   5        g )N__rmod__%Skip testing Python string formattingr   )r   dtyper>   skipr   r   r-   r5   r   dataall_arithmetic_operatorsr   r*   s        r   test_arith_series_with_scalar4BaseArithmeticOpsTests.test_arith_series_with_scalar   sO    #z1odjj6Q6QKK?@*iio#4r   c                    US:X  a0  [        UR                  5      (       a  [        R                  " S5        Un[        R
                  " SU05      nU R                  XCUS   5        g )NrY   rZ   Ar   )r   r[   r>   r\   r   r1   r-   )r   r^   r_   r   dfs        r   test_arith_frame_with_scalar3BaseArithmeticOpsTests.test_arith_frame_with_scalar   sP    #z1odjj6Q6QKK?@*\\3+&"tAw/r   c           
         Un[         R                  " U5      nU R                  XC[         R                  " UR                  S   /[	        U5      -  5      5        g Nr   )r   r   r-   r5   r2   r]   s        r   test_arith_series_with_array3BaseArithmeticOpsTests.test_arith_series_with_array   s@    *iio#		388A;-#c(2J(KLr   c                    [         R                  " U5      nU R                  U[        S5        U R                  S[        R
                  U5        g )Nr0   r   r   rH   rB   r   rdivmod)r   r^   r*   s      r   test_divmod"BaseArithmeticOpsTests.test_divmod   s7    iioc61-ac2r   c                   [         R                  " U5      nU R                  U[        U5        UnU R                  U[        R
                  U5        [         R                  " U5      nU R                  U[        R
                  U5        g r   rl   )r   r^   data_for_twosr*   r   s        r   test_divmod_series_array/BaseArithmeticOpsTests.test_divmod_series_array   s`    iioc640eS[[#6		% eS[[#6r   c                (   [         R                  " U5      nU R                  SX!5      nUb$  [        R                  " U5         X!-     S S S 5        g X!-   n[         R                  " X-   5      n[
        R                  " XE5        g ! , (       d  f       g = f)N__add__)r   r   r   r>   r?   r%   rC   )r   r^   r*   r+   r   r8   s         r   $test_add_series_with_extension_array;BaseArithmeticOpsTests.test_add_series_with_extension_array   sr    
 iio**9c@?s#
 $99T[)
v0 $#s   B
Bboxr   __rc                n    U" U5      n[        X5      (       a  [        X5      " U5      nU[        L d   eg g r   )hasattrgetattrNotImplemented)r   r^   rx   r   r   r   s         r   6test_direct_arith_with_ndframe_returns_not_implementedMBaseArithmeticOpsTests.test_direct_arith_with_ndframe_returns_not_implemented   s:     D	4!!T+E2F^+++ "r   r    N)rN   rO   rP   rQ   __doc__rR   r   rS   r   r   r   r`   re   ri   rn   rr   rv   r>   markparametrizer   r   r1   Indexr%   arithmetic_dunder_methodscomparison_dunder_methods
startswithr~   rT   ).0xs   00r   rV   rV   s   s    
 1:-9/8,8/8,8)2J&250M3
71" [[URYYbhh$GH[[ 11B4P4PP	
P<<& P	
	, I	,	
s   &CCrV   c                  .    \ rS rSrSrSS jrS rS rSrg)	BaseComparisonOpsTests   z4Various Series and DataFrame comparison ops methods.c                ,   UR                   S;   aM  U" X5      nUR                  XC5      nU R                  UR                   XU5      n[        R                  " XV5        g S n U" X5      nUcF  UR                  XC5      nU R                  UR                   XU5      n[        R                  " WU5        g [        R                  " [        U5      5         UR                  XC5        S S S 5        g ! [
         a  nUn S nANS nAff = f! , (       d  f       g = f)N)eqne)	rN   r6   r"   r%   rC   	Exceptionr>   r?   r<   )	r   r*   r^   r,   r   r   r8   r+   errs	            r   _compare_other%BaseComparisonOpsTests._compare_other   s    ;;,&^F{{5-H222;;HUH""64 CC {;;u166KKX &&vx8]]49-KK* .-   .-s$   !C, D,
D6C==D
Dc                V    [         R                  " U5      nU R                  X1US5        g rh   )r   r   r   )r   r^   comparison_opr*   s       r   test_compare_scalar*BaseComparisonOpsTests.test_compare_scalar   s!    iioC}a8r   c                    [         R                  " U5      n[         R                  " US   /[        U5      -  UR                  S9nU R	                  X1X$5        g )Nr   )r[   )r   r   r2   r[   r   )r   r^   r   r*   r   s        r   test_compare_array)BaseComparisonOpsTests.test_compare_array   sB    iio		47)c$i/tzzBC}<r   r    NrM   )	rN   rO   rP   rQ   r   r   r   r   rT   r    r   r   r   r      s    >+49=r   r   c                      \ rS rSrS r\R                  R                  S\R                  \R                  \R                  /5      S 5       rSrg)BaseUnaryOpsTests   c                   [         R                  " USS9n US S  Vs/ s H  o3) PM       nU) n[         R                  " U) SS9n[        R                  " XE5        g s  snf ! [         as    [
        R                  " [        5         U)   S S S 5        O! , (       d  f       O= f[
        R                  " [        5         U)   S S S 5         g ! , (       d  f        g = ff = f)Nname)r   
   )r   r   r%   rC   rR   r>   r?   )r   r^   r*   r   r   r8   s         r   test_invertBaseUnaryOpsTests.test_invert   s    ii6*	5 cr#AR# TFyy$V4H""64 $ 	 y) *))y) *)))	sQ   A! AA! A! !$CB		C
B 	!C=CC
C	CCufuncc                   [         R                  S[         R                  S[         R                  S0U   nS n [	        X5      " 5       nU" U5      n[
        R                  " XV5        g ! [         aW  nUn[        R                  " [        U5      [        45         U" U5        S S S 5         S nAg ! , (       d  f        S nAg = fS nAff = f)N__pos____neg____abs__)nppositivenegativeabsr|   r%   assert_extension_array_equalr   r>   r?   r<   rR   )r   r^   r   attrr+   r   altr   s           r   #test_unary_ufunc_dunder_equivalence5BaseUnaryOpsTests.test_unary_ufunc_dunder_equivalence  s     YY	R
 
	9T(*F +C++F8  	C S	956d 7666		s5   A( (
C	2'C	B/"C/
C	9CCC	r    N)rN   rO   rP   rQ   r   r>   r   r   r   r   r   r   r   rT   r    r   r   r   r      s@    5( [[Wr{{BKK&HI9 J9r   r   )
__future__r   typingr   numpyr   r>   pandas.core.dtypes.commonr   pandasr   pandas._testing_testingr%   pandas.corer   r   rV   r   r   r    r   r   <module>r      sR    "    5   a# a#H\,[ \,~$=[ $=N(9 (9r   