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

�Ke��	��ddlZddlZddlZddlZddlZddlmZmZddlZddl	Z	ddl
Z
ddlZddlm
Z
ddlmZmZddlmZejddg���Zejddg�	��Zejd
���ZGd�d��ZGd
�dee
j��ZGd�de
j��Zd���D]Zeeeeee�����[e
j ed��Gd�dee
j����Z!Gd�de��Z"Gd�de!��Z#Gd�de
j��Z$e
j ed��Gd�de
j����Z%Gd�dej&��Z'e
j ed��Gd�d ej&����Z(Gd!�d"ej&��Z)e
j ed��Gd#�d$ej&����Z*Gd%�d&��Z+Gd'�d(��Z,Gd)�d*e,e
j��Z-e
j ed��Gd+�d,e,e
j����Z.e/d-kre
j0��dSdS).�N)�	randrange�shuffle)�MutableMapping)�
mapping_tests�support)�
import_helper�collections�_collections)�blocked)�freshc#�K�tj|}|tj|<	dV�|tj|<dS#|tj|<wxYw�N)�sys�modules)�name�replacement�original_modules   �@/usr/local/apps/python3/lib/python3.11/test/test_ordered_dict.py�replaced_modulersV�����k�$�'�O�#�C�K���,�
����+���D�����O���D��+�+�+�+s	�:�Ac�H�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d �Z"d!�Z#d"�Z$d#�Z%d$�Z&d%�Z'd&�Z(d'�Z)d(�Z*d)�Z+d*�Z,d+�Z-d,�Z.d-�Z/d.�Z0d/�Z1e2j3d0���Z4d1S)2�OrderedDictTestsc�2�|j}|�t��5|ddgd��ddd��n#1swxYwYgd�}|�t	|t|���������|��|�t	|d
it|���������|��|�t||�������|��|�t|gd�dd��������|��|�t|d�	�������d
g��|�t|d��������dg��|�t|d��|�t|d
d
��|�t|j��|gd���}|�ddgdd���|�t|�����gd���dS)N��a���b��rr��c���d���e��rr)r!�	r#r"r(�r!r'�*��self)r.r,��other)r0r,��rrr )r$�,)r'�7r&��f��r%��gr$�rrr r#r&r5)r:r8)	�OrderedDict�assertRaises�	TypeError�assertEqual�sorted�dict�items�list�__init__)r.r<�pairsr$s    r�	test_initzOrderedDictTests.test_init"s����&��
�
�
�y�
)�
)�	4�	4��K��8�,�d�3�3�3�	4�	4�	4�	4�	4�	4�	4�	4�	4�	4�	4����	4�	4�	4�	4�B�B�B��������D��K�K� 8� 8� >� >� @� @�A�A�5�I�I�I������� :� :�d�5�k�k� :� :� @� @� B� B�C�C�U�K�K�K�����k�k�%�0�0�6�6�8�8�9�9�5�A�A�A�����k�k�*R�*R�*R�,-��4�4�4�49�E�G�G�=�=�>C�	E�	E�	E�	
����k�k�r�2�2�2�8�8�:�:�;�;�l�^�L�L�L�����k�k��3�3�3�9�9�;�;�<�<�}�o�N�N�N����)�[�"�5�5�5����)�[�"�b�9�9�9����)�[�%9�:�:�:�
�K�L�L�L�M�M��	�
�
�H�h�'�1��
�2�2�2�����a�g�g�i�i���R�R�R�	T�	T�	T�	T�	T��=�A�Ac���|j}gd�}t|��||��}|di|��}|�t|�����|��dS)Nr;r1)r<rr?rCrB)r.r<rB�argdictr$s     r�test_468zOrderedDictTests.test_468:sn���&��V�V�V��������+�e�$�$���K�"�"�'�"�"������a�g�g�i�i���%�0�0�0�0�0�c�@�|j}|�t��5|���ddgd��ddd��n#1swxYwYgd�}|��}|�t	|����|�t
|�����|��|��}|jdit	|����|�t
|�����|��|��}|�|��|�t|�����|��|��}|�gd�dd���|�t|�����|��|��}|�d�	��|�t|�����d
g��|��}|�i���|�t|�����difg��|��}|�dd
dd���|�t
t|�������gd���|gd���}|�ddgdd���|�t|�����gd���|�t|��jd��|�t|��jdd��|�t|j��|�t|��jd��|�t|��jdd��|�t|j��dS)Nrrrr)r"r(r+�r-)r.rMr/r0r7r8�)�red�bluer0r.))rPr7)r0r8)rOr()r.rNr2r&r5r%r9r;r,r1)	r<r=r>�updaterAr?r@rBrC)r.r<rE�odr$s     r�test_updatezOrderedDictTests.test_updateBs����&��
�
�
�y�
)�
)�	=�	=��K�M�M� � �(�H�!5�t�<�<�<�	=�	=�	=�	=�	=�	=�	=�	=�	=�	=�	=����	=�	=�	=�	=�B�B�B��
�[�]�]��
�	�	�$�u�+�+�����������
�
�+�+�U�3�3�3�
�[�]�]����	� � �D��K�K� � � ��������
�
�+�+�U�3�3�3�
�[�]�]��
�	�	�%��������b�h�h�j�j�)�)�5�1�1�1�
�[�]�]��
�	�	�:�:�:�a�1�	�E�E�E�����b�h�h�j�j�)�)�5�1�1�1��[�]�]��
�	�	�r�	��������b�h�h�j�j�)�)�L�>�:�:�:�
�[�]�]��
�	�	��	��������b�h�h�j�j�)�)�W�b�M�?�;�;�;�
�[�]�]��
�	�	�a�a�q�q�	�1�1�1������R�X�X�Z�Z� 0� 0�1�1�M�M�M�	O�	O�	O�

�K�L�L�L�M�M��	���(�H�%��a��0�0�0�����a�g�g�i�i���R�R�R�	T�	T�	T�	
���)�[�[�]�]�%9�2�>�>�>����)�[�[�]�]�%9�2�r�B�B�B����)�[�%7�8�8�8����)�[�[�]�]�%9�2�>�>�>����)�[�[�]�]�%9�2�r�B�B�B����)�[�%7�8�8�8�8�8s�!A�A�Ac���g�G�fd�d��}|�|����|��dg��dS)Nc�$��eZdZ�fd�Z�fd�ZdS)�.OrderedDictTests.test_init_calls.<locals>.Spamc�2����d��dS)N�keysr1��append�r.�callss �rrXz3OrderedDictTests.test_init_calls.<locals>.Spam.keysss������V�$�$�$��rrKc�2����d��dS)NrBr1rYr[s �rrBz4OrderedDictTests.test_init_calls.<locals>.Spam.itemsvs������W�%�%�%��rrKN)�__name__�
__module__�__qualname__rXrB)r\s�r�SpamrVrsG�������
�
�
�
�
�
�
�
�
�
�
�
rKrarX)r<r?)r.rar\s  @r�test_init_callsz OrderedDictTests.test_init_callspst�����	�	�	�	�	�	�	�	�	�	�	
������� � � �������)�)�)�)�)rKc��|j}|�d��}|�t|�����d�dD����|�dd���}|�t|�����d�dD����|�dd���}|�t|�����d�dD����dS)N�abcc��g|]}|df��Srr1��.0r!s  r�
<listcomp>z2OrderedDictTests.test_fromkeys.<locals>.<listcomp>����+E�+E�+E�!�Q��I�+E�+E�+ErK��valuec��g|]}|df��Srr1rfs  rrhz2OrderedDictTests.test_fromkeys.<locals>.<listcomp>�rirKrc��g|]}|df��S�rr1rfs  rrhz2OrderedDictTests.test_fromkeys.<locals>.<listcomp>�s��+B�+B�+B�q�Q��F�+B�+B�+BrK)r<�fromkeysr?rCrB�r.r<rRs   r�
test_fromkeyszOrderedDictTests.test_fromkeys}s����&��
�
!�
!�%�
(�
(������b�h�h�j�j�)�)�+E�+E�u�+E�+E�+E�F�F�F�
�
!�
!�%�t�
!�
4�
4������b�h�h�j�j�)�)�+E�+E�u�+E�+E�+E�F�F�F�
�
!�
!�%�q�
!�
1�
1������b�h�h�j�j�)�)�+B�+B�E�+B�+B�+B�C�C�C�C�CrKc��|j}|�|��t��|�t	|t����dSr)r<�assertIsInstancer�
assertTrue�
issubclass)r.r<s  r�test_abczOrderedDictTests.test_abc�sH���&�����k�k�m�m�^�<�<�<����
�;��?�?�@�@�@�@�@rKc��|j}gd�}t|��||��}|�t|��t|����|���|�t|��d��dS�N�)r!rr)rr"r#r&r5r)r<rr?�len�clear�r.r<rErRs    r�
test_clearzOrderedDictTests.test_clear�s����&��L�L�L�������
�[��
�
������R���#�e�*�*�-�-�-�
���
�
�
�����R���!�$�$�$�$�$rKc�^�|j}gd�}||��}|d=|�d|��|�t��5|d=ddd��n#1swxYwY|�t|�����|dd�|dd�z��dS)Nryrrr")r<�assertNotInr=�KeyErrorr?rCrBr|s    r�test_delitemzOrderedDictTests.test_delitem�s����&��L�L�L��
�[��
�
���s�G�����b�!�!�!�
�
�
�x�
(�
(�	�	��3��	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�����b�h�h�j�j�)�)�5��!��9�u�Q�R�R�y�+@�A�A�A�A�As�
A�A�!Ac��|j}|gd���}d|d<d|d<|�t|�����gd���dS)N)�r$rrr �rr%r&�
r!�r6)r�r)r!r�r�r&)r6r��r<r?rCrBrps   r�test_setitemzOrderedDictTests.test_setitem�st���&��
�[�K�K�K�
L�
L����3����3������b�h�h�j�j�)�)�W�W�W�	Y�	Y�	Y�	Y�	YrKc��|j}gd�}t|��||��}|�t|��d�|D����|�t|�����d�|D����|�t|�����d�|D����|�t|�����|��|�tt|����d�t|��D����|�tt|�������d�t|��D����|�tt|�������d�t|��D����|�tt|�������tt|������dS)Nryc��g|]
}|d��Srnr1�rg�ts  rrhz3OrderedDictTests.test_iterators.<locals>.<listcomp>�s��#8�#8�#8�Q�A�a�D�#8�#8�#8rKc��g|]
}|d��Srnr1r�s  rrhz3OrderedDictTests.test_iterators.<locals>.<listcomp>�s��*?�*?�*?�A�1�Q�4�*?�*?�*?rKc��g|]
}|d��S�rr1r�s  rrhz3OrderedDictTests.test_iterators.<locals>.<listcomp>����,A�,A�,A�a�Q�q�T�,A�,A�,ArKc��g|]
}|d��Srnr1r�s  rrhz3OrderedDictTests.test_iterators.<locals>.<listcomp>����8�8�8�1�!�A�$�8�8�8rKc��g|]
}|d��Srnr1r�s  rrhz3OrderedDictTests.test_iterators.<locals>.<listcomp>�r�rKc��g|]
}|d��Sr�r1r�s  rrhz3OrderedDictTests.test_iterators.<locals>.<listcomp>�r�rK)r<rr?rCrX�valuesrB�reversedr|s    r�test_iteratorszOrderedDictTests.test_iterators�s����&��L�L�L�������
�[��
�
������b���#8�#8�%�#8�#8�#8�9�9�9�����b�g�g�i�i���*?�*?��*?�*?�*?�@�@�@�����b�i�i�k�k�*�*�,A�,A�5�,A�,A�,A�B�B�B�����b�h�h�j�j�)�)�5�1�1�1�����h�r�l�l�+�+�8�8�����8�8�8�	:�	:�	:�����h�r�w�w�y�y�1�1�2�2�8�8�����8�8�8�	:�	:�	:�����h�r�y�y�{�{�3�3�4�4�8�8�����8�8�8�	:�	:�	:�����h�r�x�x�z�z�2�2�3�3�T�(�5�/�/�5J�5J�K�K�K�K�KrKc��|j}|�d��}t|��}t|��}||=|�t
��5t|��ddd��dS#1swxYwYdS)Nrd)r<ro�iter�nextr=�	Exception)r.r<rR�it�keys     r�%test_detect_deletion_during_iterationz6OrderedDictTests.test_detect_deletion_during_iteration�s����&��
�
!�
!�%�
(�
(��
�"�X�X���2�h�h���s�G�
�
�
�y�
)�
)�	�	�
��H�H�H�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�A5�5A9�<A9c	��|j}|�t��5|ddgd��ddd��n#1swxYwYgd�}||��}|�t	|��d�|D����|�t	|�����d�|D����|�t	|�����d�|D����|�t	|�����|��|�t	t|����t	d�t|��D������dS)Nrrrc��g|]
}|d��Srnr1r�s  rrhz:OrderedDictTests.test_sorted_iterators.<locals>.<listcomp>�s��%:�%:�%:�q�a��d�%:�%:�%:rKc��g|]
}|d��Srnr1r�s  rrhz:OrderedDictTests.test_sorted_iterators.<locals>.<listcomp>�r�rKc��g|]
}|d��Sr�r1r�s  rrhz:OrderedDictTests.test_sorted_iterators.<locals>.<listcomp>�s��.C�.C�.C��q��t�.C�.C�.CrKc��g|]
}|d��Srnr1r�s  rrhz:OrderedDictTests.test_sorted_iterators.<locals>.<listcomp>�s�� ?� ?� ?�!��1�� ?� ?� ?rK)	r<r=r>r?r@rXr�rBr�r|s    r�test_sorted_iteratorsz&OrderedDictTests.test_sorted_iterators�s����&��
�
�
�y�
)�
)�	4�	4��K��8�,�d�3�3�3�	4�	4�	4�	4�	4�	4�	4�	4�	4�	4�	4����	4�	4�	4�	4�B�B�B��
�[��
�
���������%:�%:�E�%:�%:�%:�;�;�;��������	�	�*�*�,A�,A�5�,A�,A�,A�B�B�B������	�	���,�,�.C�.C�U�.C�.C�.C�D�D�D��������
�
�+�+�U�3�3�3���������-�-�� ?� ?�x���� ?� ?� ?�@�@�	B�	B�	B�	B�	BrGc��|j}|��}g}|�t|��|��|�t|�����|��|�t|�����|��|�t|�����|��|�tt
|����|��|�tt
|�������|��|�tt
|�������|��|�tt
|�������|��dSr)r<r?rCrXr�rBr�)r.r<rR�emptys    r�test_iterators_emptyz%OrderedDictTests.test_iterators_empty�sZ���&��
�[�]�]��������b���5�)�)�)�����b�g�g�i�i���%�0�0�0�����b�i�i�k�k�*�*�E�2�2�2�����b�h�h�j�j�)�)�5�1�1�1�����h�r�l�l�+�+�U�3�3�3�����h�r�w�w�y�y�1�1�2�2�E�:�:�:�����h�r�y�y�{�{�3�3�4�4�e�<�<�<�����h�r�x�x�z�z�2�2�3�3�U�;�;�;�;�;rKc��|j}gd�}t|��||��}|r<|�|���|�����|�<|�t��5|���ddd��n#1swxYwY|�t|��d��dSrx)r<rr?�popitem�popr=r�rzr|s    r�test_popitemzOrderedDictTests.test_popitem�s����&��L�L�L�������
�[��
�
���	8����R�Z�Z�\�\�5�9�9�;�;�7�7�7��	8�
�
�
�x�
(�
(�	�	��J�J�L�L�L�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�����R���!�$�$�$�$�$s�>B�B#�&B#c�F�|j}d�td��D��}||��}td��D]}|�d���|�d��|�d���|�t	|��d��dS)Nc��g|]}||f��Sr1r1�rg�is  rrhz6OrderedDictTests.test_popitem_last.<locals>.<listcomp>�s��+�+�+�A�!�Q��+�+�+rK�rNT��lastr�)r<�ranger�r?rz)r.r<rE�objr�s     r�test_popitem_lastz"OrderedDictTests.test_popitem_last�s����&��+�+��r���+�+�+���k�%� � ���q���	�	�A��K�K���������D����������������S���2�&�&�&�&�&rKc�4�|j}gd�}t|��||��}t|��|rB|���\}}|�|�|��|��|�B|�t
��5|�d��ddd��n#1swxYwY|�t
|��d��|�|�|d��d��Gd�d|��}|d���}|�|�d	d
��d
��|�|�dd��d��|�|�dd��d��|�|�dd�
��d��|�t
��5|�d��ddd��dS#1swxYwYdS)Nry�xyzri90c��eZdZd�ZdS)�*OrderedDictTests.test_pop.<locals>.Missingc��dS�Nrr1�r.r�s  r�__missing__z6OrderedDictTests.test_pop.<locals>.Missing.__missing__����qrKN�r^r_r`r�r1rKr�Missingr��#������
�
�
�
�
rKr�r�rrr(rr7��default)r<rr�r?r=r�rz)r.r<rErR�k�vr��ms        r�test_popzOrderedDictTests.test_pop�s����&��L�L�L�������
�[��
�
��������	+��9�9�;�;�D�A�q����R�V�V�A�Y�Y��*�*�*��	+��
�
�x�
(�
(�	�	��F�F�5�M�M�M�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�����R���!�$�$�$��������5�)�)�5�1�1�1�	�	�	�	�	�k�	�	�	�
�G�a�L�L�L��������s�A����*�*�*�������s�A����*�*�*�������s�A����*�*�*�������s�A��.�.��2�2�2�
�
�
�x�
(�
(�	�	�
�E�E�#�J�J�J�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s$�B5�5B9�<B9�*H
�
H�Hc���|j}gd�}t|��||��}||��}|�||��|dd�|dd�z}||��}|�||��|�|t	|����|�t	|��|��|�|||dd�����dS)Nryr���)r<rr?�assertNotEqualrA)r.r<rE�od1�od2s     r�
test_equalityzOrderedDictTests.test_equalitys����&��L�L�L��������k�%� � ���k�%� � ������c�"�"�"��a�b�b�	�E�"�1�"�I�%���k�%� � �����C��%�%�%�����d�3�i�i�(�(�(�����c���C�(�(�(����C���U�3�B�3�Z�!8�!8�9�9�9�9�9rKc	�
����j}gd�}||���dg�_dg�_��fd�}|������tj���}||����|j�j����|j�j����t
|d����tj���}||����|j�j����	|j�j����|j�j����	|j�j����t
|d����td�j��5ttjdz��D]�}��|���5tjtj�|����}||����|j�j����|j�j����t
|d����ddd��n#1swxYwY��	ddd��n#1swxYwY|t%t'�������|��}|����||��||�����dS)	Nry�x�zc����d|�d���}��|�|����|�����t|�����t����������t	|��t	�������t|��t�����dS)Nz
copy: z
od: )�assertIsNotr?rCrBrz�type)�dup�msgrRr.s  ��r�checkz,OrderedDictTests.test_copying.<locals>.check$s�����*-�#�#�r�r�2�C����S�"�c�*�*�*����S�"�%�%�%����T�#�)�)�+�+�.�.��R�X�X�Z�Z�0@�0@�A�A�A����S��X�X�s�2�w�w�/�/�/����T�#�Y�Y��R���1�1�1�1�1rK�yr	r)�proto)r<r�r��copy�assertIs�assertFalse�hasattr�deepcopyr?r�r�moduler��pickle�HIGHEST_PROTOCOL�subTest�loads�dumps�eval�reprrQ)r.r<rEr�r�r��update_testrRs`      @r�test_copyingzOrderedDictTests.test_copyingsW�����&��M�L�L��
�[��
�
���u����u���	2�	2�	2�	2�	2�	2�	��b�g�g�i�i�����i��m�m��
��c�
�
�
��
�
�c�e�R�T�"�"�"��
�
�c�e�R�T�"�"�"������c�*�*�+�+�+��m�B����
��c�
�
�
��������%�%�%��������%�%�%��������%�%�%��������%�%�%������c�*�*�+�+�+�
�]�D�K�
8�
8�	8�	8��v�6��:�;�;�
8�
8���\�\��\�.�.�8�8� �,�v�|�B��'>�'>�?�?�C��E�#�J�J�J��$�$�S�U�B�D�1�1�1��$�$�S�U�B�D�1�1�1��$�$�W�S�#�%6�%6�7�7�7�8�8�8�8�8�8�8�8�8�8�8����8�8�8�8��
8�	8�	8�	8�	8�	8�	8�	8�	8�	8�	8�	8����	8�	8�	8�	8�	��d�4��8�8�n�n����!�k�m�m�����2����
��k����
��k�k�"�o�o�����s7�%5J�BI<�0J�<J�J�J�J�J�Jc��|j}gd�}||��}|�td�|���dD������dS)Nryc3�FK�|]}t|��tkV��dSr)r�rC)rg�pairs  r�	<genexpr>z5OrderedDictTests.test_yaml_linkage.<locals>.<genexpr>Os-����L�L��D��J�J��,�L�L�L�L�L�LrKr)r<rt�all�
__reduce__r|s    r�test_yaml_linkagez"OrderedDictTests.test_yaml_linkageGse���&��M�L�L��
�[��
�
��	
����L�L�������9K�L�L�L�L�L�M�M�M�M�MrKc�|�|j}gd�}||��}|�|jt��|�|���d��d|_|�|jdd��|�|���dddi��dS)Nryrr�r�)r<rs�__dict__rA�assertIsNoner�r�r?r|s    r�test_reduce_not_too_fatz(OrderedDictTests.test_reduce_not_too_fatQs����&��L�L�L��
�[��
�
�����b�k�4�0�0�0����"�-�-�/�/�!�,�-�-�-���������S�)�2�.�.�.����������+�c�2�Y�7�7�7�7�7rKc���|j}|��}||d<td|j��5tdtjdz��D]�}t	jt	j||����}|�||��|�	t|�����dg��|�|d|����	ddd��dS#1swxYwYdS)Nrr	r�)
r<rr�r�r�r�r�r�r�r?rCrXr�)r.r<rRr�r�s     r�test_pickle_recursivez&OrderedDictTests.test_pickle_recursive\s0���&��
�[�]�]����1���]�D�K�
8�
8�	+�	+��r�6�#:�Q�#>�?�?�
+�
+���l�6�<��E�#:�#:�;�;��� � ��b�)�)�)�� � ��c�h�h�j�j�!1�!1�A�3�7�7�7��
�
�c�!�f�c�*�*�*�*�	
+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+�	+����	+�	+�	+�	+�	+�	+s�B0C*�*C.�1C.c�*�|j}|gd���}|�t|��d��|�tt|����|��|�t|����d��dS)NryzIOrderedDict([('c', 1), ('b', 2), ('a', 3), ('d', 4), ('e', 5), ('f', 6)])z
OrderedDict())r<r?r�r�rps   r�	test_reprzOrderedDictTests.test_repris����&��
�[�U�U�U�
V�
V������b���W�	Y�	Y�	Y�����d�2�h�h����,�,�,�����k�k�m�m�,�,�o�>�>�>�>�>rKc��|j}|�d��}||d<|�t|��d��dS)Nrdr�z@OrderedDict([('a', None), ('b', None), ('c', None), ('x', ...)]))r<ror?r�rps   r�test_repr_recursivez$OrderedDictTests.test_repr_recursiveqsX���&��
�
!�
!�%�
(�
(����3������b���N�	P�	P�	P�	P�	PrKc�,�|j}|��}|���|d<t|��}|�|t��|���|d<t|��}|�|t��dS)Nr,)r<r�r�rs�strrB)r.r<rR�rs    r�test_repr_recursive_valuesz+OrderedDictTests.test_repr_recursive_valuesys����&��
�[�]�]��������2����H�H��	
���a��%�%�%�������2����H�H�����a��%�%�%�%�%rKc���|j}gd�}t|��||��}t|�����}|�|�dd��d��|�t|�����|��|�|�dd��d��|�t|�����dd��|�|�dd	�
��d	��Gd�d|��}|�|���d
d	��d	��dS)Nryrr�r"r�r�)r�r�r:r*r�c��eZdZd�ZdS)�1OrderedDictTests.test_setdefault.<locals>.Missingc��dSr�r1r�s  rr�z=OrderedDictTests.test_setdefault.<locals>.Missing.__missing__�r�rKNr�r1rKrr�r�r�rKr�r()r<rrCrBr?�
setdefault)r.r<rErR�
pair_orderr�s      r�test_setdefaultz OrderedDictTests.test_setdefault�sa���&��L�L�L�������
�[��
�
���"�(�(�*�*�%�%�
�������s�B�/�/��3�3�3�����b�h�h�j�j�)�)�:�6�6�6�������s�B�/�/��4�4�4�����b�h�h�j�j�)�)�"�-�y�9�9�9�������s�A��6�6��:�:�:�	�	�	�	�	�k�	�	�	�	
�������-�-�a��3�3�Q�7�7�7�7�7rKc�&�|j}|��}d|d<d|d<|d=|�t|�����dg��d|d<|�t|�����ddg��dS)Nrrrrrrr�rps   r�
test_reinsertzOrderedDictTests.test_reinsert�s����&���[�]�]����3����3���s�G�����b�h�h�j�j�)�)�H�:�6�6�6���3������b�h�h�j�j�)�)�H�h�+?�@�@�@�@�@rKc�x�|j}|�d��}|�t|��td����|�d��|�t|��td����|�dd��|�t|��td����|�dd��|�t|��td����|�d��|�t|��td����|�dd���|�t|��td	����|�t��5|�d
��ddd��n#1swxYwY|�t��5|�d
d��ddd��dS#1swxYwYdS)N�abcder!�abdecF�cabder'rr��bcader�)r<ror?rC�move_to_endr=r�rps   r�test_move_to_endz!OrderedDictTests.test_move_to_end�sR���&��
�
!�
!�'�
*�
*������b���4��=�=�1�1�1�
���s��������b���4��=�=�1�1�1�
���s�E�"�"�"�����b���4��=�=�1�1�1�
���s�E�"�"�"�����b���4��=�=�1�1�1�
���s��������b���4��=�=�1�1�1�
���s���'�'�'�����b���4��=�=�1�1�1�
�
�
�x�
(�
(�	 �	 ��N�N�3����	 �	 �	 �	 �	 �	 �	 �	 �	 �	 �	 ����	 �	 �	 �	 �
�
�
�x�
(�
(�	'�	'��N�N�3��&�&�&�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'����	'�	'�	'�	'�	'�	's$�G&�&G*�-G*�H/�/H3�6H3c��|j}|�d��}|�dd���|�t	|��t	d����|�dd���|�t	|��t	d����|�d��}|�d��|�t	|��t	d����|�d��|�t	|��t	d	����dS)
Nrdr!Fr��cabr�acb�bca�bac)r<rorr?rCrps   r�test_move_to_end_issue25406z,OrderedDictTests.test_move_to_end_issue25406�s���&��
�
!�
!�%�
(�
(��
���s���'�'�'�����b���4��;�;�/�/�/�
���s���'�'�'�����b���4��;�;�/�/�/�
�
!�
!�%�
(�
(��
���s��������b���4��;�;�/�/�/�
���s��������b���4��;�;�/�/�/�/�/rKc��|j}td���}|di|��}|�tj|��tj|����dS)Nrr�r1)r<rA�
assertGreaterr�	getsizeof)r.r<r$rRs    r�test_sizeofzOrderedDictTests.test_sizeof�s\���&���1�I�I�I��
�[�
�
�1�
�
�����3�=��,�,�c�m�A�.>�.>�?�?�?�?�?rKc��|j}d���}|�|��}|�|���t|�������|�|���t|�������dS)Nz@the quick brown fox jumped over a lazy dog yesterday before dawn)r<�splitror?rXrArB)r.r<�srRs    r�
test_viewszOrderedDictTests.test_views�s����&��N�T�T�V�V��
�
!�
!�!�
$�
$����������D��H�H�M�M�O�O�4�4�4���������T�"�X�X�^�^�%5�%5�6�6�6�6�6rKc��|j}Gd�d|��}gd�}|�t||�������|��dS)Nc��eZdZd�ZdS)�3OrderedDictTests.test_override_update.<locals>.MyODc��t���r)r�)r.�args�kwdss   rrQz:OrderedDictTests.test_override_update.<locals>.MyOD.update�s���k�k�!rKN)r^r_r`rQr1rKr�MyODr�s#������
"�
"�
"�
"�
"rKr")rr rr�)r.r<r"rBs    r�test_override_updatez%OrderedDictTests.test_override_update�sy���&��	"�	"�	"�	"�	"�;�	"�	"�	"�/�.�.������d�d�5�k�k�/�/�1�1�2�2�E�:�:�:�:�:rKc��|j}d}td��D]}|d|fg��}�~tj��dS)Ni�)r<r�r�
gc_collect)r.r<r��_s    r�test_highly_nestedz#OrderedDictTests.test_highly_nested�sU���&�����t���	-�	-�A��+��c�{�m�,�,�C�C��������rKc
�.��|j}g�G�fd�d|��}d}td��D]}|d|fg��}||_�~tj��|��t
ttd��������dS)Nc���eZdZ�fd�ZdS)�:OrderedDictTests.test_highly_nested_subclass.<locals>.MyODc�<����|j��dSr)rZr�)r.�deleteds �r�__del__zBOrderedDictTests.test_highly_nested_subclass.<locals>.MyOD.__del__�s������t�v�&�&�&�&�&rKN)r^r_r`r-)r,s�rr"r*�s.�������
'�
'�
'�
'�
'�
'�
'rKr"�d)r<r�r�rr%r?rCr�)r.r<r"r�r�r,s     @r�test_highly_nested_subclassz,OrderedDictTests.test_highly_nested_subclass�s�����&����	'�	'�	'�	'�	'�	'�	'�;�	'�	'�	'����s���	�	�A��$��s��}�%�%�C��C�E�E�����������$�x��c�
�
�';�';�"<�"<�=�=�=�=�=rKc�F�|j}Gd�d��}d�}d}||��}||��}|||����}|��}d||<d||<d||<d|d<||=||=|�t|�����|dfdg��dS)Nc�&�eZdZd�Zd�Zd�Zd�ZdS)�9OrderedDictTests.test_delitem_hash_collision.<locals>.Keyc�V�||_tt|����|_dSr)�_hashr��idrk)r.�hashs  rrDzBOrderedDictTests.test_delitem_hash_collision.<locals>.Key.__init__s ��!��
� ��D���]�]��
�
�
rKc��|jSr)r4r-s r�__hash__zBOrderedDictTests.test_delitem_hash_collision.<locals>.Key.__hash__�
���z�!rKc�F�	|j|jkS#t$rYdSwxYw)NF)rk�AttributeError)r.r0s  r�__eq__z@OrderedDictTests.test_delitem_hash_collision.<locals>.Key.__eq__s8��!��:���4�4��%�!�!�!� �5�5�!���s��
 � c��|jSrrjr-s r�__repr__zBOrderedDictTests.test_delitem_hash_collision.<locals>.Key.__repr__
r9rKN)r^r_r`rDr8r<r>r1rKr�Keyr2�sP������
+�
+�
+�
"�
"�
"�
!�
!�
!�

"�
"�
"�
"�
"rKr?c�2�d}||dz
z}|dz|z|zdzS)NrNrrr1)r6�MINSIZEr�s   r�
blocking_hashzCOrderedDictTests.test_delitem_hash_collision.<locals>.blocking_hash
s-���G����	�!�A���F�a�<�$�&��*�*rKr.�after)rC.r�)	r.r<r?rB�	COLLIDINGr��	colliding�blockingrRs	         r�test_delitem_hash_collisionz,OrderedDictTests.test_delitem_hash_collision�s����&��	"�	"�	"�	"�	"�	"�	"�	"�	+�	+�	+��	��c�)�n�n���C�	�N�N�	��3�}�}�Y�/�/�0�0��
�[�]�]����3����8����9�
���7���x�L��y�M�����b�h�h�j�j�)�)�S�#�J��+G�H�H�H�H�HrKc���|j}Gd�d��}|��}td��D]}|��}|||<�|�t��5t	|�����ddd��n#1swxYwY|�t��5t	|�����ddd��n#1swxYwY|�t��5t|��ddd��n#1swxYwY|�t��5|���ddd��dS#1swxYwYdS)Nc��eZdZd�ZdS)�-OrderedDictTests.test_issue24347.<locals>.Keyc� �td��S)Ni��)rr-s rr8z6OrderedDictTests.test_issue24347.<locals>.Key.__hash__'s�� ��(�(�(rKN�r^r_r`r8r1rKrr?rJ&s#������
)�
)�
)�
)�
)rKr?r.)	r<r�r=r�rCr�rBr�r�)r.r<r?rRr�r�s      r�test_issue24347z OrderedDictTests.test_issue24347#sc���&��	)�	)�	)�	)�	)�	)�	)�	)��[�]�]���s���	�	�A��#�%�%�C��B�s�G�G��
�
�x�
(�
(�	�	����������	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�
�
�
�x�
(�
(�	�	����������	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�
�
�
�x�
(�
(�	�	���H�H�H�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�
�
�
�x�
(�
(�	�	��G�G�I�I�I�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	sH�"B�B�B�-"C�C�"C�D�D �#D �E#�#E'�*E'c��|j}Gd�d��}|��}d||��<|���dS)Nc��eZdZd�ZdS)�-OrderedDictTests.test_issue24348.<locals>.Keyc��dS)Nrr1r-s rr8z6OrderedDictTests.test_issue24348.<locals>.Key.__hash__=r�rKNrLr1rKrr?rP<r�rKr?r)r<r�)r.r<r?rRs    r�test_issue24348z OrderedDictTests.test_issue243489s_���&��	�	�	�	�	�	�	�	��[�]�]����3�3�5�5�	�
�
�
�����rKc��|j}|��}dD]:}dD]5}t|��dkr|�d���||z}|||<�6�;dS)a�
        dict resizes after a certain number of insertion operations,
        whether or not there were deletions that freed up slots in the
        hash table.  During fast node lookup, OrderedDict must correctly
        respond to all resizes, even if the current "size" is the same
        as the old one.  We verify that here by forcing a dict resize
        on a sparse odict and then perform an operation that should
        trigger an odict resize (e.g. popitem).  One key aspect here is
        that we will keep the size of the odict the same at each popitem
        call.  This verifies that we handled the dict resize properly.
        �0123456789ABCDEFr%Fr�N)r<rzr�)r.r<rR�c0�c1r�s      r�test_issue24667z OrderedDictTests.test_issue24667Es{���&��
�[�]�]��$�	�	�B�(�
�
���r�7�7�a�<�<��J�J�E�J�*�*�*��2�g����3���
�	�	rKc��|j}|��}t�|dd��|�dt	|����dS�N�spamr�NULL)r<rA�__setitem__rr�rps   r�test_dict_setitemz"OrderedDictTests.test_dict_setitem^sO���&��
�[�]�]������V�Q�'�'�'������b���*�*�*�*�*rKc��|j}|��}d|d<d|d<t�|d��|�t��5t|��ddd��dS#1swxYwYdS�NrrZr�ham)r<rA�__delitem__r=r�r�rps   r�test_dict_delitemz"OrderedDictTests.test_dict_delitemds����&��
�[�]�]����6�
���5�	�����V�$�$�$�
�
�
�x�
(�
(�	�	���H�H�H�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	��A.�.A2�5A2c��|j}|��}d|d<d|d<t�|��|�dt	|����dS)NrrZrr`r[)r<rAr{rr�rps   r�test_dict_clearz OrderedDictTests.test_dict_clearmsX���&��
�[�]�]����6�
���5�	��
�
�2���������b���*�*�*�*�*rKc��|j}|��}d|d<d|d<t�|d��|�t��5t|��ddd��dS#1swxYwYdSr_)r<rAr�r=r�r�rps   r�
test_dict_popzOrderedDictTests.test_dict_popus����&��
�[�]�]����6�
���5�	�����V����
�
�
�x�
(�
(�	�	���H�H�H�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	rcc���|j}|��}d|d<d|d<t�|��|�t��5t|��ddd��dS#1swxYwYdSr_)r<rAr�r=r�r�rps   r�test_dict_popitemz"OrderedDictTests.test_dict_popitem~s����&��
�[�]�]����6�
���5�	����R����
�
�
�x�
(�
(�	�	���H�H�H�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�A-�-A1�4A1c��|j}|��}t�|dd��|�dt	|����dSrY)r<rArrr�rps   r�test_dict_setdefaultz%OrderedDictTests.test_dict_setdefault�sM���&��
�[�]�]������F�A�&�&�&������b���*�*�*�*�*rKc��|j}|��}t�|dg��|�dt	|����dS)N)rZrr[)r<rArQrr�rps   r�test_dict_updatez!OrderedDictTests.test_dict_update�sM���&��
�[�]�]�����B��
�&�&�&������b���*�*�*�*�*rKc����|j�G�fd�d��}d|j|<tj|��}~t	j��|�|����dS)Nc�$��eZdZ���ZdS)�/OrderedDictTests.test_reference_loop.<locals>.AN)r^r_r`rR)r<s�r�Arp�s�����������B�B�BrKrq)r<rR�weakref�ref�gc�collectr�)r.rqr�r<s   @r�test_reference_loopz$OrderedDictTests.test_reference_loop�s�����&��	�	�	�	�	�	�	�	�	�	����Q���K��N�N��
�
�
�������!�!�#�#�����rKc���tj|t|j��tj|d�|j��tj|d�|j��tj|d�|j��dS)Nc�D�t|�����Sr)r�rX�r$s r�<lambda>z<OrderedDictTests.test_free_after_iterating.<locals>.<lambda>�s��4������>�>�rKc�D�t|�����Sr)r�r�rys rrzz<OrderedDictTests.test_free_after_iterating.<locals>.<lambda>�s��4����
�
�;K�;K�rKc�D�t|�����Sr)r�rBrys rrzz<OrderedDictTests.test_free_after_iterating.<locals>.<lambda>�s��4����	�	�?�?�rK)r�check_free_after_iteratingr�r<r-s r�test_free_after_iteratingz*OrderedDictTests.test_free_after_iterating�st���*�4��t�7G�H�H�H��*�4�1I�1I�4�K[�\�\�\��*�4�1K�1K�T�M]�^�^�^��*�4�1J�1J�D�L\�]�]�]�]�]rKc��|j}|dddd���}|dddd���}|���}|���}||z}|t|�����z}|ddddd���}|�|t|��z|��|�||z|��|�||��|�||��|���}||z}|ddddd���}|�t|��|z|��|�||z|��|�||��|�t||z��|��|�tt|��|z��|��|�t|t|��z��|��|���}|d	z}|d
z}|�||��|�t��5|dzddd��n#1swxYwY|�t��5|d	zddd��n#1swxYwY|�t��5|dzddd��n#1swxYwY|�t��5|d
zddd��n#1swxYwY|�t��5|dz}ddd��dS#1swxYwYdS)Nrr)rrrrr")rrr")rrrr")rrr"rr1��BAD)r<r�rCrBr?rAr�r�r=r>�
ValueError)r.r<rrr!r$�expecteds       r�test_merge_operatorz$OrderedDictTests.test_merge_operator�sa���&���K�A�!��*�*�+�+���K�A�!��*�*�+�+��
�F�F�H�H��
�F�F�H�H��	�Q���	�T�!�'�'�)�)�_�_����;�1��q�Q�7�7�8�8������T�!�W�W��h�/�/�/�����Q���)�)�)�����H�%�%�%�����H�%�%�%�
�F�F�H�H��	�Q����;�1��q�Q�7�7�8�8������a���1��h�/�/�/�����Q���)�)�)�����H�%�%�%��
�
�d�1�q�5�k�k�;�/�/�/��
�
�d�4��7�7�Q�;�'�'��5�5�5��
�
�d�1�t�A�w�w�;�'�'��5�5�5��6�6�8�8��	�R���	�R�������H�%�%�%�
�
�
�y�
)�
)�	�	�
��H�H�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�
�
�
�y�
)�
)�	�	�
��F�F�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�
�
�
�y�
)�
)�	�	�
��I�I�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�
�
�
�y�
)�
)�	�	�
��F�F�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�
�
�
�z�
*�
*�	�	�
��J�A�	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	sZ�
I�I �#I �J�J�J�8K
�
K�K�/L�L�L�&L9�9L=�L=c��t|�dgi�������}tj��|�tjt|������dSr)r�r<rBrtrurt�
is_trackedr�)r.r�s  r�!test_ordered_dict_items_result_gcz2OrderedDictTests.test_ordered_dict_items_result_gc�sd��
�$�"�"�D�"�:�.�.�4�4�6�6�
7�
7��
�
����	
����
�d�2�h�h�/�/�0�0�0�0�0rKN)5r^r_r`rFrJrSrbrqrvr}r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrr
rrrr#r'r/rGrMrRrWr]rbrergrirkrmrvr~r�r�cpython_onlyr�r1rKrrr s������T�T�T�01�1�1�,9�,9�,9�\*�*�*�D�D�D�A�A�A�
%�%�%�B�B�B�Y�Y�Y�L�L�L�"	�	�	�B�B�B�<�<�<�	%�	%�	%�	'�	'�	'����4:�:�:� )�)�)�VN�N�N�	8�	8�	8�+�+�+�?�?�?�P�P�P�&�&�&�8�8�8�(
A�
A�
A�'�'�'�&0�0�0�@�@�@�7�7�7�;�;�;�	�	�	�>�>�>�"%I�%I�%I�N���,
�
�
����2+�+�+����+�+�+�������+�+�+�+�+�+�	�	�	�^�^�^�)�)�)�V
��	1�	1���	1�	1�	1rKrc� �eZdZeZejZdS)�PurePythonOrderedDictTestsN�r^r_r`�py_collr�r<r1rKrr�r��s������
�F��%�K�K�KrKr�c��eZdZdZeZeZdS)�CPythonBuiltinDictTestszaBuiltin dict preserves insertion order.

    Reuse some of tests in OrderedDict selectively.
    N)r^r_r`�__doc__�builtinsr�rAr<r1rKrr�r��s$��������
�F��K�K�KrKr�z�test_init test_update test_abc test_clear test_delitem test_setitem test_detect_deletion_during_iteration test_popitem test_reinsert test_override_update test_highly_nested test_highly_nested_subclass test_delitem_hash_collision z0requires the C version of the collections modulec�z�eZdZeZejZejZejd���Z	d�Z
d�Zejd���ZdS)�CPythonOrderedDictTestsc��|j}tj}tj}|j}|d��}|d��}|d��}|d��}|d��}	|��}
||
|��d|
_||
|��|
�d�td��D����||
||zd	|zzd	zd
|zzd|	zz��|
�d�tdd��D����||
||zd
|zzd
zd|zzd|	zz��||
�	��|d����||
�
��|d����||
���|d����|d��}|t|
��|��|t|
�	����|��|t|
�
����|��|t|
�����|��dS)N�nQ2P3PnPn2P�n2BI2n�n2P�P�Pn2Prc��g|]}||f��Sr1r1r�s  rrhz=CPythonOrderedDictTests.test_sizeof_exact.<locals>.<listcomp>
s��,�,�,�a�A�q�6�,�,�,rKr"rNr(c��g|]}||f��Sr1r1r�s  rrhz=CPythonOrderedDictTests.test_sizeof_exact.<locals>.<listcomp>s��0�0�0�a�A�q�6�0�0�0rKr���iP2n2P)
r<�struct�calcsizer�calcobjsize�check_sizeofr�rQr�rXrBr�r�)r.r<r��sizer��	basicsize�keysize�	entrysize�p�nodesizerR�itersizes            r�test_sizeof_exactz)CPythonOrderedDictTests.test_sizeof_exact�sR���&���?���"���!���D�+�,�,�	��(�8�$�$���H�U�O�O�	��H�S�M�M���8�F�#�#��
�[�]�]��
��b�)�������
��b�)����
�	�	�,�,�5��8�8�,�,�,�-�-�-�
��b�)�g�%��!��+�a�/�!�I�+�=��(�
�J�K�K�K�
�	�	�0�0�5��B�<�<�0�0�0�1�1�1�
��b�)�g�%��1��,�r�1�B�y�L�@�2�h�;�N�O�O�O�
��b�g�g�i�i���c���#�#�#�
��b�h�h�j�j�$�$�s�)�)�$�$�$�
��b�i�i�k�k�4�4��9�9�%�%�%��4��>�>��
��d�2�h�h��!�!�!�
��d�2�7�7�9�9�o�o�x�(�(�(�
��d�2�8�8�:�:����)�)�)�
��d�2�9�9�;�;����*�*�*�*�*rKc���|j}|�d��}|�t|��td����|�t
��5t
|��D]0\}}|�|��|�|d���1	ddd��n#1swxYwY|�t
��5|D]}d|d<�	ddd��n#1swxYwY|�t
��5|D]}|d=�	ddd��n#1swxYwY|�t|��td����dS)Nrr(r6r!�bdeaf)	r<ror?rCr=�RuntimeError�	enumerater�
assertLess)r.r<rRr�r�s     r� test_key_change_during_iterationz8CPythonOrderedDictTests.test_key_change_during_iterations+���&��
�
!�
!�'�
*�
*������b���4��=�=�1�1�1�
�
�
�|�
,�
,�	&�	&�!�"�
�
�
&�
&���1����q�!�!�!�����1�%�%�%�%�
&�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&�	&����	&�	&�	&�	&��
�
�|�
,�
,�	�	��
�
����3���
�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	��
�
�|�
,�
,�	�	��
�
���s�G�G�
�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	
����b���4��=�=�1�1�1�1�1s7�'AB5�5B9�<B9�C2�2C6�9C6�	D-�-D1�4D1c�d�|j}gd�}||��}dD�]}t||��}t|����dd�}ttjdz��D]�}|�||���5t|����}t|��t	j	||��}	t	j
|	��}
|�t|
��|��|�t|��|��ddd��n#1swxYwY�ǐ�dS)Nry)rXr�rBr)�method_name�protocol)r<�getattrrCr�r�r�r�r�r�r�r�r?)r.r<rErRr��methr�r�r�r��	unpickleds           r�test_iterators_picklingz/CPythonOrderedDictTests.test_iterators_pickling-sh���&��L�L�L��
�[��
�
��6�
	9�
	9�K��2�{�+�+�D��D�D�F�F�|�|�A�B�B�'�H��6�2�Q�6�7�7�
9�
9���\�\�k�A�\�F�F�9�9��d�d�f�f���B���H�H�H���R��+�+�A� &��Q���I��$�$�T�)�_�_�h�?�?�?��$�$�T�"�X�X�x�8�8�8�
9�9�9�9�9�9�9�9�9�9�9����9�9�9�9��
9�
	9�
	9s�BD"�"D&�)D&c��tj��|���}||_g}|�|��tj|��}|�|��~~~tj��dSr)rtrur<�cyclerZrrrs)r.r�r��x_refs    r�"test_weakref_list_is_not_traversedz:CPythonOrderedDictTests.test_weakref_list_is_not_traversed>ss��
	�
���������������
���U������A����
���U����
�u�e�
�
�����rKN)
r^r_r`�c_collr�r<rr�r�r�r�r�r�r1rKrr�r��s��������F��$�K��'�L���+�+���+�@2�2�2�"9�9�9�"
��������rKr�c�8�eZdZeZGd�dej��ZdS)�"PurePythonOrderedDictSubclassTestsc��eZdZdS)�.PurePythonOrderedDictSubclassTests.OrderedDictN�r^r_r`r1rKrr<r�V��������rKr<Nr�r1rKrr�r�SsF������
�F�
�
�
�
�
�g�)�
�
�
�
�
rKr�c�8�eZdZeZGd�dej��ZdS)�CPythonOrderedDictSubclassTestsc��eZdZdS)�+CPythonOrderedDictSubclassTests.OrderedDictNr�r1rKrr<r�]r�rKr<N)r^r_r`r�r�r<r1rKrr�r�ZsF������
�F�
�
�
�
�
�f�(�
�
�
�
�
rKr�c�F�eZdZeZGd�dej��ZejZdS)�*PurePythonOrderedDictWithSlotsCopyingTestsc��eZdZdZdS)�6PurePythonOrderedDictWithSlotsCopyingTests.OrderedDict�r�r�N�r^r_r`�	__slots__r1rKrr<r�d��������	�	�	rKr<N)r^r_r`r�r�r<rr�r1rKrr�r�asH������
�F������g�)����#�0�L�L�LrKr�c�F�eZdZeZGd�dej��ZejZdS)�'CPythonOrderedDictWithSlotsCopyingTestsc��eZdZdZdS)�3CPythonOrderedDictWithSlotsCopyingTests.OrderedDictr�Nr�r1rKrr<r�mr�rKr<N)r^r_r`r�r�r<rr�r1rKrr�r�isJ�������F������f�(����#�0�L�L�LrKr�c�*�eZdZed���Zd�ZdS)�PurePythonGeneralMappingTestsc�(�tj|_dSr�r�r<�	type2test��clss r�
setUpClassz(PurePythonGeneralMappingTests.setUpClassts���+��
�
�
rKc�n�|���}|�t|j��dSr��_empty_mappingr=r�r��r.r$s  rr�z*PurePythonGeneralMappingTests.test_popitemx�1�����!�!�����(�A�I�.�.�.�.�.rKN�r^r_r`�classmethodr�r�r1rKrr�r�rs<�������,�,��[�,�/�/�/�/�/rKr�c�*�eZdZed���Zd�ZdS)�CPythonGeneralMappingTestsc�(�tj|_dSr�r�r<r�r�s rr�z%CPythonGeneralMappingTests.setUpClass�s���*��
�
�
rKc�n�|���}|�t|j��dSrr�r�s  rr�z'CPythonGeneralMappingTests.test_popitem�r�rKNr�r1rKrr�r�}s>�������+�+��[�+�/�/�/�/�/rKr�c�*�eZdZed���Zd�ZdS)�PurePythonSubclassMappingTestsc�D�Gd�dtj��}||_dS)Nc��eZdZdS)�@PurePythonSubclassMappingTests.setUpClass.<locals>.MyOrderedDictNr�r1rKr�
MyOrderedDictr����������DrKr�r��r�r�s  rr�z)PurePythonSubclassMappingTests.setUpClass�s:��	�	�	�	�	�G�/�	�	�	�%��
�
�
rKc�n�|���}|�t|j��dSrr�r�s  rr�z+PurePythonSubclassMappingTests.test_popitem�r�rKNr�r1rKrr�r��s<�������&�&��[�&�
/�/�/�/�/rKr�c�*�eZdZed���Zd�ZdS)�CPythonSubclassMappingTestsc�D�Gd�dtj��}||_dS)Nc��eZdZdS)�=CPythonSubclassMappingTests.setUpClass.<locals>.MyOrderedDictNr�r1rKrr�r��r�rKr�r�r�s  rr�z&CPythonSubclassMappingTests.setUpClass�s:��	�	�	�	�	�F�.�	�	�	�%��
�
�
rKc�n�|���}|�t|j��dSrr�r�s  rr�z(CPythonSubclassMappingTests.test_popitem�r�rKNr�r1rKrr�r��s>�������&�&��[�&�
/�/�/�/�/rKr�c�<��eZdZ�fd�Z�fd�Z�fd�Z�fd�Z�xZS)�SimpleLRUCachec���t�����||_t�dd��|_dS)N��get�set�delr)�superrDr�rAro�counts)r.r��	__class__s  �rrDzSimpleLRUCache.__init__�s:���
����������	��m�m�$9�1�=�=����rKc���|jdxxdz
cc<t���|��}|�|��|S)Nr�r)r�r��__getitem__r)r.�itemrkr�s   �rr�zSimpleLRUCache.__getitem__�sQ�����E����a��������#�#�D�)�)����������rKc�<��|jdxxdz
cc<||vrJt|��|jkr2|�d���||vrt|��|jk�2t	���||��|�|��dS)Nr�rFr�)r�rzr�r�r�r\r)r.r�rkr�s   �rr\zSimpleLRUCache.__setitem__�s������E����a�������o�o�#�d�)�)�t�y�"8�"8��L�L�e�L�$�$�$���o�o�#�d�)�)�t�y�"8�"8�
�����C��'�'�'���������rKc�t��|jdxxdz
cc<t���|��dS)Nr�r)r�r�ra)r.r�r�s  �rrazSimpleLRUCache.__delitem__�s?�����E����a�����
�����C� � � � � rK)r^r_r`rDr�r\ra�
__classcell__)r�s@rr�r��s��������>�>�>�>�>�
����������!�!�!�!�!�!�!�!�!rKr�c�&�eZdZd�Zd�Zd�Zd�ZdS)�SimpleLRUCacheTestsc��|�d��}d|d<d|d<d|d<|�|jdddd���|�t|��ddg��|�|jdddd���dS)	Nrr�t1�t2r"�t3rr�)r�r?r�rC)r.r!s  r�test_add_after_fullz'SimpleLRUCacheTests.test_add_after_full�s����N�N�1������$����$����$�������1�Q�q�#A�#A�B�B�B�����a���4��,�/�/�/������1�Q�q�#A�#A�B�B�B�B�BrKc�F�|�d��}tdd��D]}|||<�|�|�d���d��|�|�d���d��|�|jd	dd	d
���dS)Nr"rr%Fr�)rrT)r"r"rr�)r�r�r?r�r��r.r!r�s   rr�z SimpleLRUCacheTests.test_popitem�s����N�N�1�����q�!���	�	�A��A�a�D�D���������.�.��7�7�7���������-�-�v�6�6�6������1�Q�q�#A�#A�B�B�B�B�BrKc�@�|�d��}tdd��D]}|||<�|�|jdddd���|�|�d��d��|�|jdddd���|�|�dd��d��|�|jdddd���|�t|jd��|�|jdddd���dS)Nr"rr%rr�r)r�r�r?r�r�r=r�rs   rr�zSimpleLRUCacheTests.test_pop�s���N�N�1�����q�!���	�	�A��A�a�D�D������1�Q�q�#A�#A�B�B�B�������q���1�%�%�%������1�Q�q�#A�#A�B�B�B�������q�!���a�(�(�(������1�Q�q�#A�#A�B�B�B����(�A�E�1�-�-�-������1�Q�q�#A�#A�B�B�B�B�BrKc	���|�d��}tdd��D]}|||<�|�t|��ttdd������|�|jdddd���|�|dd��|�|jdddd���|�t|��gd���dS)Nr"rr%rr�r)rr"r)r�r�r?rCr�rs   r�test_change_order_on_getz,SimpleLRUCacheTests.test_change_order_on_get�s����N�N�1�����q�!���	�	�A��A�a�D�D�����a���$�u�Q��{�{�"3�"3�4�4�4������1�Q�q�#A�#A�B�B�B�����1��q�!�!�!������1�Q�q�#A�#A�B�B�B�����a���)�)�)�,�,�,�,�,rKN)r^r_r`r
r�r�rr1rKrrr�sY������C�C�C�C�C�C�
C�
C�
C�-�-�-�-�-rKrc�6�eZdZGd�deej��ZdS)�PySimpleLRUCacheTestsc��eZdZdS)�PySimpleLRUCacheTests.type2testNr�r1rKrr�r�r�rKr�N)r^r_r`r�r�r<r�r1rKrrr�sC������
�
�
�
�
�N�G�$7�
�
�
�
�
rKrc�$�eZdZed���ZdS)�CSimpleLRUCacheTestsc�P�Gd�dttj��}||_dS)Nc��eZdZdS)�2CSimpleLRUCacheTests.setUpClass.<locals>.type2testNr�r1rKrr�r�r�rKr�)r�r�r<r�)r�r�s  rr�zCSimpleLRUCacheTests.setUpClass�s<��	�	�	�	�	���(:�	�	�	�!��
�
�
rKN)r^r_r`r�r�r1rKrrr�s/�������"�"��[�"�"�"rKr�__main__)1r��
contextlibr�rtr��randomrrr�r�unittestrr�collections.abcr�testrr�test.supportr�import_fresh_moduler�r��contextmanagerrr�TestCaser�r�r�method�setattrr��
skipUnlessr�r�r�r�r��BasicTestMappingProtocolr�r�r�r�r�rrrr^�mainr1rKr�<module>r(s���������������	�	�	�	�
�
�
�
�%�%�%�%�%�%�%�%�
�
�
�
�
�
�
�
���������*�*�*�*�*�*�'�'�'�'�'�'�'�'�&�&�&�&�&�&�,�-�
+�M�5C�4D�F�F�F��	*��	*�=�2@�1A�
C�
C�
C����,�,���,�y
1�y
1�y
1�y
1�y
1�y
1�y
1�y
1�v&�&�&�&�&�!1�8�3D�&�&�&������h�/����#�%*�E�G�G�P�P�F��G�#�V�W�W�5E�v�-N�-N�O�O�O�O�
����V�O�P�P�[�[�[�[�[�.��0A�[�[�Q�P�[�|
�
�
�
�
�)C�
�
�
�
�
�
�
�
�&=�
�
�
�1�1�1�1�1��1B�1�1�1����V�O�P�P�1�1�1�1�1�h�.?�1�1�Q�P�1�/�/�/�/�/�M�$J�/�/�/����V�O�P�P�/�/�/�/�/��!G�/�/�Q�P�/�
/�
/�
/�
/�
/�]�%K�
/�
/�
/����V�O�P�P�
/�
/�
/�
/�
/�-�"H�
/�
/�Q�P�
/�!�!�!�!�!�!�!�!�2'-�'-�'-�'-�'-�'-�'-�'-�T
�
�
�
�
�/��1B�
�
�
����V�O�P�P�"�"�"�"�"�.��0A�"�"�Q�P�"��z����H�M�O�O�O�O�O��rK