Your IP : 216.73.216.213


Current Path : /opt/alt/python34/lib64/python3.4/test/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/test/__pycache__/test_index.cpython-34.pyo

�
g fw!�@s�ddlZddlmZddlZejZGdd�d�ZGdd�de�ZGdd�dej	�Z
Gd	d
�d
�ZGdd�deej	�ZGd
d�d�Z
Gdd�deej	�ZGdd�deej	�ZGdd�deej	�ZGdd�deej	�ZGdd�deej	�ZGdd�dej	�ZGdd�dej	�Zedkr�ej�ndS)�N)�supportc@seZdZdd�ZdS)�newstylecCs|jS)N)�ind)�self�r�4/opt/alt/python34/lib64/python3.4/test/test_index.py�	__index__sznewstyle.__index__N)�__name__�
__module__�__qualname__rrrrrrsrc@seZdZdd�ZdS)�TrapIntcCs
t|�S)N)�int)rrrrrszTrapInt.__index__N)r	r
rrrrrrr
src@speZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�BaseTestCasecCst�|_t�|_dS)N)r�o�n)rrrr�setUpszBaseTestCase.setUpcCsTd|j_d|j_|jtj|j�d�|jtj|j�d�dS)N����r)rrr�assertEqual�operator�index)rrrr�
test_basicszBaseTestCase.test_basiccCs�d|j_d|j_t|j|j|j�}tddd�}|j|j|j�|jd��t|j|j|j�}tddd�}|j|j|j�|jd��dS)N�r)rrr�slicer�indices)rZslcZ	check_slcrrr�
test_slices%zBaseTestCase.test_slicecCs�d|j_d|j_|jdj�d�|jdj�d	�|j|jj�d�|j|jj�d�|jdj�d�|jdj�d�dS)
N����TrFri����)rrrrr)rrrr�
test_wrappers#szBaseTestCase.test_wrapperscCshttd��}|j|td�td��|dd��|jtt��jd�d�dS)N�
rrr)rrr)�list�rangerrrr)r�rrrr�test_subclasses-s0zBaseTestCase.test_subclassescCs�d|j_d|j_|jttj|j�|jttj|j�|jtt|j�jd�|jtt|j�jd�dS)N�dumb�badr)	rrr�assertRaises�	TypeErrorrrrr)rrrr�
test_error2szBaseTestCase.test_errorcCswGdd�dt�}|d�}|j�}tj|�}|j|d�|j|d�|jt|�t�dS)Nc@seZdZdd�ZdS)z8BaseTestCase.test_int_subclass_with_index.<locals>.MyIntcSst|�dS)Nr)r
)rrrrr>szBBaseTestCase.test_int_subclass_with_index.<locals>.MyInt.__index__N)r	r
rrrrrr�MyInt=sr+r�)r
rrrr�assertIs�type)rr+Zmy_intZdirect_indexZoperator_indexrrr�test_int_subclass_with_index:sz)BaseTestCase.test_int_subclass_with_indexc	Cs�Gdd�d�}Gdd�dt�}|�}|jt��tj|�}WdQX|j|d�|�}tj|�}|j|d�dS)Nc@seZdZdd�ZdS)z<BaseTestCase.test_index_returns_int_subclass.<locals>.BadIntcSsdS)NTr)rrrrrLszFBaseTestCase.test_index_returns_int_subclass.<locals>.BadInt.__index__N)r	r
rrrrrr�BadIntKsr0c@seZdZdd�ZdS)z=BaseTestCase.test_index_returns_int_subclass.<locals>.BadInt2cSsdS)NTr)rrrrrPszGBaseTestCase.test_index_returns_int_subclass.<locals>.BadInt2.__index__N)r	r
rrrrrr�BadInt2Osr1rr)r
ZassertWarns�DeprecationWarningrrr)rr0r1Zbad_intrrrr�test_index_returns_int_subclassJs		z,BaseTestCase.test_index_returns_int_subclassN)r	r
rrrrr r%r*r/r3rrrrrs

rc@speZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�SeqTestCasecCs4t�|_t�|_t�|_t�|_dS)N)rrr�o2�n2)rrrrr`szSeqTestCase.setUpcCs^d|j_d|j_|j|j|j|jd�|j|j|j|jd�dS)Nrrr)rrrr�seq)rrrr�
test_indexfs!zSeqTestCase.test_indexcCs�d|j_d|j_d|j_d|j_|j|j|j|j�|jdd��|j|j|j|j�|jdd��dS)Nr�rr)rrr5rr6rr7)rrrrrls0zSeqTestCase.test_slicecCs�t|j�}t|d�|j_|d|j_|j|j|jd�|jdd��|j|jd|j�|j�|j|j|jd�|jdd��|j|jd|j�|j�|d|j_t|d�|j_|j|j|jd�|j�|j|jd|j�|jdd��|j|j|jd�|j�|j|jd|j�|jdd��dS)Ng�?rr)	�lenr7r
rrrrr5r6)rZseqlenrrr�test_slice_bug7532ts-#-##-#zSeqTestCase.test_slice_bug7532cCs�d|j_d|j_|j|j|j|jd�|j|j|j|jd�|j|j|j|jd�|j|j|j|jd�dS)Nr9r)rrrrr7)rrrr�test_repeat�s!!!zSeqTestCase.test_repeatcCsd|j_d|j_|j|jj|j�|jd�|j|jj|j�|jd�|j|jj|j�|jd�|j|jj|j�|jd�|j|jj|j�|jd�|j|jj|j�|jd�dS)Nrr)rrrrr7�__getitem__�__mul__�__rmul__)rrrrr �s&&&&&zSeqTestCase.test_wrapperscCs%|j|jt�|jd�dS)Nr)rr7r)rrrrr%�szSeqTestCase.test_subclassescCs�d|j_d|j_dd�}|jt||j|�|jt||j|�dd�}|jt||j|�|jt||j|�dS)Nr&r'cSs|j|S)N)r7)�x�objrrr�<lambda>�sz(SeqTestCase.test_error.<locals>.<lambda>cSs|j|d�S)N)r7)r@rArrrrB�s)rrrr(r))rZindexobjZsliceobjrrrr*�szSeqTestCase.test_errorN)r	r
rrr8rr;r<r r%r*rrrrr4]s
r4c@s@eZdZddddddgZdd�Zd	d
�ZdS)�ListTestCaserr!���(�2c	Cs�d|j_d|j_td�}||j=||j=d||j<d||j<|j|td��dddd	d
ddg}|j|jd
�|j|ddd
d	d
ddg�|j|j�|j|ddd	d
ddg�dS)Nrzab!cdefghi!j�X�YZ
abYdefghXjrrrr,�	r!��herer)rrrr"r�__setitem__�__delitem__)r�lstrrr�test_setdelitem�s



%zListTestCase.test_setdelitemcCs�d|j_d|j_ddg}||j9}|j|ddddg�||j9}|j|ddddgd�dddddd	g}|j|j�}|j||�|j|dddddd	gd�dS)
Nrr9rrrrr,rJrK)rrrr�__imul__r-)rrO�l2rrr�test_inplace_repeat�s

 z ListTestCase.test_inplace_repeatN)r	r
rr7rPrSrrrrrC�srCc@s^eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZeZdd�Z	d
S)�NewSeqcCst|�|_dS)N)r"�_list)r�iterablerrr�__init__�szNewSeq.__init__cCs
t|j�S)N)�reprrU)rrrr�__repr__�szNewSeq.__repr__cCs
|j|kS)N)rU)r�otherrrr�__eq__�sz
NewSeq.__eq__cCs
t|j�S)N)r:rU)rrrr�__len__�szNewSeq.__len__cCs|j|j|�S)N)�	__class__rU)rrrrrr>�szNewSeq.__mul__cCs|j|S)N)rU)rrrrrr=�szNewSeq.__getitem__N)
r	r
rrWrYr[r\r>r?r=rrrrrT�srTc@seZdZdZdS)	�
TupleTestCaserr!rDrErFrGN)rr!rDrErFrG)r	r
rr7rrrrr^�sr^c@seZdZed�ZdS)�ByteArrayTestCasesthis is a testN)r	r
r�	bytearrayr7rrrrr_�sr_c@seZdZdZdS)�
BytesTestCasesthis is a testN)r	r
rr7rrrrra�srac@seZdZdZdS)�StringTestCasezthis is a testN)r	r
rr7rrrrrb�srbc@seZdZed�ZdS)	�NewSeqTestCaserr!rDrErFrGN)rr!rDrErFrG)r	r
rrTr7rrrrrc�srcc@seZdZdd�ZdS)�
RangeTestCasecCsUt�}d|_|jtdd�|d�|jtdd�j|�d�dS)NrrrDr)rrrr#r=)rrrrr�
test_range�s		zRangeTestCase.test_rangeN)r	r
rrerrrrrd�srdc@s@eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�OverflowTestCasecCsd|_|j|_dS)Nr�dl)�pos�neg)rrrrr�s	zOverflowTestCase.setUpcCs<|j|jj�|j�|j|jj�|j�dS)N)rrhrri)rrrr�test_large_longs�sz!OverflowTestCase.test_large_longscCs�Gdd�d�}|�}|j||j|j�|j||j|j�|j||j|j�jt�dtdf�|j||j|jd�jt�dtdf�dS)Nc@s(eZdZdd�Zdd�ZdS)z.OverflowTestCase.test_getitem.<locals>.GetItemcSsdS)Nr)rrrrr\sz6OverflowTestCase.test_getitem.<locals>.GetItem.__len__cSs|S)Nr)r�keyrrrr=sz:OverflowTestCase.test_getitem.<locals>.GetItem.__getitem__N)r	r
rr\r=rrrr�GetItemsrlrr)rrhrir�maxsize)rrlr@rrr�test_getitem�s	"%zOverflowTestCase.test_getitemcs<�jt�fdd���jt�fdd��dS)Ncsd�jS)N�a)rhr)rrrrBsz7OverflowTestCase.test_sequence_repeat.<locals>.<lambda>csd�jS)Nro)rir)rrrrBs)r(�
OverflowError)rr)rr�test_sequence_repeat
sz%OverflowTestCase.test_sequence_repeatN)r	r
rrrjrnrqrrrrrf�srf�__main__)ZunittestZtestrrZMAX_Py_ssize_trmrr
rZTestCaserr4rCrTr^r_rarbrcrdrfr	�mainrrrr�<module>s$	OF"