HOME


sh-3ll 1.0
DIR:/usr/local/lib64/python3.6/site-packages/pandas/tests/arithmetic/__pycache__/
Upload File :
Current File : //usr/local/lib64/python3.6/site-packages/pandas/tests/arithmetic/__pycache__/common.cpython-36.pyc
3

���hc�@sPdZddlZddlZddlmZmZmZddlj	Z
d
dd�Zdd�Zdd	�Z
dS)z)
Assertion helpers for arithmetic tests.
�N)�	DataFrame�Index�SeriescCs�tjt|d��||WdQRXtjt|d��||WdQRXtjt|d��||WdQRXtjt|d��||WdQRXdS)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
    )�matchN)�pytest�raises�	TypeError)�left�right�msg�r�@/tmp/pip-build-5_djhm0z/pandas/pandas/tests/arithmetic/common.py�assert_invalid_addsub_types
rcCsF|tkst|t�rtS|tks(t|t�r,tS|tks>t|t�rBtS|S)z?
    Given two box-types, find the one that takes priority
    )r�
isinstancerr)�boxZvectorrrr
�get_upcast_boxsrc:Cs�|tk	r|ntj}||k}|tj|jtjd��}tj||�||k}tj||�||k}tj||�||k}tj||�djdddddg�}t	j
t|d��||kWd	QRXt	j
t|d��||kWd	QRXt	j
t|d��||kWd	QRXt	j
t|d��||kWd	QRXt	j
t|d��||kWd	QRXt	j
t|d��||kWd	QRXt	j
t|d��||kWd	QRXt	j
t|d��||kWd	QRXd	S)
z�
    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, tm.to_array}
    )Zdtype�|zInvalid comparison betweenzCannot compare typeznot supported betweenzinvalid type promotionz�The 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`.)rN)r�np�array�zeros�shapeZbool_�tmZassert_equal�joinrrr)r	r
rZxbox�result�expectedrrrr
�assert_invalid_comparison,s@
r)N)�__doc__ZnumpyrrZpandasrrrZpandas._testingZ_testingrrrrrrrr
�<module>s