Your IP : 216.73.216.213


Current Path : /opt/alt/python35/lib64/python3.5/test/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/test/__pycache__/test_operator.cpython-35.opt-1.pyc



��Yf[�@s�ddlZddlZddlZddlmZejdddg�Zejdddg�ZGdd�d�ZGd	d
�d
e	�Z
Gdd�d�ZGd
d�deej�Z
ejed�Gdd�deej��ZGdd�d�ZGdd�deej�Zejed�Gdd�deej��Zejed�Gdd�deej��Zejed�Gdd�deej��Zedkr�ej�dS)�N)�support�operatorZblocked�	_operatorZfreshc@sXeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�Seq1cCs
||_dS)N)�lst)�selfr�r�7/opt/alt/python35/lib64/python3.5/test/test_operator.py�__init__sz
Seq1.__init__cCs
t|j�S)N)�lenr)rrrr	�__len__
szSeq1.__len__cCs|j|S)N)r)r�irrr	�__getitem__szSeq1.__getitem__cCs|j|jS)N)r)r�otherrrr	�__add__szSeq1.__add__cCs|j|S)N)r)rrrrr	�__mul__szSeq1.__mul__cCs||jS)N)r)rrrrr	�__rmul__sz
Seq1.__rmul__N)	�__name__�
__module__�__qualname__r
rrrrrrrrr	r
src@sXeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�Seq2cCs
||_dS)N)r)rrrrr	r
sz
Seq2.__init__cCs
t|j�S)N)rr)rrrr	rszSeq2.__len__cCs|j|S)N)r)rr
rrr	rszSeq2.__getitem__cCs|j|jS)N)r)rrrrr	rszSeq2.__add__cCs|j|S)N)r)rrrrr	r!szSeq2.__mul__cCs||jS)N)r)rrrrr	r#sz
Seq2.__rmul__N)	rrrr
rrrrrrrrr	rsrc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Z d=d>�Z!d?d@�Z"dAdB�Z#dCdD�Z$dEdF�Z%dGdH�Z&dIdJ�Z'dKdL�Z(dMdN�Z)dOS)P�OperatorTestCasecCs�|j}|jt|j�|jt|jdd�|j|jdd��|j|jdd��|j|jdd��|j|jdd��|j|jdd��|j|jdd��dS)	Ny�?y@�rgg�?�g@)�module�assertRaises�	TypeError�lt�assertFalse�
assertTrue)rrrrr	�test_lt(s	zOperatorTestCase.test_ltcCs�|j}|jt|j�|jt|jdd�|j|jdd��|j|jdd��|j|jdd��|j|jdd��|j|jdd��|j|jdd��dS)	Ny�?y@rrgg�?rg@)rrr�lerr)rrrrr	�test_le3s	zOperatorTestCase.test_lecCs�|j}Gdd�dt�}|jt|j�|jt|j|�|��|j|jdd��|j|jdd��|j|jdd��|j|jdd��|j|jdd��|j|jdd��dS)	Nc@seZdZdd�ZdS)z#OperatorTestCase.test_eq.<locals>.CcSs
t�dS)N)�SyntaxError)rrrrr	�__eq__Asz*OperatorTestCase.test_eq.<locals>.C.__eq__N)rrrr$rrrr	�C@sr%rrgg�?rg@)r�objectrr�eqr#rr)rrr%rrr	�test_eq>s	zOperatorTestCase.test_eqcCs�|j}Gdd�dt�}|jt|j�|jt|j|�|��|j|jdd��|j|jdd��|j|jdd��|j|jdd��|j|jdd��|j|jdd��dS)	Nc@seZdZdd�ZdS)z#OperatorTestCase.test_ne.<locals>.CcSs
t�dS)N)r#)rrrrr	�__ne__Osz*OperatorTestCase.test_ne.<locals>.C.__ne__N)rrrr)rrrr	r%Nsr%rrgg�?rg@)rr&rr�ner#rr)rrr%rrr	�test_neLs	zOperatorTestCase.test_necCs�|j}|jt|j�|jt|jdd�|j|jdd��|j|jdd��|j|jdd��|j|jdd��|j|jdd��|j|jdd��dS)	Ny�?y@rrgg�?rg@)rrr�gerr)rrrrr	�test_geZs	zOperatorTestCase.test_gecCs�|j}|jt|j�|jt|jdd�|j|jdd��|j|jdd��|j|jdd��|j|jdd��|j|jdd��|j|jdd��dS)	Ny�?y@rrgg�?rg@)rrr�gtrr)rrrrr	�test_gtes	zOperatorTestCase.test_gtcCsh|j}|jt|j�|jt|jd�|j|jd�d�|j|jd�d�dS)Nr���)rrr�abs�assertEqual)rrrrr	�test_absps
	zOperatorTestCase.test_abscCsX|j}|jt|j�|jt|jdd�|j|jdd�dk�dS)N���)rrr�addr)rrrrr	�test_addws	zOperatorTestCase.test_addcCsX|j}|jt|j�|jt|jdd�|j|jdd�dk�dS)N��
)rrr�and_r)rrrrr	�test_bitwise_and}s	z!OperatorTestCase.test_bitwise_andcCs"|j}|jt|j�|jt|jdd�|j|jdd�dk�|j|jddgddg�ddddgk�|j|jtdd	g�td
g��dd	d
gk�|j|jtdd	g�td
g��dd	d
gk�|jt|jdd�dS)
N�pyZthon�pythonrrr4r5��r6�
�)rrr�concatrrr)rrrrr	�test_concat�s	7==zOperatorTestCase.test_concatcCs�|j}|jt|j�|jt|jdd�|j|jddddddgd�dk�|j|jddddddgd�dk�dS)Nrrr4r5r?r)rrr�countOfr)rrrrr	�test_countOf�s
	1zOperatorTestCase.test_countOfcCs�|j}ddddg}|jt|j|�|jt|j|d�|j|j|d�dk�|j|dddgk�dS)Nr5r4rr)rrr�delitemr)rr�arrr	�test_delitem�s	zOperatorTestCase.test_delitemcCs[|j}|jt|jd�|jt|jdd�|j|jdd�dk�dS)Nr?r)rrr�floordivr)rrrrr	�
test_floordiv�s	zOperatorTestCase.test_floordivcCs[|j}|jt|jd�|jt|jdd�|j|jdd�dk�dS)Nr?rg@)rrr�truedivr)rrrrr	�test_truediv�s	zOperatorTestCase.test_truedivcCsd|j}td�}|jt|j�|jt|j|d�|j|j|d�dk�dS)Nr:r)r�rangerr�getitemr)rrrHrrr	�test_getitem�s
	zOperatorTestCase.test_getitemcCs�|j}|jt|j�|jt|jdd�|j|jddddgd�dk�|jt|jddddgd�dS)Nr5r4rrr)rrr�indexOfr�
ValueError)rrrrr	�test_indexOf�s
	+zOperatorTestCase.test_indexOfcCsO|j}|jt|j�|jt|jd�|j|jd�d�dS)Nr5r?���)rrr�invertr2�inv)rrrrr	�test_invert�s	zOperatorTestCase.test_invertcCs�|j}|jt|j�|jt|jdd�|j|jdd�dk�|j|jdd�dk�|jt|jdd�dS)N�*r?rr:rrr0)rrr�lshiftrrR)rrrrr	�test_lshift�s	zOperatorTestCase.test_lshiftcCsX|j}|jt|j�|jt|jdd�|j|jdd�dk�dS)NrXr?rr)rrr�modr)rrrrr	�test_mod�s	zOperatorTestCase.test_modcCsX|j}|jt|j�|jt|jdd�|j|jdd�dk�dS)Nr?rr:)rrr�mulr)rrrrr	�test_mul�s	zOperatorTestCase.test_mulcCsc|j}|jt|j�|jt|jdd�Gdd�d�}|j|�dd�dS)NrXc@seZdZdd�ZdS)z'OperatorTestCase.test_matmul.<locals>.McSs|dS)Nrr)rrrrr	�
__matmul__�sz2OperatorTestCase.test_matmul.<locals>.M.__matmul__N)rrrr_rrrr	�M�sr`�))rrr�matmulr2)rrr`rrr	�test_matmul�s
	zOperatorTestCase.test_matmulcCs�|j}|jt|j�|jt|jd�|j|jd�d�|j|jd�d�|j|jd�d�|j|jd�d�dS)Nr?rrTrTr)rrr�negr2)rrrrr	�test_neg�s	zOperatorTestCase.test_negcCsX|j}|jt|j�|jt|jdd�|j|jdd�dk�dS)Nr:r?r9)rrr�or_r)rrrrr	�test_bitwise_or�s	z OperatorTestCase.test_bitwise_orcCs�|j}|jt|j�|jt|jd�|j|jd�d�|j|jd�d�|j|jd�d�|j|jd�d�dS)Nr?rrTrTr)rrr�posr2)rrrrr	�test_pos�s	zOperatorTestCase.test_poscCs�|j}|jt|j�|jt|jdd�|j|jdd�d�|jt|jd�|jt|jddd�dS)Nr4r?rr��)rrr�powr2)rrrrr	�test_pow�s	zOperatorTestCase.test_powcCs�|j}|jt|j�|jt|jdd�|j|jdd�dk�|j|jdd�dk�|jt|jdd�dS)NrXr?rrrr0)rrr�rshiftrrR)rrrrr	�test_rshift�s	zOperatorTestCase.test_rshiftcCsw|j}|jt|j�|jt|jdd�|j|jtd�d��|j|jtd�d��dS)Nr5rr?)rrr�containsrrNr)rrrrr	�
test_containss
	zOperatorTestCase.test_containscCs�|j}ttd��}|jt|j|�|jt|j|dd�|j|j|dd�dk�|j|dddgk�|jt|j|dd�dS)Nr4rrrr5)r�listrNrr�setitemr�
IndexError)rrrHrrr	�test_setitems	"zOperatorTestCase.test_setitemcCsX|j}|jt|j�|jt|jdd�|j|jdd�dk�dS)Nr?rr4)rrr�subr)rrrrr	�test_subs	zOperatorTestCase.test_subcCs�|j}Gdd�dt�}|jt|j�|jt|j|��|j|jd��|j|jdg��|j|jd��|j|jg��dS)Nc@seZdZdd�ZdS)z&OperatorTestCase.test_truth.<locals>.CcSs
t�dS)N)r#)rrrr	�__bool__sz/OperatorTestCase.test_truth.<locals>.C.__bool__N)rrrrwrrrr	r%sr%r?r)rr&rr�truthr#rr)rrr%rrr	�
test_truths	zOperatorTestCase.test_truthcCsX|j}|jt|j�|jt|jdd�|j|jdd�dk�dS)N��r6)rrr�xorr)rrrrr	�test_bitwise_xor#s	z!OperatorTestCase.test_bitwise_xorcCsz|j}d}}|dd�|dd�}|jt|j�|j|j||��|j|j||��dS)N�xyzpdqr4)rrr�is_rr)rrrH�b�crrr	�test_is)s	
zOperatorTestCase.test_iscCsz|j}d}}|dd�|dd�}|jt|j�|j|j||��|j|j||��dS)Nr~r4)rrr�is_notrr)rrrHr�r�rrr	�test_is_not1s	
zOperatorTestCase.test_is_notcCs�|j}Gdd�d�}|�}d|_|jd�}|j||�d�|jt|�|jt||d�|jt||dd�|jd�}|jt||�|jt|jd�|jt|j�|�}d	|_d
|_d|_	|j|jdd
d�|�d�|jt|jdfdf�Gdd�dt
�}|jt|jd�|��|�}d|_|�|_d|j_|jd�}|j||�d�|jt||j�|jdd�}|j||�d�|jddd�}|jt||�|jd�}|jt||�|jd�}|jt||�|�|j_d|jj_|jd�}|j||�d�|jddd�}|j||�d�dS)Nc@seZdZdS)z+OperatorTestCase.test_attrgetter.<locals>.AN)rrrrrrr	�A;sr��arthur�nameZdentZsurnameZrankr�X�Y�Z�x�z�yc@seZdZdd�ZdS)z+OperatorTestCase.test_attrgetter.<locals>.CcSs
t�dS)N)r#)rr�rrr	�__getattr__Rsz7OperatorTestCase.test_attrgetter.<locals>.C.__getattr__N)rrrr�rrrr	r%Qsr%�foo�thomasz
child.namezchild.child.namezchild.z.child�johnson)r�r�r�)r�r�)r�r�r�)
rr��
attrgetterr2rr�AttributeErrorr�r�r�r&r#Zchild)rrr�rH�f�recordr%rrr	�test_attrgetter9sT							%		z OperatorTestCase.test_attrgetterc	Cs/|j}d}|jd�}|j||�d�|jt|�|jt||d�|jt||dd�|jd�}|jt||�Gdd�dt�}|jt|jd�|��|jd	�}|jt||�|jt|j�td
d�}|jd
�}|j||�d�|jd�}|jt	||�ddddg}|jd�}|jt
t||��ddddg�|jt|d
|�ddddg�t
tt
td���}|j|jddd�|�d �|jt|jddd�|�dS)!N�ABCDErr%r4�sizer:c@seZdZdd�ZdS)z+OperatorTestCase.test_itemgetter.<locals>.CcSs
t�dS)N)r#)rr�rrr	rzsz7OperatorTestCase.test_itemgetter.<locals>.C.__getitem__N)rrrrrrrr	r%ysrXr��key�valZnonkey�apple�banana�pearr?�oranger��2�10�5r�)r�r4)r�r)r�r?)r�r)r�r)r�r)r�r4)r�r?)r�r�r�)r�
itemgetterr2rrrsr&r#�dict�KeyErrorrq�map�sorted�strrN)	rrrHr�r%�dZ	inventoryZgetcount�datarrr	�test_itemgetterns6	+%z OperatorTestCase.test_itemgettercCsu|j}|jt|j�|jt|jd�Gdd�d�}|�}|jd�}|jt||�|jddd�}|j||�d�|jt|�|jt||d�|jt||dd�|jd	�}|j||�d
�|jt|||�|jd	dd�}|j||�d�|jd
dddd�}|j||�d�dS)Nr{c@s7eZdZdd�Zddd�Zdd�ZdS)	z-OperatorTestCase.test_methodcaller.<locals>.Ac_s|d|dS)Nrrr)r�args�kwdsrrr	r��sz1OperatorTestCase.test_methodcaller.<locals>.A.foorXcSs|S)Nr)rr�rrr	�bar�sz1OperatorTestCase.test_methodcaller.<locals>.A.barc_s|d|dfS)Nr�rr)r�r�rrr	�baz�sz1OperatorTestCase.test_methodcaller.<locals>.A.bazN)rrrr�r�r�rrrr	r��sr�r�rrr4�spamr�rXr�r?r�r�r�eggs)r�r�)rrr�methodcallerrsr2)rrr�rHr�rrr	�test_methodcaller�s&		z"OperatorTestCase.test_methodcallercCs�|j}Gdd�dt�}|�}|j|j|d�d�|j|j|d�d�|j|j|d�d�|j|j|d�d�|j|j|d�d�|j|j|d�d	�|j|j	|d�d
�|j|j
|d�d�|j|j|d�d�|j|j|d�d
�|j|j
|d�d�|j|j|d�d�|j|j|d�d�|j|j||�d�dS)Nc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)z(OperatorTestCase.test_inplace.<locals>.CcSsdS)N�iaddr)rrrrr	�__iadd__�sz1OperatorTestCase.test_inplace.<locals>.C.__iadd__cSsdS)N�iandr)rrrrr	�__iand__�sz1OperatorTestCase.test_inplace.<locals>.C.__iand__cSsdS)N�	ifloordivr)rrrrr	�
__ifloordiv__�sz6OperatorTestCase.test_inplace.<locals>.C.__ifloordiv__cSsdS)N�ilshiftr)rrrrr	�__ilshift__�sz4OperatorTestCase.test_inplace.<locals>.C.__ilshift__cSsdS)N�imodr)rrrrr	�__imod__�sz1OperatorTestCase.test_inplace.<locals>.C.__imod__cSsdS)N�imulr)rrrrr	�__imul__�sz1OperatorTestCase.test_inplace.<locals>.C.__imul__cSsdS)N�imatmulr)rrrrr	�__imatmul__�sz4OperatorTestCase.test_inplace.<locals>.C.__imatmul__cSsdS)N�iorr)rrrrr	�__ior__�sz0OperatorTestCase.test_inplace.<locals>.C.__ior__cSsdS)N�ipowr)rrrrr	�__ipow__�sz1OperatorTestCase.test_inplace.<locals>.C.__ipow__cSsdS)N�irshiftr)rrrrr	�__irshift__�sz4OperatorTestCase.test_inplace.<locals>.C.__irshift__cSsdS)N�isubr)rrrrr	�__isub__�sz1OperatorTestCase.test_inplace.<locals>.C.__isub__cSsdS)N�itruedivr)rrrrr	�__itruediv__�sz5OperatorTestCase.test_inplace.<locals>.C.__itruediv__cSsdS)N�ixorr)rrrrr	�__ixor__�sz1OperatorTestCase.test_inplace.<locals>.C.__ixor__cSsdS)Nr?r)rrrrr	r�sz4OperatorTestCase.test_inplace.<locals>.C.__getitem__N)rrrr�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr	r%�sr%r?r�r�r�r�r�r�r�r�r�r�r�r�r�)rr&r2r�r�r�r�r�r�r�r�r�r�r�r�r��iconcat)rrr%r�rrr	�test_inplace�s"		zOperatorTestCase.test_inplacecCsH|j}Gdd�dt�}|j|jgd�d�|j|jtdddg��d�|j|j|d��d�|j|j|t�d�d�|j|j|t�d�d�|jt��|j|d	��WdQRX|jt��|j|d
��WdQRX|jt	��|j|t	��WdQRXdS)Nc@s(eZdZdd�Zdd�ZdS)z,OperatorTestCase.test_length_hint.<locals>.XcSs
||_dS)N)�value)rr�rrr	r
�sz5OperatorTestCase.test_length_hint.<locals>.X.__init__cSs,t|j�tkr!|j�n|jSdS)N)�typer�)rrrr	�__length_hint__�sz<OperatorTestCase.test_length_hint.<locals>.X.__length_hint__N)rrrr
r�rrrr	r��sr�rrrr4r5r{�abc���)
rr&r2�length_hint�iter�NotImplementedrrrR�LookupError)rrr�rrr	�test_length_hint�s	
(""z!OperatorTestCase.test_length_hintcCs|j}dd�t|�D�}xV|D]N}t||�}t|d|jd�dd�}|r)|j||�q)WdS)NcSs%g|]}|jd�s|�qS)�_)�
startswith)�.0r�rrr	�
<listcomp>�s	z<OperatorTestCase.test_dunder_is_original.<locals>.<listcomp>�__r�)r�dir�getattr�stripZassertIs)rr�namesr�ZorigZdunderrrr	�test_dunder_is_original�s	
#z(OperatorTestCase.test_dunder_is_originalN)*rrrr r"r(r+r-r/r3r8r<rDrFrIrKrMrPrSrWrZr\r^rcrergrirlrnrprtrvryr}r�r�r�r�r�r�r�r�rrrr	r'sN
				5&!rc@seZdZeZdS)�PyOperatorTestCaseN)rrr�py_operatorrrrrr	r��sr�zrequires _operatorc@seZdZeZdS)�COperatorTestCaseN)rrr�
c_operatorrrrrr	r��sr�c@s@eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�OperatorPickleTestCasecCsitjtjd|j��tj||�}WdQRXtjtjd|j��tj|�SWdQRXdS)Nr)	rZ	swap_item�sys�modulesr�pickle�dumps�module2�loads)r�obj�protoZpickledrrr	�copy�szOperatorPickleTestCase.copycCs�|jj}Gdd�d�}|�}d|_d|_d|_|�|_|�|j_d|jj_x=tt	j
d�D](}|jd|��
|d	�}|j||�}|j
t|�t|��|j
||�||��|d	d
d�}|j||�}|j
t|�t|��|j
||�||��|d�}|j||�}|j
t|�t|��|j
||�||��WdQRXq�WdS)
Nc@seZdZdS)z1OperatorPickleTestCase.test_attrgetter.<locals>.AN)rrrrrrr	r�sr�r�r�r��Vrr�r�r�r�zt.u.v)rr�r�r�r��t�u�vrNr��HIGHEST_PROTOCOL�subTestr�r2�repr)rr�r�rHr�r��f2rrr	r�s.				z&OperatorPickleTestCase.test_attrgettercCs|jj}d}x�ttjd�D]�}|jd|���|d�}|j||�}|jt|�t|��|j||�||��|ddd�}|j||�}|jt|�t|��|j||�||��WdQRXq&WdS)Nr�rr�rrr5)	rr�rNr�r�r�r�r2r�)rr�rHr�r�r�rrr	r�sz&OperatorPickleTestCase.test_itemgettercCs�|jj}Gdd�d�}|�}x�ttjd�D]t}|jd|��Y|d�}|j||�}|jt|�t|��|j||�||��|ddd�}|j||�}|jt|�t|��|j||�||��|ddd	�}|j||�}|jt|�t|��|j||�||��|d
ddd
d�}|j||�}|j||�||��WdQRXq<WdS)Nc@s7eZdZdd�Zddd�Zdd�ZdS)	z3OperatorPickleTestCase.test_methodcaller.<locals>.Ac_s|d|dS)Nrrr)rr�r�rrr	r�0sz7OperatorPickleTestCase.test_methodcaller.<locals>.A.foorXcSs|S)Nr)rr�rrr	r�2sz7OperatorPickleTestCase.test_methodcaller.<locals>.A.barc_s|d|dfS)Nr�rr)r�r�rrr	r�4sz7OperatorPickleTestCase.test_methodcaller.<locals>.A.bazN)rrrr�r�r�rrrr	r�/sr�rr�r�r�rr�r?r�rr�r�r�)	rr�rNr�r�r�r�r2r�)rr�r�rHr�r�r�rrr	r�-s(	z(OperatorPickleTestCase.test_methodcallerN)rrrr�r�r�r�rrrr	r��sr�c@seZdZeZeZdS)�PyPyOperatorPickleTestCaseN)rrrr�rr�rrrr	r�Lsr�c@seZdZeZeZdS)�PyCOperatorPickleTestCaseN)rrrr�rr�r�rrrr	r�Psr�c@seZdZeZeZdS)�CPyOperatorPickleTestCaseN)rrrr�rr�r�rrrr	r�Usr�c@seZdZeZeZdS)�CCOperatorPickleTestCaseN)rrrr�rr�rrrr	r�Zsr��__main__)Zunittestr�r�ZtestrZimport_fresh_moduler�r�rr&rrZTestCaser�Z
skipUnlessr�r�r�r�r�r�r�mainrrrr	�<module>s,��Q