U
    9%eH                     @   s`  d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlm	Z	m
Z
 d dlmZ d dlmZmZmZmZ d dlmZ d dlmZmZmZ d dlmZmZmZ e
 Ze
 Zde_d	d
 ZG dd de Z!G dd de Z"G dd deZ#G dd de#Z$G dd deZ%G dd de%Z&G dd deZ'G dd deZ(G dd deZ)e*dkr\e+  dS )    N)compile_isolatedFlags)jit)typesutilserrors	typeinfer)_header_lead)TestCasetag
needs_blas)matmul_usecaseimatmul_usecase
DumbMatrixTc                    s    fdd}|S )Nc                    s   |   S N xexpr   Y/var/www/html/Darija-Ai-API/env/lib/python3.8/site-packages/numba/tests/test_operators.pypow_usecase   s    z&make_static_power.<locals>.pow_usecaser   )r   r   r   r   r   make_static_power   s    r   c                   @   s  e Zd Zedd Zedd Zedd Zedd Zed	d
 Zedd Z	edd Z
edd Zedd Zedd ZereeZeeZedd Zedd Zedd Zedd Zedd Zedd  Zed!d" Zed#d$ Zed%d& Zed'd( Zed)d* Zed+d, Zed-d. Zed/d0 Zed1d2 Zed3d4 Zed5d6 Z ed7d8 Z!ed9d: Z"ed;d< Z#ed=d> Z$ed?d@ Z%edAdB Z&edCdD Z'edEdF Z(edGdH Z)edIdJ Z*edKdL Z+dMS )NLiteralOperatorImplc                 C   s   | | S r   r   r   yr   r   r   add_usecase    s    zLiteralOperatorImpl.add_usecasec                 C   s   | |7 } | S r   r   r   r   r   r   iadd_usecase$   s    z LiteralOperatorImpl.iadd_usecasec                 C   s   | | S r   r   r   r   r   r   sub_usecase)   s    zLiteralOperatorImpl.sub_usecasec                 C   s   | |8 } | S r   r   r   r   r   r   isub_usecase-   s    z LiteralOperatorImpl.isub_usecasec                 C   s   | | S r   r   r   r   r   r   mul_usecase2   s    zLiteralOperatorImpl.mul_usecasec                 C   s   | |9 } | S r   r   r   r   r   r   imul_usecase6   s    z LiteralOperatorImpl.imul_usecasec                 C   s   | | S r   r   r   r   r   r   floordiv_usecase;   s    z$LiteralOperatorImpl.floordiv_usecasec                 C   s   | | } | S r   r   r   r   r   r   ifloordiv_usecase?   s    z%LiteralOperatorImpl.ifloordiv_usecasec                 C   s   | | S r   r   r   r   r   r   truediv_usecaseD   s    z#LiteralOperatorImpl.truediv_usecasec                 C   s   | | } | S r   r   r   r   r   r   itruediv_usecaseH   s    z$LiteralOperatorImpl.itruediv_usecasec                 C   s   | | S r   r   r   r   r   r   mod_usecaseQ   s    zLiteralOperatorImpl.mod_usecasec                 C   s   | |; } | S r   r   r   r   r   r   imod_usecaseU   s    z LiteralOperatorImpl.imod_usecasec                 C   s   | | S r   r   r   r   r   r   r   Z   s    zLiteralOperatorImpl.pow_usecasec                 C   s   | |C } | S r   r   r   r   r   r   ipow_usecase^   s    z LiteralOperatorImpl.ipow_usecasec                 C   s   | |> S r   r   r   r   r   r   bitshift_left_usecasec   s    z)LiteralOperatorImpl.bitshift_left_usecasec                 C   s   | |K } | S r   r   r   r   r   r   bitshift_ileft_usecaseg   s    z*LiteralOperatorImpl.bitshift_ileft_usecasec                 C   s   | |? S r   r   r   r   r   r   bitshift_right_usecasel   s    z*LiteralOperatorImpl.bitshift_right_usecasec                 C   s   | |L } | S r   r   r   r   r   r   bitshift_iright_usecasep   s    z+LiteralOperatorImpl.bitshift_iright_usecasec                 C   s   | |@ S r   r   r   r   r   r   bitwise_and_usecaseu   s    z'LiteralOperatorImpl.bitwise_and_usecasec                 C   s   | |M } | S r   r   r   r   r   r   bitwise_iand_usecasey   s    z(LiteralOperatorImpl.bitwise_iand_usecasec                 C   s   | |B S r   r   r   r   r   r   bitwise_or_usecase~   s    z&LiteralOperatorImpl.bitwise_or_usecasec                 C   s   | |O } | S r   r   r   r   r   r   bitwise_ior_usecase   s    z'LiteralOperatorImpl.bitwise_ior_usecasec                 C   s   | |A S r   r   r   r   r   r   bitwise_xor_usecase   s    z'LiteralOperatorImpl.bitwise_xor_usecasec                 C   s   | |N } | S r   r   r   r   r   r   bitwise_ixor_usecase   s    z(LiteralOperatorImpl.bitwise_ixor_usecasec                 C   s   |  S r   r   r   Z_unusedr   r   r   bitwise_not_usecase_binary   s    z.LiteralOperatorImpl.bitwise_not_usecase_binaryc                 C   s   |  S r   r   r   r   r   r   bitwise_not_usecase   s    z'LiteralOperatorImpl.bitwise_not_usecasec                 C   s   |  S r   r   r   r   r   r   not_usecase   s    zLiteralOperatorImpl.not_usecasec                 C   s   |  S r   r   r   r   r   r   negate_usecase   s    z"LiteralOperatorImpl.negate_usecasec                 C   s   | 
 S r   r   r   r   r   r   unary_positive_usecase   s    z*LiteralOperatorImpl.unary_positive_usecasec                 C   s   | |k S r   r   r   r   r   r   
lt_usecase   s    zLiteralOperatorImpl.lt_usecasec                 C   s   | |kS r   r   r   r   r   r   
le_usecase   s    zLiteralOperatorImpl.le_usecasec                 C   s   | |kS r   r   r   r   r   r   
gt_usecase   s    zLiteralOperatorImpl.gt_usecasec                 C   s   | |kS r   r   r   r   r   r   
ge_usecase   s    zLiteralOperatorImpl.ge_usecasec                 C   s   | |kS r   r   r   r   r   r   
eq_usecase   s    zLiteralOperatorImpl.eq_usecasec                 C   s   | |kS r   r   r   r   r   r   
ne_usecase   s    zLiteralOperatorImpl.ne_usecasec                 C   s   | |kS r   r   r   r   r   r   
in_usecase   s    zLiteralOperatorImpl.in_usecasec                 C   s   | |kS r   r   r   r   r   r   not_in_usecase   s    z"LiteralOperatorImpl.not_in_usecasec                 C   s   | |kS r   r   r   r   r   r   
is_usecase   s    zLiteralOperatorImpl.is_usecaseN),__name__
__module____qualname__staticmethodr   r   r   r   r    r!   r"   r#   r$   r%   r   r   r&   r'   r   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   r   r   r   r   r      s   




































r   c                   @   s  e Zd Zedd Zedd Zedd Zedd Zed	d
 Zedd Z	edd Z
edd Zedd Zedd Zedd Zedd Zedd Zedd Zedd Zedd  Zed!d" Zed#d$ Zed%d& Zed'd( Zed)d* Zed+d, Zed-d. Zed/d0 Zed1d2 Zed3d4 Zed5d6 Zed7d8 Zed9d: Z ed;d< Z!ed=d> Z"ed?d@ Z#edAdB Z$edCdD Z%edEdF Z&edGdH Z'edIdJ Z(edKdL Z)edMdN Z*edOdP Z+dQS )RFunctionalOperatorImplc                 C   s   t | |S r   )operatoraddr   r   r   r   r      s    z"FunctionalOperatorImpl.add_usecasec                 C   s   t | |S r   )rG   iaddr   r   r   r   r      s    z#FunctionalOperatorImpl.iadd_usecasec                 C   s   t | |S r   )rG   subr   r   r   r   r      s    z"FunctionalOperatorImpl.sub_usecasec                 C   s   t | |S r   )rG   isubr   r   r   r   r      s    z#FunctionalOperatorImpl.isub_usecasec                 C   s   t | |S r   )rG   mulr   r   r   r   r       s    z"FunctionalOperatorImpl.mul_usecasec                 C   s   t | |S r   )rG   imulr   r   r   r   r!      s    z#FunctionalOperatorImpl.imul_usecasec                 C   s   t | |S r   )rG   floordivr   r   r   r   r"      s    z'FunctionalOperatorImpl.floordiv_usecasec                 C   s   t | |S r   )rG   	ifloordivr   r   r   r   r#      s    z(FunctionalOperatorImpl.ifloordiv_usecasec                 C   s   t | |S r   )rG   truedivr   r   r   r   r$      s    z&FunctionalOperatorImpl.truediv_usecasec                 C   s   t | |S r   )rG   itruedivr   r   r   r   r%      s    z'FunctionalOperatorImpl.itruediv_usecasec                 C   s   t | |S r   )rG   modr   r   r   r   r&      s    z"FunctionalOperatorImpl.mod_usecasec                 C   s   t | |S r   )rG   imodr   r   r   r   r'      s    z#FunctionalOperatorImpl.imod_usecasec                 C   s   t | |S r   )rG   powr   r   r   r   r      s    z"FunctionalOperatorImpl.pow_usecasec                 C   s   t | |S r   )rG   ipowr   r   r   r   r(      s    z#FunctionalOperatorImpl.ipow_usecasec                 C   s   t | |S r   )rG   matmulr   r   r   r   r     s    z%FunctionalOperatorImpl.matmul_usecasec                 C   s   t | |S r   )rG   imatmulr   r   r   r   r     s    z&FunctionalOperatorImpl.imatmul_usecasec                 C   s   t | |S r   )rG   lshiftr   r   r   r   r)     s    z,FunctionalOperatorImpl.bitshift_left_usecasec                 C   s   t | |S r   )rG   ilshiftr   r   r   r   r*     s    z-FunctionalOperatorImpl.bitshift_ileft_usecasec                 C   s   t | |S r   )rG   rshiftr   r   r   r   r+     s    z-FunctionalOperatorImpl.bitshift_right_usecasec                 C   s   t | |S r   )rG   irshiftr   r   r   r   r,     s    z.FunctionalOperatorImpl.bitshift_iright_usecasec                 C   s   t | |S r   )rG   and_r   r   r   r   r-     s    z*FunctionalOperatorImpl.bitwise_and_usecasec                 C   s   t | |S r   )rG   iandr   r   r   r   r.     s    z+FunctionalOperatorImpl.bitwise_iand_usecasec                 C   s   t | |S r   )rG   or_r   r   r   r   r/   #  s    z)FunctionalOperatorImpl.bitwise_or_usecasec                 C   s   t | |S r   )rG   iorr   r   r   r   r0   '  s    z*FunctionalOperatorImpl.bitwise_ior_usecasec                 C   s   t | |S r   )rG   xorr   r   r   r   r1   +  s    z*FunctionalOperatorImpl.bitwise_xor_usecasec                 C   s   t | |S r   )rG   ixorr   r   r   r   r2   /  s    z+FunctionalOperatorImpl.bitwise_ixor_usecasec                 C   s
   t | S r   rG   invertr3   r   r   r   r4   3  s    z1FunctionalOperatorImpl.bitwise_not_usecase_binaryc                 C   s
   t | S r   rb   r   r   r   r   r5   7  s    z*FunctionalOperatorImpl.bitwise_not_usecasec                 C   s
   t | S r   )rG   not_r   r   r   r   r6   ;  s    z"FunctionalOperatorImpl.not_usecasec                 C   s
   t | S r   )rG   negr   r   r   r   r7   ?  s    z%FunctionalOperatorImpl.negate_usecasec                 C   s
   t | S r   )rG   posr   r   r   r   r8   C  s    z-FunctionalOperatorImpl.unary_positive_usecasec                 C   s   t | |S r   )rG   ltr   r   r   r   r9   G  s    z!FunctionalOperatorImpl.lt_usecasec                 C   s   t | |S r   )rG   ler   r   r   r   r:   K  s    z!FunctionalOperatorImpl.le_usecasec                 C   s   t | |S r   )rG   gtr   r   r   r   r;   O  s    z!FunctionalOperatorImpl.gt_usecasec                 C   s   t | |S r   )rG   ger   r   r   r   r<   S  s    z!FunctionalOperatorImpl.ge_usecasec                 C   s   t | |S r   )rG   eqr   r   r   r   r=   W  s    z!FunctionalOperatorImpl.eq_usecasec                 C   s   t | |S r   )rG   ner   r   r   r   r>   [  s    z!FunctionalOperatorImpl.ne_usecasec                 C   s   t || S r   rG   containsr   r   r   r   r?   _  s    z!FunctionalOperatorImpl.in_usecasec                 C   s   t ||  S r   rm   r   r   r   r   r@   c  s    z%FunctionalOperatorImpl.not_in_usecasec                 C   s   t | |S r   )rG   is_r   r   r   r   rA   g  s    z!FunctionalOperatorImpl.is_usecaseN),rB   rC   rD   rE   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r   r(   r   r   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   r   r   r   r   rF      s   






































rF   c                   @   s  e Zd ZdZeZejejej	ej
ejejejejejejejdZefddZefddZdd Zed	fd
dZdddddgZejejejejejejgZ ej!ej"gZ#efddZ$dd Z%efddZ&dd Z'efddZ(dd Z)efddZ*dd  Z+efd!d"Z,d#d$ Z-efd%d&Z.d'd( Z/d)d* Z0d+d, Z1efd-d.Z2efd/d0Z3efd1d2Z4efd3d4Z5efd5d6Z6dd8d9Z7e7e8 d:d;d<d=d> e7e8 d?d;d<d=d> e7e8 d@d;dAdB ed7fdCdDZ9efdEdFZ:dGdH Z;efdIdJZ<dKdL Z=efdMdNZ>dOdP Z?efdQdRZ@efdSdTZAe7e8 dUdVdWdB efdXdYZBdZd[ ZCefd\d]ZDd^d_ ZEefd`daZFdbdc ZGefdddeZHdfdg ZIefdhdiZJdjdk ZKdldm ZLdndo ZMdpdq ZNeOdrds ZPdtdu ZQdvdw ZRefdxdyZSe7e8 dzd{d|i efd}d~ZTe7e8 dd{di efddZUe7e8 dddd efddZVdd ZWdd ZXdd ZYdd ZZdd Z[dd Z\dd Z]dd Z^dd Z_efddZ`dd ZaefddZbdd ZcdS )TestOperatorszw
    Test standard Python operators on scalars.

    NOTE: operators on array are generally tested in test_ufuncs.
    r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r4   c                 C   s   |D ]}t |||d}|j}t||D ]l\}	}
t|	}t|	}|||
}|||
}| j||d|	|
|||f d | j||d|	|
|||f d q(qd S )Nflagsz-mismatch for (%r, %r) with types %s: %r != %rmsg)r   entry_point	itertoolsproductcopyassertPreciseEqualselfpyfunc
x_operands
y_operands
types_listrs   	arg_typescrcfuncr   r   Zx_gotZ
x_expectedgotexpectedr   r   r   run_test_ints  s,    



  zTestOperators.run_test_intsc                 C   s   |D ]z}t |||d}|j}t||D ]T\}	}
t|	}t|	}|||
}|||
}tjj||dd tjj||dd q(qd S )Nrr   gh㈵>)Zrtol)r   rv   rw   rx   ry   nptestingZassert_allcloser{   r   r   r   run_test_floats  s    



zTestOperators.run_test_floatsc                 C   s\   t |dr||S |tjkr,tt|jS |tjkr@t|jS |tjkrTt	|jS |S d S )Ndtype)
hasattrZcast_python_valuer   Zunsigned_domainabsintrealZinteger_domainZreal_domainfloat)r|   opZ
numba_typer   r   r   coerce_operand  s    






zTestOperators.coerce_operandTc              
   C   s   | j }| j}|s|| j }|D ]}t|||f|d}|j}t||D ]`\}	}
| |	|}	| |
|}
||	|
}||	|
}| t	|t	| | 
||d||	|
f  qFqd S )Nrr   zmismatch with %r (%r, %r))compare_scalar_operandscompare_typescompare_unordered_typesr   rv   rw   rx   r   assertIstypeassertEqual)r|   r}   rs   orderedZopsr   typr   r   r   r   r   r   r   r   r   run_test_scalar_compare  s$    


z%TestOperators.run_test_scalar_compareg      y            ?y             @y            ?      ?c                 C   s   |  | jj| d S r   )r   r   r9   r|   rs   r   r   r   test_lt_scalar  s    zTestOperators.test_lt_scalarc                 C   s   | j td d S Nrr   )r   Noflagsr|   r   r   r   test_lt_scalar_npm  s    z TestOperators.test_lt_scalar_npmc                 C   s   |  | jj| d S r   )r   r   r:   r   r   r   r   test_le_scalar  s    zTestOperators.test_le_scalarc                 C   s   | j td d S r   )r   r   r   r   r   r   test_le_scalar_npm  s    z TestOperators.test_le_scalar_npmc                 C   s   |  | jj| d S r   )r   r   r;   r   r   r   r   test_gt_scalar  s    zTestOperators.test_gt_scalarc                 C   s   | j td d S r   )r   r   r   r   r   r   test_gt_scalar_npm  s    z TestOperators.test_gt_scalar_npmc                 C   s   |  | jj| d S r   )r   r   r<   r   r   r   r   test_ge_scalar  s    zTestOperators.test_ge_scalarc                 C   s   | j td d S r   )r   r   r   r   r   r   test_ge_scalar_npm  s    z TestOperators.test_ge_scalar_npmc                 C   s   | j | jj|dd d S NF)r   )r   r   r=   r   r   r   r   test_eq_scalar  s    zTestOperators.test_eq_scalarc                 C   s   | j td d S r   )r   r   r   r   r   r   test_eq_scalar_npm  s    z TestOperators.test_eq_scalar_npmc                 C   s   | j | jj|dd d S r   )r   r   r>   r   r   r   r   test_ne_scalar  s    zTestOperators.test_ne_scalarc                 C   s   | j td d S r   )r   r   r   r   r   r   test_ne_scalar_npm  s    z TestOperators.test_ne_scalar_npmc                 C   s0   t | jjtjtjf}|j}| |tt d S r   )r   r   rA   r   ellipsisrv   
assertTrueEllipsis)r|   cresr   r   r   r   test_is_ellipsis  s    zTestOperators.test_is_ellipsisc                    sV   t tjtjfdd| jj t dd fdd}| |dd | |dd d S )NTnopythonc                    s
    | |S r   r   r   Z
cfunc_voidr   r   r     s    z-TestOperators.test_is_void_ptr.<locals>.cfunc      )r   r   Zvoidptrr   rA   r   ZassertFalse)r|   r   r   r   r   test_is_void_ptr  s    
 zTestOperators.test_is_void_ptrc                 C   s>   ddddg}ddddg}t jt jfg}| j|||||d d S )NFTrr   )r   booleanr   r|   r}   rs   r~   r   r   r   r   r   run_binop_bools  s    zTestOperators.run_binop_boolsc                 C   s   ddddg}ddddg}t jt jft jt jfg}| j|||||d ddg}ddg}t jt jft jt jft jt jfg}| j|||||d d S )	Nr   r   r      rr   r   int32int64r   byteuint32uint64r   r   r   r   run_binop_ints  s"    




zTestOperators.run_binop_intsc                 C   sD   dddg}dddg}t jt jft jt jfg}| j|||||d d S )Ng        g?g      g?g @rr   r   float32float64r   r   r   r   r   run_binop_floats*  s    



zTestOperators.run_binop_floatsc                 C   s   | j ||d d S r   )r   )r|   r}   rs   r   r   r   run_binop_floats_floordiv4  s    z'TestOperators.run_binop_floats_floordivc                 C   sD   dddg}dddg}t jt jft jt jfg}| j|||||d d S )Ny333333?y                y        ?y      ffffffy        ?y @       rr   )r   	complex64
complex128r   r   r   r   r   run_binop_complex7  s    



zTestOperators.run_binop_complexFc                    s   |D ]}|  D ]\}}dD ]}d||f }|r8|d7 }|r@tnt}	d| }
||
|	fdd |rzd|krz|sz fdd	}n }||_|rtd
|}|| |< qqqd S )NFTz
test_%s_%sZ_npmz
%s_usecasec                 S   s$   t | |}t | j|}||| d S r   )getattrr   )r|   runner_nameusecase_namers   runnerZ
op_usecaser   r   r   innerK  s    
z1TestOperators.generate_binop_tests.<locals>.innerarrayc              	      s   |       W 5 Q R X d S r   )assertTypingErrorr   r   r   r   	test_methR  s    
z5TestOperators.generate_binop_tests.<locals>.test_methZ	important)itemsr   force_pyobj_flagsrB   r   )nsZusecasesZ
tp_runnersZ	npm_arrayZusecaseZtp_namer   r   Z	test_namers   r   r   r   r   r   generate_binop_testsA  s&     
z"TestOperators.generate_binop_tests)rH   rI   rJ   rK   rL   rM   r   r   r   )intsfloatscomplex)rP   rQ   )rN   rO   rR   rS   r   )r   r   c              
   C   s   t | j|}tjtjtjg}|r,|tj |D ]V}t|||f|d}|j	}	| 
t}
|	dd W 5 Q R X |tk	r0| |t|
j q0d S )Nrr   r   r   )r   r   r   r   r   r   appendr   r   rv   assertRaisesZeroDivisionErrorr   assertInstr	exception)r|   r   ru   rs   allow_complexr}   r   tpr   r   cmr   r   r   check_div_errorsu  s    zTestOperators.check_div_errorsc                 C   s   | j dd|dd d S )Nr$   division by zeroT)rs   r   r   r   r   r   r   test_truediv_errors  s    
z!TestOperators.test_truediv_errorsc                 C   s   | j td d S r   )r   r   r   r   r   r   test_truediv_errors_npm  s    z%TestOperators.test_truediv_errors_npmc                 C   s   | j dd|d d S )Nr"   r   rr   r   r   r   r   r   test_floordiv_errors  s    z"TestOperators.test_floordiv_errorsc                 C   s   | j td d S r   )r   r   r   r   r   r   test_floordiv_errors_npm  s    z&TestOperators.test_floordiv_errors_npmc                 C   s   | j dd|d d S )Nr&   zmodulo by zerorr   r   r   r   r   r   test_mod_errors  s    zTestOperators.test_mod_errorsc                 C   s   | j td d S r   )r   r   r   r   r   r   test_mod_errors_npm  s    z!TestOperators.test_mod_errors_npmc                 C   s   dddddg}dddg}t jt jft jt jfg}| j|||||d dddg}dddg}t jt jft jt jft jt jfg}| j|||||d d S )Nr   r   r   r   rr   r   r   r   r   r   run_pow_ints  s"    







zTestOperators.run_pow_intsc                 C   s   ddddg}ddddd	g}t jt jft jt jfg}| j|||||d
 dg}ddd	g}t jt jft jt jfg}| j|||||d
 d S )Ngvkgv[gv[@gvk@r   r   r   r   r   rr   r   r   r   r   r   r   run_pow_floats  s     




zTestOperators.run_pow_floats)rT   rU   r   r   c                 C   sF   | j j}dddg}|}tjtjftjtjfg}| j|||||d d S )N      ?                      ?            rr   )r   r   r   r   r   r   r|   rs   r}   r~   r   r   r   r   r   test_add_complex  s    


zTestOperators.test_add_complexc                 C   s   | j td d S r   )r   r   r   r   r   r   test_add_complex_npm  s    z"TestOperators.test_add_complex_npmc                 C   sL   | j j}dddg}dddg}tjtjftjtjfg}| j|||||d d S Nr   r   r   r   r   r   rr   )r   r   r   r   r   r   r   r   r   r   test_sub_complex  s    



zTestOperators.test_sub_complexc                 C   s   | j td d S r   )r   r   r   r   r   r   test_sub_complex_npm  s    z"TestOperators.test_sub_complex_npmc                 C   sL   | j j}dddg}dddg}tjtjftjtjfg}| j|||||d d S r   )r   r    r   r   r   r   r   r   r   r   test_mul_complex  s    



zTestOperators.test_mul_complexc                 C   s   | j td d S r   )r   r   r   r   r   r   test_mul_complex_npm  s    z"TestOperators.test_mul_complex_npmc                 C   sL   | j j}dddg}dddg}tjtjftjtjfg}| j|||||d d S r   )r   r$   r   r   r   r   r   r   r   r   test_truediv_complex  s    



z"TestOperators.test_truediv_complexc                 C   s   | j td d S r   )r   r   r   r   r   r   test_truediv_complex_npm   s    z&TestOperators.test_truediv_complex_npmc              	   C   s2   | j j}|   t|tjtjf}W 5 Q R X d S r   )r   r&   r   r   r   r   )r|   rs   r}   r   r   r   r   test_mod_complex  s    
zTestOperators.test_mod_complexc                 C   s   | j td d S r   )r  r   r   r   r   r   test_mod_complex_npm  s    z"TestOperators.test_mod_complex_npmc                 C   sj   t |dtd}|j}td}td}|||}| |jd |rN| || n| || | || d S )Nr   rr   r         )r   r   rv   r   r   valuer   assertIsNot)r|   r}   inplacer   r   abr   r   r   r   check_matmul_objmode  s    
z"TestOperators.check_matmul_objmodec                 C   s   | j | jjdd d S )NFr  )r  r   r   r   r   r   r   test_matmul  s    zTestOperators.test_matmulc                 C   s   | j | jjdd d S )NTr  )r  r   r   r   r   r   r   test_imatmul!  s    zTestOperators.test_imatmulc                 C   s~   t t jdd}t|||ftd}|j}tddg}tddg}|||}| |t|| | 	|| | 	|| d S )Nr   Crr   r   r   r  )
r   ZArrayr   r   r   rv   r   rz   dotr  )r|   r}   Zarrtyr   r   r	  r
  r   r   r   r   check_matmul_npm$  s    
zTestOperators.check_matmul_npmc                 C   s   |  | jj d S r   )r  r   r   r   r   r   r   test_matmul_npm1  s    zTestOperators.test_matmul_npmc              	   C   s&   |   }| | jj W 5 Q R X d S r   )r   r  r   r   )r|   raisesr   r   r   test_imatmul_npm4  s    
zTestOperators.test_imatmul_npmc                 C   s   ddg}dddddddg}t jt jfg}| j|||||d ddg}ddddddd	d
g}t jt jfg}| j|||||d ddg}dddddddg}t jt jfg}| j|||||d ddg}ddddddd	d
g}t jt jfg}| j|||||d d S )Nr   r   r   r           rr       ?   r   r   r   r   r   r   r   r   r   r   r   run_bitshift_left<  s0    zTestOperators.run_bitshift_left)Zbitshift_leftZbitshift_ileftr   r  c                 C   s   dddg}dddddddg}t jt jfg}| j|||||d	 ddd
g}ddddddddg}t jt jfg}| j|||||d	 dddg}dddddddg}t jt jfg}| j|||||d	 dddg}ddddddddg}t jt jfg}| j|||||d	 d S )Nr   r       r   r  r  r  r  rr       r  r     r   r  r   r   r   r   run_bitshift_rightb  s0    



z TestOperators.run_bitshift_right)Zbitshift_rightZbitshift_irightr  c                 C   s4  t tdddg }t tdddg }tjtjfg}| j|||||d t tdddg }t tdddg }tjtjfg}| j|||||d t tdddd	g }t tdddd	g }tjtjfg}| j|||||d t tddd
dg }t tddd
dg }tjtjfg}| j|||||d d S )Nr   r  r  rr   r  r  r               )listranger   r   r   r   r   r   r   r   r   r   run_logical  s0    zTestOperators.run_logical)Zbitwise_andZbitwise_iandZ
bitwise_orZbitwise_iorZbitwise_xorZbitwise_ixorr&  r   )r   Zboolsc           
      C   sx  | j j}ttdddg }dd |D }dg}tjtjfg}| j|||||d ttddd	d
g }dg}tjtjfg}| j|||||d ttdddg }dd |D }dg}tjtjfg}| j|||||d ttddddg }dg}tj	tj	fg}| j|||||d ddddg}tt
tj|}| j j}t|tjf|d}|j}|D ]}	| ||	||	 qXd S )Nr   r  r  c                 S   s   g | ]}t |qS r   )r   r   .0r   r   r   r   
<listcomp>  s     z2TestOperators.test_bitwise_not.<locals>.<listcomp>rr   r   r  r  r!  r  c                 S   s   g | ]}t |qS r   )r   r   r'  r   r   r   r)    s     r"  r#  FT)r   r4   r$  r%  r   r   r   r   r   r   mapr   Zbool_r5   r   r   rv   rz   )
r|   rs   r}   r~   r   r   valuesr   r   valr   r   r   test_bitwise_not  sD    zTestOperators.test_bitwise_notc                 C   s   | j td d S r   )r-  r   r   r   r   r   test_bitwise_not_npm  s    z"TestOperators.test_bitwise_not_npmc                    s\    fdd}ddddddd	d
dddg}|D ],}t  j|}||tjtjf j| d q*dS )zI
        Make sure that bitwise float operations are not allowed
        c              	      sl   d | } jtj|d}t| | W 5 Q R X td }| t|trJ|nd |} |t|j	 d S )Nz'expecting TypingError when compiling {}rt   z {}zFunction({}))
formatr   r   ZTypingErrorr   r	   
isinstancer   r   r   )r}   Zargtypesopnameru   r  fmtZ	expectingr   r   r   assert_reject_compile  s    
z?TestOperators.test_bitwise_float.<locals>.assert_reject_compiler)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r4   )r1  N)r   r   r   r   _bitwise_opnames)r|   r3  methodsnamer}   r   r   r   test_bitwise_float  s$    z TestOperators.test_bitwise_floatc                 C   sL   | j j}dddddg}t|dtd}|j}|D ]}| |||| q.d S )Nr   r   r   333333?        333333@r   rr   )r   r6   r   r   rv   r   r|   r}   r+  r   r   r,  r   r   r   test_not
  s    zTestOperators.test_notc                 C   s~   | j j}tjtjtjtjtjg}dddddg}t||D ]@\}}t	||g}| 
|jjtj |j}| 
|||| q8d S )Nr   r   r   r8  r9  )r   r6   r   int8r   r   r   r   zipr   r   	signaturereturn_typer   rv   r|   r}   Zargtysr+  tyr,  r   r   r   r   r   test_not_npm  s$    zTestOperators.test_not_npmc                 C   s~   | j j}tjtjtjtjtjtjtj	tj	g}ddddddddg}t
||D ].\}}t||g}|j}| |||| qJd S 	Nr   r   r   r8  g333333@r9  TF)r   r7   r   r<  r   r   r   r   r   r   r=  r   rv   assertAlmostEqualr@  r   r   r   test_negate_npm3  s.    
zTestOperators.test_negate_npmc                 C   sP   | j j}dddddddg}t|dtd	}|j}|D ]}| |||| q2d S 
Nr   r   r   r8  r9  TFr   rr   )r   r7   r   r   rv   r   r:  r   r   r   test_negateP  s    	zTestOperators.test_negatec                 C   s~   | j j}tjtjtjtjtjtjtj	tj	g}ddddddddg}t
||D ].\}}t||g}|j}| |||| qJd S rC  )r   r8   r   r<  r   r   r   r   r   r   r=  r   rv   rD  r@  r   r   r   test_unary_positive_npm`  s.    
z%TestOperators.test_unary_positive_npmc                 C   sP   | j j}dddddddg}t|dtd	}|j}|D ]}| |||| q2d S rF  )r   r8   r   r   rv   r   r:  r   r   r   test_unary_positive|  s    	z!TestOperators.test_unary_positivec                 C   sP   t j}t||t |df|d}|j}dD ] }d}| |||||| q*d S )Nr   rr   )r   r        *   )r   rL  rJ  )r   r   r   ZUniTuplerv   rz   )r|   r}   rs   r   r   r   itupr   r   r   	_check_in  s    zTestOperators._check_inc                 C   s   |  | jj| d S r   )rO  r   r?   r   r   r   r   test_in  s    zTestOperators.test_inc                 C   s   | j td d S r   )rP  r   r   r   r   r   test_in_npm  s    zTestOperators.test_in_npmc                 C   s   |  | jj| d S r   )rO  r   r@   r   r   r   r   test_not_in  s    zTestOperators.test_not_inc                 C   s   | j td d S r   )rR  r   r   r   r   r   test_not_in_npm  s    zTestOperators.test_not_in_npmN)F)drB   rC   rD   __doc__r   r   rG   rX   rY   rZ   r[   r\   r]   r^   r_   r`   ra   rc   r4  r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   localsr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r  r  r   r  r  r  r  r  r&  r-  r.  r7  r;  rB  rE  rG  rH  rI  rO  rP  rQ  rR  rS  r   r   r   r   rp   l  s  


  	




!!!0"	rp   c                   @   sB   e Zd ZeZejejejej	ej
ejejejejejejdZdS )TestOperatorModulerq   N)rB   rC   rD   rF   r   rG   rX   rY   rZ   r[   r\   r]   r^   r_   r`   ra   rc   r4  r   r   r   r   rV    s   rV  c                   @   sf  e Zd ZdZeZdddddddd	d
ddddgZejej	ej
ejgZdd eD Zdd eD ZeeeeZdd eD Zdd eD Zdd Zdd Zdd Zdd Zdd Zedd fd d!Zefd"d#Zed$d fd%d&Zd'd( Zd)d* Zd+d, Z d-d. Z!d/d0 Z"d1d2 Z#d3d4 Z$d5d6 Z%d7d8 Z&d9d: Z'd;d< Z(d=d> Z)d?d@ Z*dAdB Z+dCdD Z,dEdF Z-dGS )HTestMixedIntsz<
    Tests for operator calls with mixed integer types.
    r   r   r   
   rL     i'  r   r   iiiic                 C   s   g | ]}|j r|qS r   signedr(  r   r   r   r   r)    s      zTestMixedInts.<listcomp>c                 C   s   g | ]}|j s|qS r   rZ  r\  r   r   r   r)    s      c                 C   s$   g | ]\}}|j s|j r||fqS r   rZ  r(  uvr   r   r   r)    s     c                 C   s$   g | ]\}}|j s|j s||fqS r   rZ  r]  r   r   r   r)    s     c                 G   s.   t dd |D }t |tjj}ttd| S )Nc                 s   s   | ]}|j jd  V  qdS r  Nr   itemsizer(  r_  r   r   r   	<genexpr>  s     z8TestMixedInts.get_numpy_signed_upcast.<locals>.<genexpr>zint%dmaxr   intpbitwidthr   r   r|   valsrh  r   r   r   get_numpy_signed_upcast  s    z%TestMixedInts.get_numpy_signed_upcastc                 G   s.   t dd |D }t |tjj}ttd| S )Nc                 s   s   | ]}|j jd  V  qdS r`  ra  rc  r   r   r   rd    s     z:TestMixedInts.get_numpy_unsigned_upcast.<locals>.<genexpr>zuint%dre  ri  r   r   r   get_numpy_unsigned_upcast  s    z'TestMixedInts.get_numpy_unsigned_upcastc                 C   s   t t|j|S r   )r   r   r6  )r|   r   r,  r   r   r   get_typed_int  s    zTestMixedInts.get_typed_intc                    s   t t|  fdd}|S )Nc                    s    | |} || ||S r   rk  r	  r
  r   r   r|   r   r   control_signed  s    z8TestMixedInts.get_control_signed.<locals>.control_signedr   rG   )r|   r1  rq  r   rp  r   get_control_signed  s    
z TestMixedInts.get_control_signedc                    s   t t|  fdd}|S )Nc                    s    | |} || ||S r   rl  ro  rp  r   r   control_unsigned  s    z<TestMixedInts.get_control_unsigned.<locals>.control_unsignedrr  )r|   r1  ru  r   rp  r   get_control_unsigned  s    
z"TestMixedInts.get_control_unsignedc                 C   s   | S r   r   r   r   r   r   <lambda>      zTestMixedInts.<lambda>c                 K   s   |D ]\}}	t |||	ftd}
|
j}t||D ]|\}}| ||}| |	|}|||}|||}| || d||||	ff }|||| }}| j||fd|i| q0qd S )Nrr   #mismatch for (%r, %r) with types %sru   )r   r   rv   rw   rx   rm  assertIsInstancerz   )r|   r}   control_funcoperandsr   expected_type
force_typeassertPreciseEqualArgsxtytr   r   r   r   r   r   ru   r   r   r   
run_binary  s     

zTestMixedInts.run_binaryc              
   C   sr   |D ]h}t ||ftd}|j}|D ]H}	| ||	}	||	}
||	}| || | j||
d|	|||
f d q"qd S )Nrr   z&mismatch for %r with type %s: %r != %rrt   )r   r   rv   rm  rz  rz   )r|   r}   r{  r|  r   r}  r  r   r   r   r   r   r   r   r   	run_unary  s     
zTestMixedInts.run_unaryc                 C   s   | S r   r   r   r   r   r   rw    rx  c                 K   sP   | j || ||| j|fd|i| | j || ||| j|fd|i| d S )Nr~  )r  rs  signed_pairsrv  unsigned_pairs)r|   r}   r1  samplesr}  r~  r  r   r   r   run_arith_binop  s$        zTestMixedInts.run_arith_binopc                 C   s   |  | jjd| j d S )NrH   )r  r   r   int_samplesr   r   r   r   test_add  s    zTestMixedInts.test_addc                 C   s   |  | jjd| j d S )NrJ   )r  r   r   r  r   r   r   r   test_sub  s    zTestMixedInts.test_subc                 C   s   |  | jjd| j d S )NrL   )r  r   r    r  r   r   r   r   test_mul  s    zTestMixedInts.test_mulc                 C   s&   dd | j D }| | jjd| d S )Nc                 S   s   g | ]}|d kr|qS r   r   r'  r   r   r   r)    s      z/TestMixedInts.test_floordiv.<locals>.<listcomp>rN   )r  r  r   r"   r|   r  r   r   r   test_floordiv  s    zTestMixedInts.test_floordivc                 C   s&   dd | j D }| | jjd| d S )Nc                 S   s   g | ]}|d kr|qS r  r   r'  r   r   r   r)    s      z*TestMixedInts.test_mod.<locals>.<listcomp>rR   )r  r  r   r&   r  r   r   r   test_mod  s    zTestMixedInts.test_modc                    s   i }t jdkrt|d<  jj}dd  jD } j|d|f|  fdd}dd  jD }d	d  jD } j||||f| d S )
N)r      r~  c                 S   s   g | ]}|d kr|qS r  r   r'  r   r   r   r)  (  s      z*TestMixedInts.test_pow.<locals>.<listcomp>rT   c                    sT     | |}|dkr$|| || S || ||  }|dkrBdS td| S d S )Nr   g      ?)rk  r   rg  )r	  r
  r   invr   r   r   rq  ,  s    z.TestMixedInts.test_pow.<locals>.control_signedc                 S   s   g | ]}|d kr|qS r  r   r'  r   r   r   r)  6  s      c                 S   s$   g | ]\}}|j r|j r||fqS r   rZ  r]  r   r   r   r)  7  s     )	r   Z	PYVERSIONr   r   r   r  r  
type_pairsr  )r|   Z
extra_castr}   r  rq  r  r   r   r   test_pow!  s    

 zTestMixedInts.test_powc                 C   sT   dd }dd | j D }| jj}| j|||| jtdd | j|||| jtdd d S )Nc                 S   s   t | t | S r   )r   r	  r
  r   r   r   control>  s    z+TestMixedInts.test_truediv.<locals>.controlc                 S   s   g | ]}|d kr|qS r  r   r'  r   r   r   r)  @  s      z.TestMixedInts.test_truediv.<locals>.<listcomp>double)r}  prec)r  r   r$   r  r  r   r  r|   r  r  r}   r   r   r   test_truediv<  s      zTestMixedInts.test_truedivc                 C   s   |  | jjd| j d S )Nr\   )r  r   r-   r  r   r   r   r   test_andK  s    zTestMixedInts.test_andc                 C   s   |  | jjd| j d S )Nr^   )r  r   r/   r  r   r   r   r   test_orN  s    zTestMixedInts.test_orc                 C   s   |  | jjd| j d S )Nr`   )r  r   r1   r  r   r   r   r   test_xorQ  s    zTestMixedInts.test_xorc           
         s   t t|  fdd} fdd}jfdd}dd jD }d	d jD }|D ]\}}	|||	| q`|D ]\}}	|||	| qzd S )
Nc                    s    | |} || ||S r   rn  ro  opfuncr|   r   r   rq  V  s    z5TestMixedInts.run_shift_binop.<locals>.control_signedc                    s    | |} || ||S r   rt  ro  r  r   r   ru  Y  s    z7TestMixedInts.run_shift_binop.<locals>.control_unsignedc                    s   t  | |ftd}|j}D ]v}| jd }dddd|d |fD ]R}| |}||}|||}|||}	d||| |ff }
j|	||
d q>qd S )Nrr   r   r   r   rJ  ry  rt   )r   r   rv   rh  rm  rz   )r  r  r{  r   r   r   Zmaxshiftr   r   r   ru   )r}   r  r|   r   r   check_  s    


z,TestMixedInts.run_shift_binop.<locals>.checkc                 S   s   g | ]\}}|j r||fqS r   rZ  r]  r   r   r   r)  r  s    z1TestMixedInts.run_shift_binop.<locals>.<listcomp>c                 S   s   g | ]\}}|j s||fqS r   rZ  r]  r   r   r   r)  t  s    )r   rG   r  r  )
r|   r}   r1  rq  ru  r  r  r  r  r  r   )r  r}   r  r|   r   run_shift_binopT  s    
zTestMixedInts.run_shift_binopc                 C   s   |  | jjd d S )NrX   )r  r   r)   r   r   r   r   test_lshift|  s    zTestMixedInts.test_lshiftc                 C   s   |  | jjd d S )NrZ   )r  r   r+   r   r   r   r   test_rshift  s    zTestMixedInts.test_rshiftc                 C   s,   dd }| j }| jj}| |||| j d S )Nc                 S   s   | S r   r   r	  r   r   r   r    s    z2TestMixedInts.test_unary_positive.<locals>.control)r  r   r8   r  	int_typesr  r   r   r   rI    s    z!TestMixedInts.test_unary_positivec                    sN    fdd} fdd} j } jj} ||| j  ||| j d S )Nc                    s     | }||  S r   rn  r	  r   r   r   r   rq    s    
z9TestMixedInts.test_unary_negative.<locals>.control_signedc                    s     | }||  S r   rt  r  r   r   r   ru    s    
z;TestMixedInts.test_unary_negative.<locals>.control_unsigned)r  r   r7   r  signed_typesunsigned_typesr|   rq  ru  r  r}   r   r   r   test_unary_negative  s    z!TestMixedInts.test_unary_negativec                    sN    fdd} fdd} j } jj} ||| j  ||| j d S )Nc                    s     | }||  S r   rn  r  r   r   r   rq    s    
z1TestMixedInts.test_invert.<locals>.control_signedc                    s     | }||  S r   rt  r  r   r   r   ru    s    
z3TestMixedInts.test_invert.<locals>.control_unsigned)r  r   r5   r  r  r  r  r   r   r   test_invert  s    zTestMixedInts.test_invertN).rB   rC   rD   rT  r   r   r  r   r<  Zuint8r   r   r  r  r  r$  rw   rx   r  r  r  rk  rl  rm  rs  rv  r   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  rI  r  r  r   r   r   r   rW    sL    

 
(rW  c                   @   s   e Zd ZeZdS )TestMixedIntsOperatorModuleN)rB   rC   rD   rF   r   r   r   r   r   r    s   r  c                   @   s(   e Zd ZdZdd Zdd Zdd ZdS )	TestStaticPowerz`
    Test the ** operator with a static exponent, to exercise a
    dedicated optimization.
    c                 C   s   |D ]}t j}t|}tdd|}tdd|}|D ]^}z|||}	W n2 tk
rz   | t || W 5 Q R X Y q6X ||}
| j|	|
dd q6qd S )NTr   r  )r  )r   r   r   r   r   r   rz   )r|   	exponentsr+  r   Zregular_funcZstatic_funcZstatic_cfuncZregular_cfuncr_  r   r   r   r   r   
_check_pow  s    zTestStaticPower._check_powc              	   C   sD   ddddddddd	g	}ddddd
t d	t dg}| || d S )Nr   r   r   rJ     r   r   r   r   r   r  )r   r<  Zuint16r  r|   r  rj  r   r   r   test_int_values  s    zTestStaticPower.test_int_valuesc                 C   sH   ddddddddd	d
dg}dddt dtdtdg}| || d S )Nr   r   r   rJ  r  r   r   r   r   i ir   g      
@g      g       infnan)r   r   r   r  r  r   r   r   test_real_values  s    z TestStaticPower.test_real_valuesN)rB   rC   rD   rT  r  r  r  r   r   r   r   r    s   r  c                   @   s    e Zd ZdZdd Zdd ZdS )TestStringConstComparisonz-
    Test comparison of string constants
    c                 C   sP   dd }dd }t dd|}t dd|}| | |  | | |  d S )Nc                  S   s   d} | dkS Ntestr   sr   r   r   
test_impl1  s    z5TestStringConstComparison.test_eq.<locals>.test_impl1c                  S   s   d} | dkS NZtest1r  r   r  r   r   r   
test_impl2  s    z5TestStringConstComparison.test_eq.<locals>.test_impl2Tr   r   r   r|   r  r  cfunc1cfunc2r   r   r   test_eq  s    z!TestStringConstComparison.test_eqc                 C   sP   dd }dd }t dd|}t dd|}| | |  | | |  d S )Nc                  S   s   d} | dkS r  r   r  r   r   r   r    s    z6TestStringConstComparison.test_neq.<locals>.test_impl1c                  S   s   d} | dkS r  r   r  r   r   r   r    s    z6TestStringConstComparison.test_neq.<locals>.test_impl2Tr   r  r  r   r   r   test_neq  s    z"TestStringConstComparison.test_neqN)rB   rC   rD   rT  r  r  r   r   r   r   r    s   r  c                   @   s@   e Zd ZdZdd Zdd Zdd Zdd	 Zd
d Zdd Z	dS )TestBooleanLiteralOperatorsz/
    Test operators with Boolean constants
    c           	         s    fdd}fdd}dd }t jddgd	d
D ]*\ }tdd|}| |||| q2t jddgd	d
D ]*\}tdd|}| |||| qptdd|}| | |  d S )Nc                    s    | kS r   r   r
  a_valr   r   r    s    z7TestBooleanLiteralOperators.test_eq.<locals>.test_impl1c                    s   |  kS r   r   r  b_valr   r   r    s    z7TestBooleanLiteralOperators.test_eq.<locals>.test_impl2c                  S   s,   ddk} ddk}ddk}ddk}| |||fS NTFr   r1r2Zr3Zr4r   r   r   
test_impl3  s
    z7TestBooleanLiteralOperators.test_eq.<locals>.test_impl3TFr   repeatr   rw   rx   r   r   	r|   r  r  r  r
  r  r	  r  Zcfunc3r   r  r  r   r    s    z#TestBooleanLiteralOperators.test_eqc           	         s    fdd}fdd}dd }t jddgd	d
D ]*\ }tdd|}| |||| q2t jddgd	d
D ]*\}tdd|}| |||| qptdd|}| | |  d S )Nc                    s    | kS r   r   r  r  r   r   r    s    z7TestBooleanLiteralOperators.test_ne.<locals>.test_impl1c                    s   |  kS r   r   r  r  r   r   r    s    z7TestBooleanLiteralOperators.test_ne.<locals>.test_impl2c                  S   s,   ddk} ddk}ddk}ddk}| |||fS r  r   r  r   r   r   r    s
    z7TestBooleanLiteralOperators.test_ne.<locals>.test_impl3TFr   r  r   r  r  r   r  r   test_ne  s    z#TestBooleanLiteralOperators.test_nec                    st    fdd}dd }t jddgddD ]*\ }tdd	|}| |||| q&tdd	|}| | |  d S )
Nc                    s    | kS r   r   r  r  r   r   r  (  s    z7TestBooleanLiteralOperators.test_is.<locals>.test_impl1c                  S   s,   ddk} ddk}ddk}ddk}| |||fS r  r   r  r   r   r   r  +  s
    z7TestBooleanLiteralOperators.test_is.<locals>.test_impl2TFr   r  r   r  )r|   r  r  r
  r  r  r   r  r   test_is&  s    z#TestBooleanLiteralOperators.test_isc                 C   s*   dd }t dd|}| | |  d S )Nc                  S   s   d\} }|  | fS Nr   r   r  r   r   r   	test_impl;  s    z7TestBooleanLiteralOperators.test_not.<locals>.test_implTr   r  r|   r  r   r   r   r   r;  9  s    z$TestBooleanLiteralOperators.test_notc                 C   s*   dd }t dd|}| | |  d S )Nc                  S   s   d\} }t | t |fS r  )boolr  r   r   r   r  D  s    z8TestBooleanLiteralOperators.test_bool.<locals>.test_implTr   r  r  r   r   r   	test_boolB  s    z%TestBooleanLiteralOperators.test_boolc                 C   s*   dd }t dd|}| | |  d S )Nc                  S   s   d\} }t | t |fS r  )r   r  r   r   r   r  M  s    z?TestBooleanLiteralOperators.test_bool_to_str.<locals>.test_implTr   r  r  r   r   r   test_bool_to_strK  s    z,TestBooleanLiteralOperators.test_bool_to_strN)
rB   rC   rD   rT  r  r  r  r;  r  r  r   r   r   r   r    s   		r  __main__),ry   rw   rG   syswarningsnumpyr   ZunittestZnumba.core.compilerr   r   Znumbar   Z
numba.corer   r   r   r   Znumba.core.types.functionsr	   Znumba.tests.supportr
   r   r   Znumba.tests.matmul_usecaser   r   r   r   r   Zforce_pyobjectr   objectr   rF   rp   rV  rW  r  r  r  r  rB   mainr   r   r   r   <module>   sH    , $      < q$ g
