U
    e"e|                     @   s   d dl Z d dlZd dlZd dlZd dlmZ ej	dd Z
ej	dd Zej	dd Zejjdd	d
d
dd
dddddg	fdd
ddddddddg	fgd	dgddd Zdd Zdd Zejddddgdd Zdd ZdS )    Nc                   C   s:   t jddgd tjg ddgd  tjg ddg ddS )>Fixture returning boolean array with valid and missing values.TF   ,   booleanZdtype)pdarraynpnan r   r   O/tmp/pip-unpacked-wheel-b4zrpxve/pandas/tests/arrays/boolean/test_arithmetic.pydata
   s    .r   c                   C   s(   t jdgd dgd  dgd  ddS )r   T   FNr   r   r   r   r   r   r   r   
left_array   s    r   c                   C   s   t jdddgd ddS )r   TFNr   r   r   r   r   r   r   r   right_array   s    r   zopname, expaddTFmul)idsc                 C   s2   t t|}|| |}tj|dd}t|| d S )Nr   r   )getattroperatorr   r   tmassert_extension_array_equal)r   r   opnameexpopresultexpectedr   r   r   test_add_mul#   s    	

r   c              	   C   s*   d}t jt|d | |  W 5 Q R X d S )Nznumpy boolean subtract, the `-` operator, is (?:deprecated|not supported), use the bitwise_xor, the `\^` operator, or the logical_xor function instead\.match)pytestraises	TypeErrorr   r   msgr   r   r   test_sub2   s    r&   c              	   C   s\   d}t jt|d t| jt|j  W 5 Q R X t jt|d | |  W 5 Q R X d S )N-operator '.*' not implemented for bool dtypesr   )r!   r"   NotImplementedErrorr   Series_datar$   r   r   r   test_div;   s
    "r+   r   floordivmodpowc              	   C   sn   t t|}|dkr>d}tjt|d || |}W 5 Q R X d S || |}|| d|d}t|| d S )Nr-   r'   r   ZInt8)r   r   r!   r"   r(   Zastyper   r   )r   r   r   r   r%   r   r   r   r   r   test_op_int8E   s    	

r/   c              	   C   s   |}t | }t||}d}tjt|d |d W 5 Q R X dddg}tjt|d |t d W 5 Q R X |dkrddd	d
g}tjt|d |t jd|jd W 5 Q R X d S )Nzdid not contain a loop with signature matching types|BooleanArray cannot perform the operation|not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''r   Zfoo|z!unsupported operand type\(s\) forz;Concatenation operation is not implemented for NumPy arraysZ20180101)__mul____rmul__zcan only concatenate strz4not all arguments converted during string formatting)index)	r   r)   r   r!   r"   r#   joinZ	Timestampr3   )r   Zall_arithmetic_operatorsr   sopsr%   r   r   r   test_error_invalid_values]   s.    

r7   )r   Znumpyr	   r!   Zpandasr   Zpandas._testingZ_testingr   Zfixturer   r   r   markZparametrizer   r&   r+   r/   r7   r   r   r   r   <module>   s:   


	
	

