
    bMh
                     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 )z
    Helper to assert that left and right cannot be added.

    Parameters
    ----------
    left : object
    right : object
    msg : str, default "cannot add"
    matchNpytestraises	TypeErrorleftrightmsgs      ^/var/www/html/test/jupyter/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 )z
    Helper to assert that left and right can be neither added nor subtracted.

    Parameters
    ----------
    left : object
    right : object
    msg : str or None, default None
    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   8   s     $	"" j	&B&B $ :eV#<#<  	ju-- 	8O$ *UE":":  	8O;    c                    |t           t          fvr|nt          j        }d }|}t          |t                     r!t          | t                    rt          j        } || |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>.xbox2`   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   r   r   zerosshapebool_r   assert_equaljoinr   r   r   )	r   r   boxxboxr(   rev_boxresultexpectedr   s	            r   assert_invalid_comparisonr5   Q   s    eU^++33D   G% JtV$<$< (U45=!!FtBHV\:::;;HOFH%%%U5D=!!FOFGGH--...U45=!!FOFXI&&&U5D=!!FOFGGXI..///
((	
 	
 	
 C 
y	,	,	,  u              	y	,	,	,                	y	,	,	,  u              	y	,	,	,                	y	,	,	,                	y	,	,	,                	y	,	,	,                	y	,	,	,                   s   E11E58E5F**F.1F.G##G'*G'	HH #H III;JJJ4KKK-LLL)r	   r#   )F)__doc__numpyr   r   pandasr   r   r   r   pandas._testing_testingr   pandas.core.arraysr   r   r   r   r&   r   r5    r    r   <module>r=      s                                       (     2J J J J Jr    