| Server IP : 209.209.40.120 / Your IP : 216.73.217.112 Web Server : Microsoft-IIS/10.0 System : Windows NT NEWWWW 10.0 build 17763 (Windows Server 2019) i586 User : NEWWWW$ ( 0) PHP Version : 8.3.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/Python312/Lib/site-packages/pandas/tests/arithmetic/__pycache__/ |
Upload File : |
�
. �g
� �p � d Z ddlZddlZddlmZmZmZmZ ddl m
Z ddlm
Z
mZ d
d�Zdd�Zddefd�Zd � Zy)
z)
Assertion helpers for arithmetic tests.
� N)� DataFrame�Index�Series�array)�BooleanArray�NumpyExtensionArrayc �� � t j t |�� 5 | |z ddd� t j t |�� 5 || z ddd� y# 1 sw Y �3xY w# 1 sw Y yxY 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 �@C:\Python312\Lib\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 ddd� t j t |�� 5 || z ddd� t j t |�� 5 | |z
ddd� t j t |�� 5 || z
ddd� y# 1 sw Y ��xY w# 1 sw Y �hxY w# 1 sw Y �KxY w# 1 sw Y yxY 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/�2B;�>C�
C�is_cmpc �n � t | t � st |t � rt S t | t � st |t � r(|r t | t � rt j
S t S t | t � st |t � r|rt 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����$���:�e�V�#<��j��u�-��8�8�O��
��$���*�U�E�":���8�8�O���
�;�;�� c � � |t t fvr|nt j }d� }|}t |t � r t | t � rt j } || |k( � } |t j
|j t j �� � }t j ||� ||| k( � }t j | ||� � || |k7 � }t j || � ||| k7 � }t j | || � � dj g d�� }t j t |�� 5 | |k ddd� t j t |�� 5 | |k ddd� t j t |�� 5 | |kD ddd� t j t |�� 5 | |k\ ddd� t j t |�� 5 || k ddd� t j t |�� 5 || k ddd� t j t |�� 5 || kD ddd� t j t |�� 5 || k\ ddd� y# 1 sw Y ��*xY w# 1 sw Y ��xY w# 1 sw Y ��xY w# 1 sw Y ��xY w# 1 sw Y ��xY w# 1 sw Y ��xY w# 1 sw Y �}xY w# 1 sw Y yxY 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��&��8�8�D�>�!��r )�dtype�|)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`.r
N)r r r r r �zeros�shape�bool_r �assert_equal�joinr
r r ) r r �box�xboxr'