U
    f/e                     @   s   d dl Z d dlZd dlZd dlZd dlm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ejdejjdddgdd Zdd ZdS )     N)FloatingArrayc                   C   s:   t jddgd tjg ddgd  tjg ddg ddS )NTF   ,   booleanZdtype)pdarraynpnan r   r   O/tmp/pip-unpacked-wheel-tiezk1ph/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 )NT   Fr   r   r   r   r   r   r   r   
left_array   s    r   c                   C   s   t jddd gd ddS )NTFr   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_sub0   s    r%   c                 C   sd   | | }t tjdtjtjdtjtjtjtjtjg	ddtdddddddddg	}t|| d S )Ng      ?g        Zfloat64r   FT)r   r	   r   infr
   r   r   )r   r   r   r   r   r   r   test_div9   s    "r'   r   floordivmodpowz#TODO follow int8 behaviour? GH34686)reason)Zmarksc                 C   s:   t t|}|| |}|| d|d}t|| d S )NZInt8)r   r   Zastyper   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}tjt|d |t d W 5 Q R X |dkrd}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fooz]unsupported operand type\(s\) for|Concatenation operation is not implemented for NumPy arraysZ20180101)__mul____rmul__zounsupported operand type\(s\) for|can only concatenate str|not all arguments converted during string formatting)index)r   ZSeriesr   r!   r"   r#   Z	Timestampr/   )r   Zall_arithmetic_operatorsr   sopsr$   r   r   r   test_error_invalid_valuesZ   s     

r2   )r   Znumpyr	   r!   Zpandasr   Zpandas._testingZ_testingr   Zpandas.arraysr   Zfixturer   r   r   markZparametrizer   r%   r'   paramZxfailr,   r2   r   r   r   r   <module>   sB   



	 

