Current File : //usr/local/apps/python3/lib/python3.11/test/__pycache__/test_dictcomps.cpython-311.pyc
�

�Ke���f�ddlZdZGd�dej��Zedkrej��dSdS)�N�Global variablec�D�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
S)�DictComprehensionTestc��ddddddddd	d
d�
}d�td��D��}|�||��d
dddddddddd�
}d�td��D��}|�||��dS)N�
���
�������
r���������	c��i|]}||dz��	S�r���.0�ks  �=/usr/local/apps/python3/lib/python3.11/test/test_dictcomps.py�
<dictcomp>z5DictComprehensionTest.test_basics.<locals>.<dictcomp>s��/�/�/��!�Q��V�/�/�/�rrrrrrrrrrc�D�i|]}td��D]}||k�||���Sr��range�rr �vs   r!r"z5DictComprehensionTest.test_basics.<locals>.<dictcomp>s1��G�G�G�1�5��9�9�G�G�a��Q���!�Q����r#�r&�assertEqual��self�expected�actuals   r!�test_basicsz!DictComprehensionTest.test_basics	s����b�R�B�2�"����b�"�"��/�/�U�2�Y�Y�/�/�/�������*�*�*��Q�1��q�Q�1��q�Q�O�O��G�G��b�	�	�G�G�G�������*�*�*�*�*r#c
�(�d}ddddddddddd�
}d�td��D��}|�||��|�|d��idd�dd�d	d�d
d�dd�d
d�dd�dd�dd�dd�dd�dd�dd�dd�dd�dd�dd�idd�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.d)��d)d)dddddddddd/��}d0�td��D��}|�|d��|�||��dS)1NzLocal Variablerc��i|]}|d��S�Nrrs  r!r"z>DictComprehensionTest.test_scope_isolation.<locals>.<dictcomp>���-�-�-�a�!�T�-�-�-r#rrrrrr�r���$r�%�&�'�-r�.�/�0�1�6r�7�8�9�:�;�?r�@�A�B�C�D�E�Hr�I�J�K�L�M��N�O�Q�R�S�T�U�V�W�X�Yc�F�i|]}t|dz|dz��D]}||���S�rrr%)rr(r s   r!r"z>DictComprehensionTest.test_scope_isolation.<locals>.<dictcomp>"�9��H�H�H�1�5��Q���B��3G�3G�H�H�a�!�Q�H�H�H�Hr#r))r,r r-r.s    r!�test_scope_isolationz*DictComprehensionTest.test_scope_isolations[�������$�4�D����$�8�8��-�-�5��9�9�-�-�-�������*�*�*�����,�-�-�-�7�A�q�7�"�a�7��Q�7��A�7�r�1�7�b�!�7�R��7�B��7���7��q�7�"$�a�7�)+�Q�7�02�A�7�79�1�7�>@�!�7�EG��7���7�7��q�7�"$�a�7�)+�Q�7�02�A�7�79�1�7�>@�!�7�EG��7���7��q�7�#%�a�7�*,�Q�7�13�A�7�8:�1�7�?A�!�7�FH��7���	7��q�	7�7�'(�Q�A�1�!���q�a�Q�A�7�7�7��I�H��b�	�	�H�H�H������,�-�-�-������*�*�*�*�*r#c
�8�ddddddddddd�
}d�td��D��}|�||��|�td��idd�dd�d	d�d
d�dd�d
d�dd�dd�dd�dd�dd�dd�dd�dd�dd�dd�dd�idd�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.d)��d)d)dddddddddd/��}d0�td��D��}|�td��|�||��dS)1Nrc��i|]}|d��Sr2r)r�gs  r!r"zJDictComprehensionTest.test_scope_isolation_from_global.<locals>.<dictcomp>)r3r#rrrrrrrr4rr5r6r7rr8r9r:r;rr<r=r>r?r@rrArBrCrDrErFrrGrHrIrJrKrLrMrrNrOrPrQrRrSc�F�i|]}t|dz|dz��D]}||���Sr`r%)rr(res   r!r"zJDictComprehensionTest.test_scope_isolation_from_global.<locals>.<dictcomp>3rar#)r&r*rer+s   r!� test_scope_isolation_from_globalz6DictComprehensionTest.test_scope_isolation_from_global&sV�����$�4�D����$�8�8��-�-�5��9�9�-�-�-�������*�*�*�����-�.�.�.�7�A�q�7�"�a�7��Q�7��A�7�r�1�7�b�!�7�R��7�B��7���7��q�7�"$�a�7�)+�Q�7�02�A�7�79�1�7�>@�!�7�EG��7���7�7��q�7�"$�a�7�)+�Q�7�02�A�7�79�1�7�>@�!�7�EG��7���7��q�7�#%�a�7�*,�Q�7�13�A�7�8:�1�7�?A�!�7�FH��7���	7��q�	7�7�'(�Q�A�1�!���q�a�Q�A�7�7�7��I�H��b�	�	�H�H�H������-�.�.�.������*�*�*�*�*r#c�~�ddddddddddd�
}d�td��D��}|�||��dS)Nrrc��i|]
}|t��Sr)rers  r!r"z@DictComprehensionTest.test_global_visibility.<locals>.<dictcomp>=s��*�*�*�1�!�Q�*�*�*r#rr)r+s   r!�test_global_visibilityz,DictComprehensionTest.test_global_visibility7se��(�->�(�->�(�->�(�->�(�->�	@�@��
+�*��b�	�	�*�*�*�������*�*�*�*�*r#c���d�ddddddddddd�
}�fd�td��D��}|�||��|��d��dS)NzLocal variablerc���i|]}|���Srrr's  �r!r"z?DictComprehensionTest.test_local_visibility.<locals>.<dictcomp>Gs���*�*�*�1�!�Q�*�*�*r#rr))r,r-r.r(s   @r!�test_local_visibilityz+DictComprehensionTest.test_local_visibility@s������'�,<�'�,<�'�,<�'�,<�'�,<�	>�>��
+�*�*�*��b�	�	�*�*�*�������*�*�*�����,�-�-�-�-�-r#c��|�td��5tddd��ddd��n#1swxYwY|�td��5tddd��ddd��dS#1swxYwYdS)Nz
cannot assignz'{x: y for y, x in ((1, 2), (3, 4))} = 5z<test>�execzillegal expressionz({x: y for y, x in ((1, 2), (3, 4))} += 5)�assertRaisesRegex�SyntaxError�compile)r,s r!�test_illegal_assignmentz-DictComprehensionTest.test_illegal_assignmentKs��
�
#�
#�K��
A�
A�	�	��=�x��
�
�
�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	��
#�
#�K�1E�
F�
F�	�	��>���
�
�
�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�:�>�>� A?�?B�Bc����ddddd�}gd�}g��fd���fd�td	d
��D��}|�||��|��|��dS)N�W�o�l�d)�H�erwrv)
)�keyry)�valueru)r{rz)r|rv�r{rw)r|�rr})r|rw)r{rv)r|rxc�6����||f��|Sr2)�append)�posr|�actual_callss  �r!�add_callz=DictComprehensionTest.test_evaluation_order.<locals>.add_callfs �������e��-�-�-��Lr#c�D��i|]\}}�d|���d|����S)r{r|r)rr r(r�s   �r!r"z?DictComprehensionTest.test_evaluation_order.<locals>.<dictcomp>jsG���
�
�
���1�
�H�U�A������!� 4� 4�
�
�
r#�Hello�World)�zipr*)r,r-�expected_callsr.r�r�s    @@r!�test_evaluation_orderz+DictComprehensionTest.test_evaluation_orderTs���������	
�
��
�
�
����	�	�	�	�	�
�
�
�
��G�W�-�-�
�
�
��
	
�����*�*�*�����~�6�6�6�6�6r#c�J�ddddd�}d�td��D��}|�||��ddd	d
d�}d�td��D��}|�||��ddd	d
d�}d
�td��D��}|�||��dS)Nrrrr
)rrrrc�$�i|]
}|dz}|||z��S�rr)r�i�js   r!r"zQDictComprehensionTest.test_assignment_idiom_in_comprehensions.<locals>.<dictcomp>ts&��:�:�:�Q�Q�q�S�q�!�Q�q�S�:�:�:r#rrr	�)rrrrc�4�i|]}|dz}|dz}||z||z��Sr�r�rr�r�r s    r!r"zQDictComprehensionTest.test_assignment_idiom_in_comprehensions.<locals>.<dictcomp>ws2��K�K�K�q�q��s��a��c��!�A�#�q��s�K�K�Kr#c�4�i|]}|dz|dz}}||z||z��S)rrrr�s    r!r"zQDictComprehensionTest.test_assignment_idiom_in_comprehensions.<locals>.<dictcomp>zs2��G�G�G�q�A�a�C��1��Q�!�!�A�#�q��s�G�G�Gr#r)r+s   r!�'test_assignment_idiom_in_comprehensionsz=DictComprehensionTest.test_assignment_idiom_in_comprehensionsrs����Q�1��,�,��:�:�%��(�(�:�:�:�������*�*�*��Q�2�"�-�-��K�K�E�!�H�H�K�K�K�������*�*�*��Q�2�"�-�-��G�G�E�!�H�H�G�G�G�������*�*�*�*�*r#c���ddddd�}|�d�gtd���D��|��|�d�gtd���RD��|��dS)Nrrrr)rrrrc��i|]}|||z��	Srr�rr�s  r!r"z>DictComprehensionTest.test_star_expression.<locals>.<dictcomp>s��6�6�6�Q�!�Q�q�S�6�6�6r#c��i|]}|||z��	Srrr�s  r!r"z>DictComprehensionTest.test_star_expression.<locals>.<dictcomp>�s��7�7�7�Q�!�Q�q�S�7�7�7r#)r*r&)r,r-s  r!�test_star_expressionz*DictComprehensionTest.test_star_expression}sy���Q�1��+�+�����6�6�+�E�!�H�H�+�6�6�6��A�A�A����7�7�,�E�!�H�H�,�,�7�7�7��B�B�B�B�Br#N)�__name__�
__module__�__qualname__r/rbrgrjrmrsr�r�r�rr#r!rrs�������+�+�+�+�+�+�&+�+�+�"+�+�+�	.�	.�	.����7�7�7�<	+�	+�	+�C�C�C�C�Cr#r�__main__)�unittestre�TestCaserr��mainrr#r!�<module>r�sy��������yC�yC�yC�yC�yC�H�-�yC�yC�yC�x�z����H�M�O�O�O�O�O��r#