Your IP : 216.73.216.213


Current Path : /proc/242857/root/opt/alt/python34/lib64/python3.4/test/__pycache__/
Upload File :
Current File : //proc/242857/root/opt/alt/python34/lib64/python3.4/test/__pycache__/test_operator.cpython-34.pyc

�
f f�H�@s�ddlZddlmZejdddg�Zejdddg�ZGdd�d�ZGd	d
�d
e�ZGdd�d�Z	Gd
d�de	ej
�Zejed�Gdd�de	ej
��Z
edkr�ej�ndS)�N)�support�operatorZblocked�	_operatorZfreshc@sXeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�Seq1cCs
||_dS)N)�lst)�selfr�r�7/opt/alt/python34/lib64/python3.4/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	rs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	rsz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(dMS)N�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_le1s	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__?sz*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__Msz*OperatorTestCase.test_ne.<locals>.C.__ne__N)rrrr)rrrr	r%Lsr%rrgg�?rg@)rr&rr�ner#rr)rrr%rrr	�test_neJs	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_geXs	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_gtcs	zOperatorTestCase.test_gtcCsh|j}|jt|j�|jt|jd�|j|jd�d�|j|jd�d�dS)Nr���)rrr�abs�assertEqual)rrrrr	�test_absns
	zOperatorTestCase.test_abscCsX|j}|jt|j�|jt|jdd�|j|jdd�dk�dS)N���)rrr�addr)rrrrr	�test_addus	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_mulcCs�|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_contains�s
	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_setitem�s	"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)rrrrrrrrr	r%sr%r?r)rr&rr�truthr#rr)rrr%rrr	�
test_truths	zOperatorTestCase.test_truthcCsX|j}|jt|j�|jt|jdd�|j|jdd�dk�dS)N��r6)rrr�xorr)rrrrr	�test_bitwise_xors	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_iss	
zOperatorTestCase.test_iscCsz|j}d}}|dd�|dd�}|jt|j�|j|j||��|j|j||��dS)Nryr4)rrr�is_notrr)rrrHr{r|rrr	�test_is_not&s	
zOperatorTestCase.test_is_notcCs�|j}Gdd�d�}|�}d|_|jd�}|j||�d�|jd�}|jt||�|jt|jd�|jt|j�|�}d|_d|_d	|_	|j|jd
dd�|�d�|jt|jd
fdf�Gd
d�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	�A0sr��arthur�nameZrankr�X�Y�Z�x�z�yc@seZdZdd�ZdS)z+OperatorTestCase.test_attrgetter.<locals>.CcSs
t�dS)N)r#)rr�rrr	�__getattr__Dsz7OperatorTestCase.test_attrgetter.<locals>.C.__getattr__N)rrrr�rrrr	r%Csr%�foo�thomasz
child.namezchild.child.namezchild.z.child�johnson)r�r�r�)r�r�)r�r�r�)
rr��
attrgetterr2r�AttributeErrorrr�r�r�r&r#Zchild)rrr�rH�f�recordr%rrr	�test_attrgetter.sN							%		z OperatorTestCase.test_attrgetterc	Cs�|j}d}|jd�}|j||�d�|jd�}|jt||�Gdd�dt�}|jt|jd�|��|jd�}|jt||�|jt|j�tdd	�}|jd�}|j||�d	�|jd
�}|jt	||�ddddg}|jd�}|jt
t||��ddddg�|jt|d|�ddddg�t
tt
td���}|j|jddd�|�d�|jt|jddd�|�dS) NZABCDErr%r:c@seZdZdd�ZdS)z+OperatorTestCase.test_itemgetter.<locals>.CcSs
t�dS)N)r#)rr�rrr	risz7OperatorTestCase.test_itemgetter.<locals>.C.__getitem__N)rrrrrrrr	r%hsrXr��key�valZnonkey�appler4�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�
itemgetterr2rrnr&r#r�dict�KeyErrorrl�map�sorted�strrN)	rrrHr�r%�dZ	inventoryZgetcount�datarrr	�test_itemgetter`s0	+%z OperatorTestCase.test_itemgettercCs |j}|jt|j�Gdd�d�}|�}|jd�}|jt||�|jddd�}|j||�d�|jd�}|j||�d�|jt|||�|jdd	d
�}|j||�d
�|jddd
dd�}|j||�d�dS)Nc@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�rrr4r�rXr�r?r�r��spamr�eggs)r�r�)rrr�methodcallerrnr2)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�dS)Nc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�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�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�rrrrr	r%�s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��iconcat)rrr%r|rrr	�test_inplace�s 		zOperatorTestCase.test_inplacecCsE|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	��WdQX|jt��|j|d
��WdQX|jt	��|j|t	��WdQXdS)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�rrrr4r5rv�abc���)
rr&r2�length_hint�iter�NotImplementedrrrR�LookupError)rrr�rrr	�test_length_hint�s	
(""z!OperatorTestCase.test_length_hintcCs�|j}dd�t|�D�}xY|D]Q}t||�}t|d|jd�dd�}|r)|j||�q)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^r`rbrdrgrirkrorqrtrxr}rr�r�r�r�r�r�rrrr	r%sL
			2#rc@seZdZeZdS)�PyOperatorTestCaseN)rrr�py_operatorrrrrr	r��sr�zrequires _operatorc@seZdZeZdS)�COperatorTestCaseN)rrr�
c_operatorrrrrr	r��sr��__main__)ZunittestZtestrZimport_fresh_moduler�r�rr&rrZTestCaser�Z
skipUnlessr�r�mainrrrr	�<module>s��