
     f
                     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)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      X/var/www/html/py/new-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)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	,      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   8   sx     $	"j	&B$:eV#<ju-88O$*UE":88O;;    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                  | ||              || |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>.xbox2`   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   r   r   zerosshapebool_r   assert_equaljoinr   r   r   )	r   r   boxxboxr'   rev_boxresultexpectedr   s	            r   assert_invalid_comparisonr4   Q   sG    eU^+3D G%JtV$<((45=!FBHHV\\:;HOOFH%5D=!FOOFGH-.45=!FOOFXI&5D=!FOOFGXI./
((	
C 
y	, u	y	, 	y	, u	y	, 	y	, 	y	, 	y	, 	y	,          s`   I94JJJ/J+J7K*K9JJJJ(+J47K KK)z
cannot addr"   )F)__doc__numpyr   r   pandasr   r   r   r   pandas._testing_testingr   pandas.core.arraysr   r   r   r   r%   r   r4    r   r   <module>r<      sB        ( 2Jr   