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

�Keb���	ddlZddlmZddlmZddlmZdZGd�d��ZGd�d	e��Z	Gd
�deej
��ZGd�d
eej
��ZGd�deej
��Z
Gd�deej
��ZGd�de	ej
��ZGd�de	ej
��ZGd�de	ej
��ZGd�de	ej
��ZGd�de	ej
��ZGd�de	ej
��ZGd�deej
��ZGd �d!eej
��ZGd"�d#e��ZGd$�d%e��ZGd&�d'e��ZGd(�d)ej
��Zed*krej��dSdS)+�N)�repeat)�deque)�length_hint�
c��eZdZd�ZdS)�TestInvariantWithoutMutationsc��|j}ttdtdz����D]4}|�t|��|��t
|���5|�t|��d��|�tt|��|�t|��d��dS�N�r)	�it�reversed�range�n�assertEqualr�next�assertRaises�
StopIteration)�selfr�is   �;/usr/local/apps/python3/lib/python3.11/test/test_iterlen.py�test_invariantz,TestInvariantWithoutMutations.test_invariant6s���
�W���%��1�Q�3�-�-�(�(�	�	�A����[��_�_�a�0�0�0���H�H�H�H�����R���!�,�,�,����-��r�2�2�2�����R���!�,�,�,�,�,�N)�__name__�
__module__�__qualname__r�rrrr4s#������-�-�-�-�-rrc��eZdZd�ZdS)�TestTemporarilyImmutablec��|j}|�t|��t��t	|��|�t|��tdz
��|���|�tt|��|�t|��d��dSr
)rrrrr�mutater�RuntimeError)rrs  r�test_immutable_during_iterationz8TestTemporarilyImmutable.test_immutable_during_iterationAs����W������R���!�,�,�,��R��������R���!�A�#�.�.�.����
�
�
����,��b�1�1�1�����R���!�,�,�,�,�,rN)rrrr"rrrrr?s#������
-�
-�
-�
-�
-rrc��eZdZd�ZdS)�
TestRepeatc�:�tdt��|_dS�N)rrr�rs r�setUpzTestRepeat.setUpQs����q�/�/����rN�rrrr(rrrr$r$Os#������"�"�"�"�"rr$c��eZdZd�ZdS)�
TestXrangec�R�ttt����|_dSr&��iterrrrr's rr(zTestXrange.setUpV����u�Q�x�x�.�.����rNr)rrrr+r+Ts#������!�!�!�!�!rr+c��eZdZd�ZdS)�TestXrangeCustomReversedc�R�ttt����|_dSr&�r
rrrr's rr(zTestXrangeCustomReversed.setUp[����5��8�8�$�$����rNr)rrrr1r1Ys#������%�%�%�%�%rr1c��eZdZd�ZdS)�	TestTuplec�l�tttt������|_dSr&)r.�tuplerrrr's rr(zTestTuple.setUp`s!���u�U�1�X�X���'�'����rNr)rrrr6r6^s#������(�(�(�(�(rr6c��eZdZd�ZdS)�	TestDequec��ttt����}t|��|_|j|_dSr&)rrrr.r�popr �r�ds  rr(zTestDeque.setUpgs-���%��(�(�O�O���q�'�'����e����rNr)rrrr:r:e�#����������rr:c��eZdZd�ZdS)�TestDequeReversedc��ttt����}t|��|_|j|_dSr&)rrrr
rr<r r=s  rr(zTestDequeReversed.setUpns-���%��(�(�O�O���1�+�+����e����rNr)rrrrArAlr?rrAc��eZdZd�ZdS)�TestDictKeysc��t�tt����}t	|��|_|j|_dSr&)�dict�fromkeysrrr.r�popitemr r=s  rr(zTestDictKeys.setUpus3���M�M�%��(�(�#�#���q�'�'����i����rNr)rrrrDrDs�#������ � � � � rrDc��eZdZd�ZdS)�
TestDictItemsc���t�tt����}t	|�����|_|j|_dSr&)	rFrGrrr.�itemsrrHr r=s  rr(zTestDictItems.setUp|s;���M�M�%��(�(�#�#���q�w�w�y�y�/�/����i����rNr)rrrrKrKzrIrrKc��eZdZd�ZdS)�TestDictValuesc���t�tt����}t	|�����|_|j|_dSr&)	rFrGrrr.�valuesrrHr r=s  rr(zTestDictValues.setUp�s=���M�M�%��(�(�#�#���q�x�x�z�z�"�"����i����rNr)rrrrOrO�rIrrOc��eZdZd�ZdS)�TestSetc��ttt����}t|��|_|j|_dSr&)�setrrr.rr<r r=s  rr(z
TestSet.setUp�s-����a���M�M���q�'�'����e����rNr)rrrrSrS�r?rrSc��eZdZd�Zd�ZdS)�TestListc�R�ttt����|_dSr&r-r's rr(zTestList.setUp�r/rc��ttt����}t|��}t	|��t	|��|�t
|��tdz
��|�t��|�t
|��tdz
��g|dd�<|�t
|��d��|�t|��g��|�td����|�t
|��d��dS�N�rr�)	�listrrr.rrr�append�extend�rr>rs   r�
test_mutationzTestList.test_mutation�s����q���N�N��
�!�W�W���R�����R��������R���!�a�%�0�0�0�	�����������R���!�a�%�0�0�0���!�"�"������R���!�,�,�,�����b���2�&�&�&�	����r����������R���!�,�,�,�,�,rN�rrrr(rarrrrWrW�s2������!�!�!�-�-�-�-�-rrWc��eZdZd�Zd�ZdS)�TestListReversedc�R�ttt����|_dSr&r3r's rr(zTestListReversed.setUp�r4rc��ttt����}t|��}t	|��t	|��|�t
|��tdz
��|�t��|�t
|��tdz
��g|dd�<|�t
|��d��|�t|��g��|�td����|�t
|��d��dSrZ)	r]rrr
rrrr^r_r`s   rrazTestListReversed.test_mutation�s����q���N�N��
�a�[�[���R�����R��������R���!�a�%�0�0�0�	�����������R���!�a�%�0�0�0���!�"�"������R���!�,�,�,�����b���2�&�&�&�	����r����������R���!�,�,�,�,�,rNrbrrrrdrd�s2������%�%�%�-�-�-�-�-rrdc��eZdZd�Zd�ZdS)�BadLenc�:�ttd����S�Nr�r.rr's r�__iter__zBadLen.__iter__�����E�"�I�I���rc� �td����N�hello�r!r's r�__len__zBadLen.__len__�����7�#�#�#rN)rrrrlrrrrrrhrh��2���������$�$�$�$�$rrhc��eZdZd�Zd�ZdS)�
BadLengthHintc�:�ttd����Srjrkr's rrlzBadLengthHint.__iter__�rmrc� �td���rorqr's r�__length_hint__zBadLengthHint.__length_hint__�rsrN�rrrrlryrrrrvrv�rtrrvc��eZdZd�Zd�ZdS)�NoneLengthHintc�:�ttd����Srjrkr's rrlzNoneLengthHint.__iter__�rmrc��tSr&)�NotImplementedr's rryzNoneLengthHint.__length_hint__�s���rNrzrrrr|r|�s2�������������rr|c��eZdZd�Zd�ZdS)�TestLengthHintExceptionsc�Z�|�ttt����|�ttt	����|�tgjt����|�tgjt	����t
td����}|�t|jt����|�t|jt	����dSrj)rr!r]rhrvr_�	bytearrayr)r�bs  r�test_issue1242657z*TestLengthHintExceptions.test_issue1242657�s������,��f�h�h�7�7�7����,��m�o�o�>�>�>����,��	�6�8�8�<�<�<����,��	�=�?�?�C�C�C��e�B�i�i� � �����,���&�(�(�;�;�;����,���-�/�/�B�B�B�B�Brc��|�tt����ttd������dSrj)rr]r|rr's r�test_invalid_hintz*TestLengthHintExceptions.test_invalid_hint�s8������n�.�.�/�/��e�B�i�i���A�A�A�A�ArN)rrrr�r�rrrr�r��s:������C�C�C�B�B�B�B�Brr��__main__)�unittest�	itertoolsr�collectionsr�operatorrrrr�TestCaser$r+r1r6r:rArDrKrOrSrWrd�objectrhrvr|r�r�mainrrr�<module>r�s���)�V���������������� � � � � � ���	-�	-�	-�	-�	-�	-�	-�	-�-�-�-�-�-�<�-�-�-� "�"�"�"�"�.��0A�"�"�"�
!�!�!�!�!�.��0A�!�!�!�
%�%�%�%�%�<�h�>O�%�%�%�
(�(�(�(�(�-�x�/@�(�(�(������(�(�*;���������0�(�2C���� � � � � �+�X�->� � � � � � � � �,�h�.?� � � � � � � � �-�x�/@� � � ������&��(9����-�-�-�-�-�,�h�.?�-�-�-�(-�-�-�-�-�4�h�6G�-�-�-�,$�$�$�$�$�V�$�$�$�$�$�$�$�$�F�$�$�$������V����
B�
B�
B�
B�
B�x�0�
B�
B�
B� �z����H�M�O�O�O�O�O��r