
    .iM                     p    d Z ddlZddlZddlmZmZmZmZ ddl	m
Z ddlmZmZ d
dZddZddefdZd	 Zy)z)
Assertion helpers for arithmetic tests.
    N)	DataFrameIndexSeriesarray)BooleanArrayNumpyExtensionArrayc                     t        j                  t        |      5  | |z    ddd       t        j                  t        |      5  || z    ddd       y# 1 sw Y   3xY w# 1 sw Y   yxY w)a  
    Helper function to assert that two objects cannot be added.

    Parameters
    ----------
    left : object
        The first operand.
    right : object
        The second operand.
    msg : str, default "cannot add"
        The error message expected in the TypeError.
    matchNpytestraises	TypeErrorleftrightmsgs      \/var/www/app/trading-bot/venv/lib/python3.12/site-packages/pandas/tests/arithmetic/common.pyassert_cannot_addr      s]     
y	, u	y	,    s   AA A A)c                    t        j                  t        |      5  | |z    ddd       t        j                  t        |      5  || z    ddd       t        j                  t        |      5  | |z
   ddd       t        j                  t        |      5  || z
   ddd       y# 1 sw Y   xY w# 1 sw Y   hxY w# 1 sw Y   KxY w# 1 sw Y   yxY w)a1  
    Helper function to assert that two objects can
    neither be added nor subtracted.

    Parameters
    ----------
    left : object
        The first operand.
    right : object
        The second operand.
    msg : str or None, default None
        The error message expected in the TypeError.
    r
   Nr   r   s      r   assert_invalid_addsub_typer   (   s     
y	, u	y	, 	y	, u	y	,      s/   B&B2.B>C
&B/2B;>C
Cis_cmpc                 n   t        | t              st        |t              rt        S t        | t              st        |t              r(|r t        | t              rt        j
                  S t        S t        | t              st        |t              r|rt        j
                  S t        S t        j                  S )z
    Get the box to use for 'expected' in an arithmetic or comparison operation.

    Parameters
    left : Any
    right : Any
    is_cmp : bool, default False
        Whether the operation is a comparison method.
    )
isinstancer   r   r   npr   tmto_array)r   r   r   s      r   get_upcast_boxr   @   sx     $	"j	&B$:eV#<ju-88O$*UE":88O;;    c                 R   |t         t        fvr|nt        j                  }d } || |k(        } |t        j                  |j                  t        j
                              }t        j                  ||        ||| k(        }t        j                  | ||              || |k7        }t        j                  ||         ||| k7        }t        j                  | ||              dj                  g d      }t        j                  t        |      5  | |k   ddd       t        j                  t        |      5  | |k   ddd       t        j                  t        |      5  | |kD   ddd       t        j                  t        |      5  | |k\   ddd       t        j                  t        |      5  || k   ddd       t        j                  t        |      5  || k   ddd       t        j                  t        |      5  || kD   ddd       t        j                  t        |      5  || k\   ddd       y# 1 sw Y   *xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   }xY w# 1 sw Y   yxY w)a  
    Assert that comparison operations with mismatched types behave correctly.

    Parameters
    ----------
    left : np.ndarray, ExtensionArray, Index, or Series
    right : object
    box : {pd.DataFrame, pd.Series, pd.Index, pd.array, tm.to_array}
    c                     t        | t              r| j                  S t        | t              r| j	                  t
              S | S N)r   r   _ndarrayr   astypebool)xs    r   xbox2z(assert_invalid_comparison.<locals>.xbox2h   s6     a,-::a&88D>!r   )dtype|)zInvalid comparison betweenzCannot compare typeznot supported betweenzinvalid type promotionzThe DTypes <class 'numpy.dtype\[datetime64\]'> and <class 'numpy.dtype\[int64\]'> do not have a common DType. For example they cannot be stored in a single array unless the dtype is `object`.r
   N)r   r   r   zerosshapebool_r   assert_equaljoinr   r   r   )r   r   boxxboxr'   resultexpectedr   s           r   assert_invalid_comparisonr3   Y   s$    eU^+3D 45=!FBHHV\\:;HOOFH%5D=!FOOFDN+45=!FOOFXI&5D=!FOOFD(O,
((	
C 
y	, u	y	, 	y	, u	y	, 	y	, 	y	, 	y	, 	y	,          s`   II+I!I-=I9&JJ8JII!I*-I69JJJJ&)z
cannot addr"   )F)__doc__numpyr   r   pandasr   r   r   r   pandas._testing_testingr   pandas.core.arraysr   r   r   r   r%   r   r3    r   r   <module>r;      sB       &0 2Er   