
    .i"                       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d      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#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booleanFT)strict)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    h/var/www/app/trading-bot/venv/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valmsgresultexpecteds	            r   "test_array_scalar_like_equivalencer@   4   s   LD&			5	6Bt-.88VHs4y0

CL 

/0 
>"4)ABAC2#> 42#> '4&' ' c]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,   )r0   r1   r   r   NAr2   r3   r	   _maskcopyr*   r   r5   r6   assert_numpy_array_equalr7   )
r   r8   r"   r:   r9   r;   maskr=   r>   r?   s
             r   test_array_NArG   I   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,   )r0   r1   r   npr2   r3   r	   numpy_dtyper   r*   r   r5   r6   r7   )	r   r8   r9   r:   numpy_arraypd_arrayr=   r>   r?   s	            r   test_numpy_array_equivalencerM   e   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.   )
r0   r1   r   r   	DataFramer*   r   r5   r6   assert_frame_equal)r   r8   r9   r:   dfr=   r>   r?   s           r   
test_framerS   ~   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,   )r0   r1   r   r   SeriesrI   r2   r3   r	   rJ   r*   r   r5   r6   assert_series_equal)
r   r8   r9   r:   serothersotherr=   r>   r?   s
             r   test_seriesrZ      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)NrO   z(can only perform ops with 1-d structuresr.   )getattrr   rP   NotImplementedr   r5   r6   rI   aranger3   reshape)r   r8   r"   r:   opar>   r=   s          r   test_error_invalid_objectrb      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.   )r0   r1   r3   
ValueErrorjoinr	   r'   r(   	TypeErrorr*   r6   rI   r2   r   r5   r   rU   )	r   r8   r9   r:   rY   errr=   r<   ss	            r   test_error_len_mismatchrk      s*   LD&			5	6BHD	A&E
C
((QQ	
C zz#":"@"@"E J # W 	 
!'?	@=!rxx' ]]3c* 	tSM	 IIdO]]3c* 	q#J	 		 		 	s    
D>
DD	D(	r:   )__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)Nrn   fz0ufunc 'invert' not supported for the input typesr.   T)deepr   )r   rU   r	   r'   r   r5   rh   r]   _datarD   r0   rV   )r   r:   r"   rW   r=   r>   r?   s          r   %test_unary_op_does_not_propagate_maskrs      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r	   )Int64Int32Float32Float64c                   t        j                  g d|       }t        t         j                  |      }t	        |t
              rt        |      dk(  sJ t        j                  t         j                  t         j                  t         j                  g|       }t        j                  |d   |       t        j                  |d   |       t        j                  |d   t         j                  |z         t        j                  |d   t         j                  |z         t        |t         j                        }t	        |t
              rt        |      dk(  sJ t        j                  |d   |       t        j                  |d   |       t        j                  |d   |t         j                  z         t        j                  |d   |t         j                  z         y )N)r   r   r   r   r   r   r   )	r   rU   divmodrB   r   tupler3   r0   rV   )r	   rW   resexps       r   test_divmod_pdnar}      sK    ))IU
+C

Cc5!c#h!m33
))RUUBEE255)
7C3q63'3q63'3q6255C<03q62553;/
bee
Cc5!c#h!m333q63'3q63'3q63"%%<03q63;/r   )%
__future__r   typingr   numpyrI   r   pandasr   pandas._testing_testingr0   ALL_INT_EA_DTYPESr2   arraysr3   r
   __annotations__FLOAT_EA_DTYPESfixturezipr	   namer   r   r*   r@   rG   rM   rS   rZ   rb   rk   markparametrizers   r}   )r	   as   00r   <module>r      s   "      ?A>R>R	SU("((?%
0	SS3v;& & REWEW
XE8288)7
X X C:  8288-Y?
@ @ E7  vwt,2PA177<<2P<
>*6862,*5<9!H CD- E-0 "JK0 L0e 
T Y 3Qs   E .E%E*
