Your IP : 216.73.217.129


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



���]��@sUddlZddlmZdZGdd�dej�ZedkrQej�dS)�N)�supportzGlobal variablec@sXeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�DictComprehensionTestcCs�ddddddddd	d
ddd
dddddddi
}dd�td�D�}|j||�ddddddddd	d	ddd
d
ddddddi
}dd�td�D�}|j||�dS)Nr�
������
�����������	�cSsi|]}|d|�qS)r�)�.0�krr�3/opt/alt/python35/lib64/python3.5/test_dictcomps.py�
<dictcomp>s	z5DictComprehensionTest.test_basics.<locals>.<dictcomp>cSs8i|].}td�D]}||kr||�qqS)r)�range)rr�vrrrrs	)r�assertEqual)�self�expected�actualrrr�test_basicss0Bz!DictComprehensionTest.test_basicscZCs�d}ddddddddddddddd	dd
dddi
}dd
�td�D�}|j||�|j|d�ddddddddddddddddddddddddddddddddddddd dd!dd"dd#d	d$d	d%d	d&d	d'd	d(d	d)d	d*d
d+d
d,d
d-d
d.d
d/d
d0d
d1d
d2dd3dd4dd5dd6dd7dd8dd9dd:di-}d;d
�td�D�}|j|d�|j||�dS)<NzLocal Variablerrrr	rr
rrrrcSsi|]}d|�qS)Nr)rrrrrrs	z>DictComprehensionTest.test_scope_isolation.<locals>.<dictcomp>rrr����$�%�&�'�-�.�/�0�1�6�7�8�9�:�;�?�@�A�B�C�D�E�H�I�J�K�L�M�N�O�Q�R�S�T�U�V�W�X�YcSs7i|]-}t|d|d�D]}||�q!qS)rr)r)rrrrrrr$s	)rr)rrr r!rrr�test_scope_isolations$00000$z*DictComprehensionTest.test_scope_isolationcZCs�ddddddddddddddddd	dd
di
}dd�td
�D�}|j||�|jtd�d
dddddddddddddddddddddddddddddddddddd dd!dd"dd#dd$dd%dd&dd'dd(dd)dd*d	d+d	d,d	d-d	d.d	d/d	d0d	d1d	d2d
d3d
d4d
d5d
d6d
d7d
d8d
d9d
d:d
i-}d;d�td
�D�}|jtd�|j||�dS)<Nrrrr	rr
rrrrcSsi|]}d|�qS)Nr)r�grrrr+s	zJDictComprehensionTest.test_scope_isolation_from_global.<locals>.<dictcomp>rzGlobal variablerrr#r$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrGrHrIrJrKrLcSs7i|]-}t|d|d�D]}||�q!qS)rr)r)rrrNrrrr5s	)rrrN)rr r!rrr� test_scope_isolation_from_global(s$00000$z6DictComprehensionTest.test_scope_isolation_from_globalcCsoddddddddddddddd	dd
dddi
}dd
�td�D�}|j||�dS)NrzGlobal variablerrr	rr
rrrrcSsi|]}t|�qSr)rN)rrrrrr?s	z@DictComprehensionTest.test_global_visibility.<locals>.<dictcomp>r)rr)rr r!rrr�test_global_visibility9sz,DictComprehensionTest.test_global_visibilitycs�d�ddddddddddddddd	dd
dddi
}�fdd
�td�D�}|j||�|j�d�dS)NzLocal variablerrrr	rr
rrrrcsi|]}�|�qSrr)rr)rrrrIs	z?DictComprehensionTest.test_local_visibility.<locals>.<dictcomp>r)rr)rr r!r)rr�test_local_visibilityBsz+DictComprehensionTest.test_local_visibilitycCsX|jtd��tddd�WdQRX|jtd��tddd�WdQRXdS)Nzcan't assignz'{x: y for y, x in ((1, 2), (3, 4))} = 5z<test>�execz({x: y for y, x in ((1, 2), (3, 4))} += 5)ZassertRaisesRegex�SyntaxError�compile)rrrr�test_illegal_assignmentMs		z-DictComprehensionTest.test_illegal_assignmentN)	�__name__�
__module__�__qualname__r"rMrOrPrQrUrrrrr	s
	r�__main__)ZunittestZtestrrNZTestCaserrV�mainrrrr�<module>s
N