
    \
qiM                     r    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dS )z)
Assertion helpers for arithmetic tests.
    N)	DataFrameIndexSeriesarray)BooleanArrayNumpyExtensionArray
cannot addc                     t          j        t          |          5  | |z    ddd           n# 1 swxY w Y   t          j        t          |          5  || z    ddd           dS # 1 swxY w Y   dS )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/html/bestrading.cuttalo.com/services/ml-inference/venv/lib/python3.11/site-packages/pandas/tests/arithmetic/common.pyassert_cannot_addr      s     
y	,	,	,  u              	y	,	,	,                   s   .22A''A+.A+c                    t          j        t          |          5  | |z    ddd           n# 1 swxY w Y   t          j        t          |          5  || z    ddd           n# 1 swxY w Y   t          j        t          |          5  | |z
   ddd           n# 1 swxY w Y   t          j        t          |          5  || z
   ddd           dS # 1 swxY w Y   dS )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	,	,	,                   sB   .22A&&A*-A*BB"%B"CCCFis_cmpc                    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   @   s     $	"" j	&B&B $ :eV#<#<  	ju-- 	8O$ *UE":":  	8O;    c                    |t           t          fvr|nt          j        }d } || |k              } |t          j        |j        t          j                            }t          j        ||            ||| k              }t          j        | ||                      || |k              }t          j        ||             ||| k              }t          j        | ||                      d                    g d          }t          j
        t          |          5  | |k      ddd           n# 1 swxY w Y   t          j
        t          |          5  | |k     ddd           n# 1 swxY w Y   t          j
        t          |          5  | |k     ddd           n# 1 swxY w Y   t          j
        t          |          5  | |k     ddd           n# 1 swxY w Y   t          j
        t          |          5  || k      ddd           n# 1 swxY w Y   t          j
        t          |          5  || k     ddd           n# 1 swxY w Y   t          j
        t          |          5  || k     ddd           n# 1 swxY w Y   t          j
        t          |          5  || k     ddd           dS # 1 swxY w Y   dS )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|                     t
                    S | S N)r   r   _ndarrayr   astypebool)xs    r   xbox2z(assert_invalid_comparison.<locals>.xbox2h   sF     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_comparisonr4   Y   s    eU^++33D   U45=!!FtBHV\:::;;HOFH%%%U5D=!!FOFDDNN+++U45=!!FOFXI&&&U5D=!!FOFDD(OO,,,
((	
 	
 	
 C 
y	,	,	,  u              	y	,	,	,                	y	,	,	,  u              	y	,	,	,                	y	,	,	,                	y	,	,	,                	y	,	,	,                	y	,	,	,                   s   &D99D= D=E22E69E6F++F/2F/G$$G(+G(
HH!$H!III<JJJ5K		KK)r	   r#   )F)__doc__numpyr   r   pandasr   r   r   r   pandas._testing_testingr   pandas.core.arraysr   r   r   r   r&   r   r4    r    r   <module>r<      s                                   &   0     2E E E E Er    