HEX
Server: Apache
System: Linux bd12.noc223.com 4.18.0-553.121.1.lve.el8.x86_64 #1 SMP Thu Apr 30 16:40:41 UTC 2026 x86_64
User: handcraf (1693)
PHP: 8.1.28
Disabled: NONE
Upload Files
File: //opt/alt/python312/lib64/python3.12/test/__pycache__/test_ordered_dict.cpython-312.pyc
�

�h�ev��	��ddlZddlZddlZddlZddlZddlmZmZddlZddl	Z	ddl
Z
ddlZddlm
Z
ddlmZmZddlmZej&ddg��Zej&ddg�	�Zej,d
��ZGd�d�ZGd
�dee
j2�ZGd�de
j2�Zdj9�D]Zeeeeee���[e
j@ed�Gd�dee
j2��Z!Gd�de�Z"Gd�de!�Z#Gd�de
j2�Z$e
j@ed�Gd�de
j2��Z%Gd�dejL�Z'e
j@ed�Gd�d ejL��Z(Gd!�d"ejL�Z)e
j@ed�Gd#�d$ejL��Z*Gd%�d&�Z+Gd'�d(�Z,Gd)�d*e,e
j2�Z-e
j@ed�Gd+�d,e,e
j2��Z.e/d-k(re
j`�yy).�N)�	randrange�shuffle)�MutableMapping)�
mapping_tests�support)�
import_helper�collections�_collections)�blocked)�freshc#�K�tj|}|tj|<	d��|tj|<y#|tj|<wxYw�w�N)�sys�modules)�name�replacement�original_modules   �=/opt/alt/python312/lib64/python3.12/test/test_ordered_dict.py�replaced_modulersF�����k�k�$�'�O�#�C�K�K���,�
�+����D���O����D��s�'A�A�A�A�Ac�P�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/�Z1d0�Z2e3jhd1��Z5y2)3�OrderedDictTestsc�.�|j}|jt�5|ddgd�ddd�gd�}|jt	|t|��j
��|�|jt	|d
it|���j
��|�|jt||�j
��|�|jt|gd�dd��j
��|�|jt|d�	�j
��d
g�|jt|d��j
��dg�|jt|d�|jt|d
d
�|jt|j�|gd��}|jddgdd��|jt|j
��gd��y#1swY���xYw)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���8�,�d�3�	4�B�������D��K� 8� >� >� @�A�5�I������ :�d�5�k� :� @� @� B�C�U�K�����k�%�0�6�6�8�9�5�A�����k�*R�,-��4�49�E�G�=�>C�	E�	
����k�r�2�8�8�:�;�l�^�L�����k��3�9�9�;�<�}�o�N����)�[�"�5����)�[�"�b�9����)�[�%9�%9�:�
�L�M��	�
�
�H�h�'�1��
�2�����a�g�g�i��R�	T�'	4�	4�s�H
�
Hc��|j}gd�}t|�||�}|di|��}|jt|j	��|�y)Nr;r1)r<rr?rCrB)r.r<rB�argdictr$s     r�test_468zOrderedDictTests.test_468:sJ���&�&��V������e�$���"�'�"������a�g�g�i��%�0�c���|j}|jt�5|�jddgd�ddd�gd�}|�}|jt	|��|jt
|j��|�|�}|jdit	|���|jt
|j��|�|�}|j|�|jt|j��|�|�}|jgd�dd��|jt|j��|�|�}|jd�	�|jt|j��d
g�|�}|ji��|jt|j��difg�|�}|jdd
dd��|jt
t|j���gd��|gd��}|jddgdd��|jt|j��gd��|jt|�jd�|jt|�jdd�|jt|j�|jt|�jd�|jt|�jdd�|jt|j�y#1swY��(xYw)Nrrrr)r"r(r+�r-)r.rLr/r0r7r8�)�red�bluer0r.))rOr7)r0r8)rNr()r.rMr2r&r5r%r9r;r,r1)	r<r=r>�updaterAr?r@rBrC)r.r<rE�odr$s     r�test_updatezOrderedDictTests.test_updateBs����&�&��
�
�
�y�
)�	=��M� � �(�H�!5�t�<�	=�B��
�]��
�	�	�$�u�+���������
�+�U�3�
�]����	�	� �D��K� ��������
�+�U�3�
�]��
�	�	�%������b�h�h�j�)�5�1�
�]��
�	�	�:�a�1�	�E�����b�h�h�j�)�5�1��]��
�	�	�r�	������b�h�h�j�)�L�>�:�
�]��
�	�	��	������b�h�h�j�)�W�b�M�?�;�
�]��
�	�	�a�a�q�q�	�1������R�X�X�Z� 0�1�M�	O�

�L�M��	���(�H�%��a��0�����a�g�g�i��R�	T�	
���)�[�]�%9�%9�2�>����)�[�]�%9�%9�2�r�B����)�[�%7�%7�8����)�[�]�%9�%9�2�>����)�[�]�%9�%9�2�r�B����)�[�%7�%7�8�U	=�	=�s�M"�"M,c�t��g�G�fd�d�}|j|��|j�dg�y)Nc�"��eZdZ�fd�Z�fd�Zy)�.OrderedDictTests.test_init_calls.<locals>.Spamc�(���jd�y)N�keysr1��append�r.�callss �rrWz3OrderedDictTests.test_init_calls.<locals>.Spam.keysss������V�$�rJc�(���jd�y)NrBr1rXrZs �rrBz4OrderedDictTests.test_init_calls.<locals>.Spam.itemsvs������W�%�rJN)�__name__�
__module__�__qualname__rWrB)r[s�r�SpamrUrs
���
�
rJr`rW)r<r?)r.r`r[s  @r�test_init_callsz OrderedDictTests.test_init_callsps6�����	�	�	
����� �������)rJc�J�|j}Gd�d|�}|�}d|d<y)Nc��eZdZd�Zy)�3OrderedDictTests.test_overridden_init.<locals>.ODNIc��yrr1)�args�kwargss  rrDz<OrderedDictTests.test_overridden_init.<locals>.ODNI.__init__�s��rJN)r]r^r_rDr1rJr�ODNIrd�s��
rJrhrr�r<)r.r<rhrQs    r�test_overridden_initz%OrderedDictTests.test_overridden_init}s-���&�&��	�;�	��V����3�rJc��|j}|jd�}|jt|j	��dD�cgc]}|df��c}�|jdd��}|jt|j	��dD�cgc]}|df��c}�|jdd��}|jt|j	��dD�cgc]}|df��c}�ycc}wcc}wcc}w)N�abc��valuer)r<�fromkeysr?rCrB)r.r<rQr!s    r�
test_fromkeyszOrderedDictTests.test_fromkeys�s����&�&��
�
!�
!�%�
(������b�h�h�j�)�u�+E�!�Q��I�+E�F�
�
!�
!�%�t�
!�
4������b�h�h�j�)�u�+E�!�Q��I�+E�F�
�
!�
!�%�q�
!�
1������b�h�h�j�)�E�+B�q�Q��F�+B�C��	,F��+E��+Bs�C0
�C5
�C:
c��|j}|j|�t�|jt	|t��yr)r<�assertIsInstancer�
assertTrue�
issubclass)r.r<s  r�test_abczOrderedDictTests.test_abc�s2���&�&�����k�m�^�<����
�;��?�@rJc���|j}gd�}t|�||�}|jt|�t|��|j	�|jt|�d�y�N�)r!rr)rr"r#r&r5r)r<rr?�len�clear�r.r<rErQs    r�
test_clearzOrderedDictTests.test_clear�sX���&�&��L�����
��
������R��#�e�*�-�
���
�����R��!�$rJc��|j}gd�}||�}|d=|jd|�|jt�5|d=ddd�|j	t|j
��|dd|ddz�y#1swY�<xYw)Nrxrrr")r<�assertNotInr=�KeyErrorr?rCrBr{s    r�test_delitemzOrderedDictTests.test_delitem�s����&�&��L��
��
���s�G�����b�!�
�
�
�x�
(�	��3��	�����b�h�h�j�)�5��!�9�u�Q�R�y�+@�A�	�	�s�B�Bc��|j}|gd��}d|d<d|d<|jt|j��gd��y)N)�r$rrr �rr%r&�
r!�r6)r�r)r!r�r�r&)r6r��r<r?rCrB�r.r<rQs   r�test_setitemzOrderedDictTests.test_setitem�sI���&�&��
�K�
L����3����3������b�h�h�j�)�W�	YrJc�L�|j}gd�}t|�||�}|jt|�|D�cgc]}|d��	c}�|jt|j	��|D�cgc]}|d��	c}�|jt|j��|D�cgc]}|d��	c}�|jt|j
��|�|jtt|��t|�D�cgc]}|d��	c}�|jtt|j	���t|�D�cgc]}|d��	c}�|jtt|j���t|�D�cgc]}|d��	c}�|jtt|j
���tt|���ycc}wcc}wcc}wcc}wcc}wcc}w)Nrxrr)r<rr?rCrW�valuesrB�reversed�r.r<rErQ�ts     r�test_iteratorszOrderedDictTests.test_iterators�s����&�&��L�����
��
������b��%�#8�Q�A�a�D�#8�9�����b�g�g�i���*?�A�1�Q�4�*?�@�����b�i�i�k�*�5�,A�a�Q�q�T�,A�B�����b�h�h�j�)�5�1�����h�r�l�+�(0���8�1�!�A�$�8�	:�����h�r�w�w�y�1�2�(0���8�1�!�A�$�8�	:�����h�r�y�y�{�3�4�(0���8�1�!�A�$�8�	:�����h�r�x�x�z�2�3�T�(�5�/�5J�K��$9��*?��,A��9��8��8s#�H
�7H
�1H
�H
�$H
�0H!
c���|j}|jd�}t|�}t|�}||=|j	t
�5t|�ddd�y#1swYyxYw)Nrl)r<ro�iter�nextr=�	Exception)r.r<rQ�it�keys     r�%test_detect_deletion_during_iterationz6OrderedDictTests.test_detect_deletion_during_iteration�sb���&�&��
�
!�
!�%�
(��
�"�X���2�h���s�G�
�
�
�y�
)�	�
��H�	�	�	�s�A!�!A*c
���|j}|jt�5|ddgd�ddd�gd�}||�}|jt	|�|D�cgc]}|d��	c}�|jt	|j��|D�cgc]}|d��	c}�|jt	|j
��|D�cgc]}|d��	c}�|jt	|j��|�|jt	t|��t	t|�D�cgc]}|d��	c}��y#1swY��'xYwcc}wcc}wcc}wcc}w)Nrrrrr)	r<r=r>r?r@rWr�rBr�r�s     r�test_sorted_iteratorsz&OrderedDictTests.test_sorted_iterators�s%���&�&��
�
�
�y�
)�	4���8�,�d�3�	4�B��
��
��������E�%:�q�a��d�%:�;��������	�*�5�,A�a�Q�q�T�,A�B������	�	��,�U�.C��q��t�.C�D��������
�+�U�3��������-��x��� ?�!��1�� ?�@�	B�	4�	4��&;��,A��.C��!@s#�E�E 
�E%
�E*
�;E/�Ec���|j}|�}g}|jt|�|�|jt|j��|�|jt|j	��|�|jt|j��|�|jtt
|��|�|jtt
|j���|�|jtt
|j	���|�|jtt
|j���|�yr)r<r?rCrWr�rBr�)r.r<rQ�emptys    r�test_iterators_emptyz%OrderedDictTests.test_iterators_empty�s����&�&��
�]��������b��5�)�����b�g�g�i��%�0�����b�i�i�k�*�E�2�����b�h�h�j�)�5�1�����h�r�l�+�U�3�����h�r�w�w�y�1�2�E�:�����h�r�y�y�{�3�4�e�<�����h�r�x�x�z�2�3�U�;rJc�Z�|j}gd�}t|�||�}|r1|j|j�|j	��|r�1|jt�5|j�ddd�|jt|�d�y#1swY�%xYwrw)r<rr?�popitem�popr=rryr{s    r�test_popitemzOrderedDictTests.test_popitem�s����&�&��L�����
��
������R�Z�Z�\�5�9�9�;�7��
�
�
�x�
(�	��J�J�L�	�����R��!�$�	�	�s�,B!�!B*c�(�|j}td�D�cgc]}||f��}}||�}td�D]}|jd��|jd�|jd��|jt	|�d�ycc}w)N�rMT��lastr�)r<�ranger�r?ry)r.r<�irE�objs     r�test_popitem_lastz"OrderedDictTests.test_popitem_last�s����&�&��!&�r��+�A�!�Q��+��+��%� ���q��	�A��K�K���	����D������������S��2�&��,s�Bc�t�|j}gd�}t|�||�}t|�|r7|j�\}}|j|j|�|�|r�7|j	t
�5|jd�ddd�|jt
|�d�|j|jd�d�Gd�d|�}|d��}|j|jd	d
�d
�|j|jdd�d�|j|jdd�d�|j|jdd�
�d�|j	t
�5|jd�ddd�y#1swY��xYw#1swYyxYw)Nrx�xyzri90c��eZdZd�Zy)�*OrderedDictTests.test_pop.<locals>.Missingc��y�Nrr1�r.r�s  r�__missing__z6OrderedDictTests.test_pop.<locals>.Missing.__missing__
���rJN�r]r^r_r�r1rJr�Missingr����
rJr�r�rrr(rr7��default)r<rr�r?r=rry)r.r<rErQ�k�vr��ms        r�test_popzOrderedDictTests.test_pop�sm���&�&��L�����
��
�������9�9�;�D�A�q����R�V�V�A�Y��*���
�
�x�
(�	��F�F�5�M�	�����R��!�$��������5�)�5�1�	�k�	�
�a�L��������s�A���*�������s�A���*�������s�A���*�������s�A��.��2�
�
�
�x�
(�	�
�E�E�#�J�	�	�	�	��	�	�s�=F!�F.�!F+�.F7c�j�|j}gd�}t|�||�}||�}|j||�|dd|ddz}||�}|j||�|j|t	|��|jt	|�|�|j|||dd��y)Nrxr���)r<rr?�assertNotEqualrA)r.r<rE�od1�od2s     r�
test_equalityzOrderedDictTests.test_equalitys����&�&��L������%� ���%� ������c�"��a�b�	�E�"�1�I�%���%� �����C��%�����d�3�i�(�����c��C�(����C��U�3�B�Z�!8�9rJc	������j}gd�}||��dg�_dg�_��fd�}|�j��tj��}||��j	|j�j��j	|j�j��jt
|d��tj��}||��j|j�j��j|j�j��j|j�j��j|j�j��jt
|d��td�j�5ttjdz�D]�}�j|��5tj tj"�|��}||��j|j�j��j|j�j��jt
|d��ddd���	ddd�|t%t'����|�}|j)��||�||���y#1swY��xYw#1swY�_xYw)	Nrx�x�zc�p��d|�d���}�j|�|��j|���jt|j��t�j����jt	|�t	����jt|�t���y)Nz
copy: z
od: )�assertIsNotr?rCrBry�type)�dup�msgrQr.s  ��r�checkz,OrderedDictTests.test_copying.<locals>.check/s����*-�r�2�C����S�"�c�*����S�"�%����T�#�)�)�+�.��R�X�X�Z�0@�A����S��X�s�2�w�/����T�#�Y��R��1rJ�yr	r)�proto)r<r�r��copy�assertIs�assertFalse�hasattr�deepcopyr?r�r�moduler��pickle�HIGHEST_PROTOCOL�subTest�loads�dumps�eval�reprrP)r.r<rEr�r�r��update_testrQs`      @r�test_copyingzOrderedDictTests.test_copying's0����&�&��M��
��
���u����u���	2�	�b�g�g�i���i�i��m��
�c�
��
�
�c�e�e�R�T�T�"��
�
�c�e�e�R�T�T�"������c�*�+��m�m�B���
�c�
����������%����������%����������%����������%������c�*�+�
�]�D�K�K�
8�	8��v�6�6��:�;�
8���\�\��\�.�8� �,�,�v�|�|�B��'>�?�C��#�J��$�$�S�U�U�B�D�D�1��$�$�S�U�U�B�D�D�1��$�$�W�S�#�%6�7�8�8�
8�	8�	�d�4��8�n��!�m�����2��
�k��
�k�"�o��8�8��	8�	8�s%�12K%�#BK�<
K%�K"�K%�%K.c��|j}gd�}||�}|jtd�|j�dD���y)Nrxc3�@K�|]}t|�tk(���y�wr)r�rC)�.0�pairs  r�	<genexpr>z5OrderedDictTests.test_yaml_linkage.<locals>.<genexpr>Zs����L��D��J��,�L�s�r)r<rs�all�
__reduce__r{s    r�test_yaml_linkagez"OrderedDictTests.test_yaml_linkageRsC���&�&��M��
��
��	
����L������9K�L�L�MrJc�N�|j}gd�}||�}|j|jt�|j	|j�d�d|_|j|jdd�|j|j�dddi�y)Nrxrr�r�)r<rr�__dict__rA�assertIsNoner�r�r?r{s    r�test_reduce_not_too_fatz(OrderedDictTests.test_reduce_not_too_fat\s����&�&��L��
��
�����b�k�k�4�0����"�-�-�/�!�,�-����������S�)�2�.���������+�c�2�Y�7rJc���|j}|�}||d<td|j�5tdtj
dz�D]|}t	jt	j||��}|j||�|jt|j��dg�|j|d|��~	ddd�y#1swYyxYw)Nrr	r�)
r<rr�r�r�r�r�r�r�r?rCrWr�)r.r<rQr�r�s     r�test_pickle_recursivez&OrderedDictTests.test_pickle_recursivegs����&�&��
�]����1���]�D�K�K�
8�	+��r�6�#:�#:�Q�#>�?�
+���l�l�6�<�<��E�#:�;��� � ��b�)�� � ��c�h�h�j�!1�A�3�7��
�
�c�!�f�c�*�	
+�	+�	+�	+�s�BC�Cc���|j}|gd��}|jt|�d�|jtt|��|�|jt|��d�y)Nrxz=OrderedDict({'c': 1, 'b': 2, 'a': 3, 'd': 4, 'e': 5, 'f': 6})z
OrderedDict())r<r?r�r�r�s   r�	test_reprzOrderedDictTests.test_reprts_���&�&��
�U�
V������b��K�	M�����d�2�h���,�����k�m�,�o�>rJc�~�|j}|jd�}||d<|jt|�d�y)Nrlr�z8OrderedDict({'a': None, 'b': None, 'c': None, 'x': ...}))r<ror?r�r�s   r�test_repr_recursivez$OrderedDictTests.test_repr_recursive|s>���&�&��
�
!�
!�%�
(����3������b��F�	HrJc��|j}|�}|j�|d<t|�}|j|t�|j�|d<t|�}|j|t�y)Nr,)r<r�r�rr�strrB)r.r<rQ�rs    r�test_repr_recursive_valuesz+OrderedDictTests.test_repr_recursive_values�sf���&�&��
�]�������2����H��	
���a��%������2����H�����a��%rJc�X�|j}gd�}t|�||�}t|j��}|j	|jdd�d�|j	t|j��|�|j	|jdd�d�|j	t|j��dd�|j	|jdd	�
�d	�Gd�d|�}|j	|�jd
d	�d	�y)Nrxrr�r"r�r�)r�r�r:r*r�c��eZdZd�Zy)�1OrderedDictTests.test_setdefault.<locals>.Missingc��yr�r1r�s  rr�z=OrderedDictTests.test_setdefault.<locals>.Missing.__missing__�r�rJNr�r1rJrr�r��r�rJr�r()r<rrCrBr?�
setdefault)r.r<rErQ�
pair_orderr�s      r�test_setdefaultz OrderedDictTests.test_setdefault�s����&�&��L�����
��
���"�(�(�*�%�
�������s�B�/��3�����b�h�h�j�)�:�6�������s�B�/��4�����b�h�h�j�)�"�-�y�9�������s�A��6��:�	�k�	�	
�����-�-�a��3�Q�7rJc��|j}|�}d|d<d|d<|d=|jt|j��dg�d|d<|jt|j��ddg�y)Nrrrrrrr�r�s   r�
test_reinsertzOrderedDictTests.test_reinsert�su���&�&���]����3����3���s�G�����b�h�h�j�)�H�:�6���3������b�h�h�j�)�H�h�+?�@rJc��|j}|jd�}|jt|�td��|j	d�|jt|�td��|j	dd�|jt|�td��|j	dd�|jt|�td��|j	d�|jt|�td��|j	dd��|jt|�td	��|jt�5|j	d
�ddd�|jt�5|j	d
d�ddd�y#1swY�:xYw#1swYyxYw)N�abcder!�abdecF�cabder'rr��bcader�)r<ror?rC�move_to_endr=rr�s   r�test_move_to_endz!OrderedDictTests.test_move_to_end�sV���&�&��
�
!�
!�'�
*������b��4��=�1�
���s������b��4��=�1�
���s�E�"�����b��4��=�1�
���s�E�"�����b��4��=�1�
���s������b��4��=�1�
���s���'�����b��4��=�1�
�
�
�x�
(�	 ��N�N�3��	 �
�
�
�x�
(�	'��N�N�3��&�	'�	'�	 �	 ��	'�	'�s�$F/�F;�/F8�;Gc��|j}|jd�}|jdd��|jt	|�t	d��|jdd��|jt	|�t	d��|jd�}|jd�|jt	|�t	d��|jd�|jt	|�t	d	��y)
Nrlr!Fr��cabr�acb�bca�bac)r<ror�r?rCr�s   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��;�/rJc��|j}td��}|di|��}|jtj|�tj|��y)Nrr�r1)r<rA�
assertGreaterr�	getsizeof)r.r<r$rQs    r�test_sizeofzOrderedDictTests.test_sizeof�sE���&�&���1�I��
�
�1�
�����3�=�=��,�c�m�m�A�.>�?rJc�:�|j}dj�}|j|�}|j|j	�t|�j	��|j|j
�t|�j
��y)Nz@the quick brown fox jumped over a lazy dog yesterday before dawn)r<�splitror?rWrArB)r.r<�srQs    r�
test_viewszOrderedDictTests.test_views�sl���&�&��N�T�T�V��
�
!�
!�!�
$���������D��H�M�M�O�4��������T�"�X�^�^�%5�6rJc��|j}Gd�d|�}gd�}|jt||�j��|�y)Nc��eZdZd�Zy)�3OrderedDictTests.test_override_update.<locals>.MyODc��t��r)r�)r.rf�kwdss   rrPz:OrderedDictTests.test_override_update.<locals>.MyOD.update�s
���k�!rJN)r]r^r_rPr1rJr�MyODr�s��
"rJr)rr rr�)r.r<rrBs    r�test_override_updatez%OrderedDictTests.test_override_update�sB���&�&��	"�;�	"�/������d�5�k�/�/�1�2�E�:rJc��|j}d}td�D]
}|d|fg�}�~tj�y)Ni�)r<r�r�
gc_collect)r.r<r��_s    r�test_highly_nestedz#OrderedDictTests.test_highly_nested�sF���&�&�����t��	-�A���c�{�m�,�C�	-�����rJc
���|j}g�G�fd�d|�}d}td�D]}|d|fg�}||_�~tj�|j�t
ttd����y)Nc���eZdZ�fd�Zy)�:OrderedDictTests.test_highly_nested_subclass.<locals>.MyODc�<���j|j�yr)rYr�)r.�deleteds �r�__del__zBOrderedDictTests.test_highly_nested_subclass.<locals>.MyOD.__del__�s������t�v�v�&rJN)r]r^r_r)rs�rrr�s���
'rJr�d)r<r�r�rrr?rCr�)r.r<rr�r�rs     @r�test_highly_nested_subclassz,OrderedDictTests.test_highly_nested_subclass�s�����&�&����	'�;�	'����s��	�A���s��}�%�C��C�E�	�
���������$�x��c�
�';�"<�=rJc��|j}Gd�d�}d�}d}||�}||�}|||��}|�}d||<d||<d||<d|d<||=||=|jt|j��|dfdg�y)Nc�$�eZdZd�Zd�Zd�Zd�Zy)�9OrderedDictTests.test_delitem_hash_collision.<locals>.Keyc�D�||_tt|��|_yr)�_hashr��idrn)r.�hashs  rrDzBOrderedDictTests.test_delitem_hash_collision.<locals>.Key.__init__s��!��
� ��D��]��
rJc��|jSr)r%r-s r�__hash__zBOrderedDictTests.test_delitem_hash_collision.<locals>.Key.__hash__����z�z�!rJc�T�	|j|jk(S#t$rYywxYw)NF)rn�AttributeError)r.r0s  r�__eq__z@OrderedDictTests.test_delitem_hash_collision.<locals>.Key.__eq__s,��!��:�:����4�4��%�!� �!�s��	'�'c��|jSrrmr-s r�__repr__zBOrderedDictTests.test_delitem_hash_collision.<locals>.Key.__repr__r*rJN)r]r^r_rDr)r-r/r1rJr�Keyr#
s��
+�
"�
!�

"rJr0c�2�d}||dz
z}|dz|z|zdzS)NrMrrr1)r'�MINSIZEr�s   r�
blocking_hashzCOrderedDictTests.test_delitem_hash_collision.<locals>.blocking_hashs-���G����	�!�A���F�a�<�$�&��*�*rJr.�after)r4.r�)	r.r<r0r3�	COLLIDINGr��	colliding�blockingrQs	         r�test_delitem_hash_collisionz,OrderedDictTests.test_delitem_hash_collisions����&�&��	"�	"�	+��	��)�n���	�N�	��}�Y�/�0��
�]����3����8����9�
���7���x�L��y�M�����b�h�h�j�)�S�#�J��+G�HrJc�`�|j}Gd�d�}|�}td�D]}|�}|||<�|jt�5t	|j��ddd�|jt�5t	|j
��ddd�|jt�5t|�ddd�|jt�5|j�ddd�y#1swY��xYw#1swY�mxYw#1swY�PxYw#1swYyxYw)Nc��eZdZd�Zy)�-OrderedDictTests.test_issue24347.<locals>.Keyc��td�S)Ni��)rr-s rr)z6OrderedDictTests.test_issue24347.<locals>.Key.__hash__2s
�� ��(�(rJN�r]r^r_r)r1rJrr0r;1s��
)rJr0r)	r<r�r=rrCr�rBr�r�)r.r<r0rQr�r�s      r�test_issue24347z OrderedDictTests.test_issue24347.s���&�&��	)�	)��]���s��	�A��%�C��B�s�G�	�
�
�
�x�
(�	�������	�
�
�
�x�
(�	�������	�
�
�
�x�
(�	���H�	�
�
�
�x�
(�	��G�G�I�	�	�
	�	��	�	��	�	��	�	�s0�D�D�=D�&D$�D	�D�D!�$D-c�r�|j}Gd�d�}|�}d||�<|j�y)Nc��eZdZd�Zy)�-OrderedDictTests.test_issue24348.<locals>.Keyc��y)Nrr1r-s rr)z6OrderedDictTests.test_issue24348.<locals>.Key.__hash__Hr�rJNr=r1rJrr0rAGr�rJr0r)r<r�)r.r<r0rQs    r�test_issue24348z OrderedDictTests.test_issue24348Ds4���&�&��	�	��]����3�5�	�
�
�
�rJc��|j}|�}dD]3}dD],}t|�dk(r|jd��||z}|||<�.�5y)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<ryr�)r.r<rQ�c0�c1r�s      r�test_issue24667z OrderedDictTests.test_issue24667Ps_���&�&��
�]��$�	�B�(�
���r�7�a�<��J�J�E�J�*��2�g����3��
�	rJc��|j}|�}tj|dd�|jdt	|��y�N�spamr�NULL)r<rA�__setitem__r~r�r�s   r�test_dict_setitemz"OrderedDictTests.test_dict_setitemis:���&�&��
�]������V�Q�'������b��*rJc���|j}|�}d|d<d|d<tj|d�|jt�5t|�ddd�y#1swYyxYw�NrrKr�ham)r<rA�__delitem__r=rr�r�s   r�test_dict_delitemz"OrderedDictTests.test_dict_delitemos`���&�&��
�]����6�
���5�	�����V�$�
�
�
�x�
(�	���H�	�	�	���	A�A'c��|j}|�}d|d<d|d<tj|�|jdt	|��y)NrrKrrQrL)r<rArzr~r�r�s   r�test_dict_clearz OrderedDictTests.test_dict_clearxsE���&�&��
�]����6�
���5�	��
�
�2�������b��*rJc���|j}|�}d|d<d|d<tj|d�|jt�5t|�ddd�y#1swYyxYwrP)r<rAr�r=rr�r�s   r�
test_dict_popzOrderedDictTests.test_dict_pop�s^���&�&��
�]����6�
���5�	�����V��
�
�
�x�
(�	���H�	�	�	�rTc���|j}|�}d|d<d|d<tj|�|jt�5t|�ddd�y#1swYyxYwrP)r<rAr�r=rr�r�s   r�test_dict_popitemz"OrderedDictTests.test_dict_popitem�s\���&�&��
�]����6�
���5�	����R��
�
�
�x�
(�	���H�	�	�	�s�A�A&c��|j}|�}tj|dd�|jdt	|��yrJ)r<rAr�r~r�r�s   r�test_dict_setdefaultz%OrderedDictTests.test_dict_setdefault�s8���&�&��
�]������F�A�&������b��*rJc��|j}|�}tj|dg�|jdt	|��y)N)rKrrL)r<rArPr~r�r�s   r�test_dict_updatez!OrderedDictTests.test_dict_update�s8���&�&��
�]�����B��
�&������b��*rJc����|j�G�fd�d�}d|j|<tj|�}~t	j
�|j
|��y)Nc���eZdZW��Zy)�/OrderedDictTests.test_reference_loop.<locals>.AN)r]r^r_rQris�r�Ara�s
�����BrJrb)r<rQ�weakref�ref�gc�collectr�)r.rbr�r<s   @r�test_reference_loopz$OrderedDictTests.test_reference_loop�sN����&�&��	�	�����Q���K�K��N��
�
�
�
�����!�#�rJc��tj|t|j�tj|d�|j�tj|d�|j�tj|d�|j�y)Nc�4�t|j��Sr)r�rW�r$s r�<lambda>z<OrderedDictTests.test_free_after_iterating.<locals>.<lambda>�s��4�����>�rJc�4�t|j��Sr)r�r�rjs rrkz<OrderedDictTests.test_free_after_iterating.<locals>.<lambda>�s��4����
�;K�rJc�4�t|j��Sr)r�rBrjs rrkz<OrderedDictTests.test_free_after_iterating.<locals>.<lambda>�s��4����	�?�rJ)r�check_free_after_iteratingr�r<r-s r�test_free_after_iteratingz*OrderedDictTests.test_free_after_iterating�se���*�*�4��t�7G�7G�H��*�*�4�1I�4�K[�K[�\��*�*�4�1K�T�M]�M]�^��*�*�4�1J�D�L\�L\�]rJc�j�|j}|dddd��}|dddd��}|j�}|j�}||z}|t|j��z}|ddddd��}|j	|t|�z|�|j	||z|�|j	||�|j	||�|j�}||z}|ddddd��}|j	t|�|z|�|j	||z|�|j	||�|j
t||z�|�|j
tt|�|z�|�|j
t|t|�z�|�|j�}|d	z}|d
z}|j	||�|jt�5|dzddd�|jt�5|d	zddd�|jt�5|dzddd�|jt�5|d
zddd�|jt�5|dz}ddd�y#1swY��xYw#1swY�xYw#1swY�hxYw#1swY�QxYw#1swYyxYw)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�sv���&�&���A�!��*�+���A�!��*�+��
�F�F�H��
�F�F�H��	�Q���	�T�!�'�'�)�_����1��q�Q�7�8������T�!�W��h�/�����Q���)�����H�%�����H�%�
�F�F�H��	�Q����1��q�Q�7�8������a��1��h�/�����Q���)�����H�%��
�
�d�1�q�5�k�;�/��
�
�d�4��7�Q�;�'��5��
�
�d�1�t�A�w�;�'��5��6�6�8��	�R���	�R�������H�%�
�
�
�y�
)�	�
��H�	�
�
�
�y�
)�	�
��F�	�
�
�
�y�
)�	�
��I�	�
�
�
�y�
)�	�
��F�	�
�
�
�z�
*�	�
��J�A�	�	�	�	��	�	��	�	��	�	��	�	�s<�I9�J�$J�J�*J)�9J�J�J�J&�)J2c���t|jdgi�j��}tj�|jtjt|���yr)r�r<rBrerfrs�
is_trackedr�)r.r�s  r�!test_ordered_dict_items_result_gcz2OrderedDictTests.test_ordered_dict_items_result_gc�sJ��
�$�"�"�D�"�:�.�4�4�6�
7��
�
�
��	
����
�
�d�2�h�/�0rJN)6r]r^r_rFrIrRrarjrprur|r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rr	r
rrr r8r>rCrHrNrSrVrXrZr\r^rgrorur�cpython_onlyrxr1rJrrr s��T�01�,9�\*�	�D�A�
%�B�Y�L�"	�B�<�	%�	'��4:� )�VN�	8�+�?�H�&�8�(
A�'�&0�@�7�;�	�>�"%I�N�,
��2+��+���+�+�	�^�)�V
���	1��	1rJrc�(�eZdZeZej
Zy)�PurePythonOrderedDictTestsN�r]r^r_�py_collr�r<r1rJrr{r{�s��
�F��%�%�KrJr{c��eZdZdZeZeZy)�CPythonBuiltinDictTestszaBuiltin dict preserves insertion order.

    Reuse some of tests in OrderedDict selectively.
    N)r]r^r_�__doc__�builtinsr�rAr<r1rJrrr�s���
�F��KrJrz�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��eZdZeZej
ZejZejd��Z	d�Z
d�Zejd��Zy)�CPythonOrderedDictTestsc���|j}tj}tj}|j
}|d�}|d�}|d�}|d�}|d�}	|�}
||
|�d|
_||
|�|
jtd�D�cgc]}||f��c}�||
||zd|zzdzd	|zzd|	zz�|
jtdd
�D�cgc]}||f��c}�||
||zd|zzdzd
|zzd
|	zz�||
j�|d��||
j�|d��||
j�|d��|d�}|t|
�|�|t|
j��|�|t|
j��|�|t|
j��|�ycc}wcc}w)
N�nQ2P3PnPn2P�n2BI2n�n2P�P�Pn2Prr"rMr(r���iP2n2P)
r<�struct�calcsizer�calcobjsize�check_sizeofr�rPr�rWrBr�r�)
r.r<r��sizer��	basicsize�keysize�	entrysize�p�nodesizerQr��itersizes
             r�test_sizeof_exactz)CPythonOrderedDictTests.test_sizeof_exacts����&�&���?�?���"�"���!�!���+�,�	��8�$���U�O�	��S�M���F�#��
�]��
�b�)�����
�b�)��
�	�	�5��8�,�a�A�q�6�,�-�
�b�)�g�%��!��+�a�/�!�I�+�=��(�
�J�K�
�	�	�5��B�<�0�a�A�q�6�0�1�
�b�)�g�%��1��,�r�1�B�y�L�@�2�h�;�N�O�
�b�g�g�i��c��#�
�b�h�h�j�$�s�)�$�
�b�i�i�k�4��9�%���>��
�d�2�h��!�
�d�2�7�7�9�o�x�(�
�d�2�8�8�:���)�
�d�2�9�9�;���*��-��0s�G*�%G/c�h�|j}|jd�}|jt|�td��|j	t
�5t
|�D](\}}|j|�|j|d��*	ddd�|j	t
�5|D]}d|d<�		ddd�|j	t
�5|D]}|d=�	ddd�|jt|�td��y#1swY��xYw#1swY�cxYw#1swY�FxYw)Nr�r(r6r!�bdeaf)	r<ror?rCr=�RuntimeError�	enumerater��
assertLess)r.r<rQr�r�s     r� test_key_change_during_iterationz8CPythonOrderedDictTests.test_key_change_during_iteration's���&�&��
�
!�
!�'�
*������b��4��=�1�
�
�
�|�
,�	&�!�"�
�
&���1����q�!�����1�%�
&�	&��
�
�|�
,�	��
����3��
�	��
�
�|�
,�	��
���s�G�
�	�	
����b��4��=�1�	&�	&��	�	��	�	�s$�7D�,
D�D(�D�D%�(D1c�
�|j}gd�}||�}dD]�}t||�}t|��dd}ttj
dz�D]�}|j
||��5t|��}t|�t	j||�}	t	j|	�}
|jt|
�|�|jt|�|�ddd�����y#1swY��xYw)Nrx)rWr�rBr)�method_name�protocol)r<�getattrrCr�r�r�r�r�r�r�r�r?)r.r<rErQr��methrtr�r�r��	unpickleds           r�test_iterators_picklingz/CPythonOrderedDictTests.test_iterators_pickling8s����&�&��L��
��
��6�
	9�K��2�{�+�D��D�F�|�A�B�'�H��6�2�2�Q�6�7�
9���\�\�k�A�\�F�9��d�f��B���H����R��+�A� &���Q��I��$�$�T�)�_�h�?��$�$�T�"�X�x�8�
9�9�
9�
	9�9�9�s
�/A=C9�9Dc��tj�|j�}||_g}|j	|�tj|�}|j	|�~~~tj�yr)rerfr<�cyclerYrcrd)r.r�r��x_refs    r�"test_weakref_list_is_not_traversedz:CPythonOrderedDictTests.test_weakref_list_is_not_traversedIs\��
	�
�
������������
���U�����A���
���U��
�u�e�
�
�
�rJN)
r]r^r_�c_collr�r<rr�ryr�r�r�r�r1rJrr�r��s\���F��$�$�K��'�'�L����+��+�@2�"9�"
�����rJr�c�:�eZdZeZGd�dej
�Zy)�"PurePythonOrderedDictSubclassTestsc��eZdZy)�.PurePythonOrderedDictSubclassTests.OrderedDictN�r]r^r_r1rJrr<r�a���rJr<Nr|r1rJrr�r�^s��
�F�
�g�)�)�
rJr�c�:�eZdZeZGd�dej
�Zy)�CPythonOrderedDictSubclassTestsc��eZdZy)�+CPythonOrderedDictSubclassTests.OrderedDictNr�r1rJrr<r�hr�rJr<N)r]r^r_r�r�r<r1rJrr�r�es��
�F�
�f�(�(�
rJr�c�R�eZdZeZGd�dej
�ZejZy)�*PurePythonOrderedDictWithSlotsCopyingTestsc��eZdZdZy)�6PurePythonOrderedDictWithSlotsCopyingTests.OrderedDict�r�r�N�r]r^r_�	__slots__r1rJrr<r�o����	rJr<N)r]r^r_r}r�r<rr�r1rJrr�r�ls$��
�F��g�)�)��#�0�0�LrJr�c�R�eZdZeZGd�dej
�ZejZy)�'CPythonOrderedDictWithSlotsCopyingTestsc��eZdZdZy)�3CPythonOrderedDictWithSlotsCopyingTests.OrderedDictr�Nr�r1rJrr<r�xr�rJr<N)r]r^r_r�r�r<rr�r1rJrr�r�ts&���F��f�(�(��#�0�0�LrJr�c�"�eZdZed��Zd�Zy)�PurePythonGeneralMappingTestsc�.�tj|_yr�r}r<�	type2test��clss r�
setUpClassz(PurePythonGeneralMappingTests.setUpClasss���+�+��
rJc�d�|j�}|jt|j�yr��_empty_mappingr=rr��r.r$s  rr�z*PurePythonGeneralMappingTests.test_popitem��$�����!�����(�A�I�I�.rJN�r]r^r_�classmethodr�r�r1rJrr�r�}s���,��,�/rJr�c�"�eZdZed��Zd�Zy)�CPythonGeneralMappingTestsc�.�tj|_yr�r�r<r�r�s rr�z%CPythonGeneralMappingTests.setUpClass�s���*�*��
rJc�d�|j�}|jt|j�yrr�r�s  rr�z'CPythonGeneralMappingTests.test_popitem�r�rJNr�r1rJrr�r��s���+��+�/rJr�c�"�eZdZed��Zd�Zy)�PurePythonSubclassMappingTestsc�D�Gd�dtj�}||_y)Nc��eZdZy)�@PurePythonSubclassMappingTests.setUpClass.<locals>.MyOrderedDictNr�r1rJr�
MyOrderedDictr�����rJr�r��r�r�s  rr�z)PurePythonSubclassMappingTests.setUpClass�s��	�G�/�/�	�%��
rJc�d�|j�}|jt|j�yrr�r�s  rr�z+PurePythonSubclassMappingTests.test_popitem�r�rJNr�r1rJrr�r��s���&��&�
/rJr�c�"�eZdZed��Zd�Zy)�CPythonSubclassMappingTestsc�D�Gd�dtj�}||_y)Nc��eZdZy)�=CPythonSubclassMappingTests.setUpClass.<locals>.MyOrderedDictNr�r1rJrr�r��r�rJr�r�r�s  rr�z&CPythonSubclassMappingTests.setUpClass�s��	�F�.�.�	�%��
rJc�d�|j�}|jt|j�yrr�r�s  rr�z(CPythonSubclassMappingTests.test_popitem�r�rJNr�r1rJrr�r��s���&��&�
/rJr�c�<��eZdZ�fd�Z�fd�Z�fd�Z�fd�Z�xZS)�SimpleLRUCachec�f��t�|��||_tj	dd�|_y)N��get�set�delr)�superrDr�rAro�counts)r.r��	__class__s  �rrDzSimpleLRUCache.__init__�s(���
������	��m�m�$9�1�=��rJc�v��|jdxxdz
cc<t�|�	|�}|j|�|S)Nr�r)r�r��__getitem__r�)r.�itemrnr�s   �rr�zSimpleLRUCache.__getitem__�s9������E��a�����#�D�)��������rJc���|jdxxdz
cc<||vrGt|�|jk\r/|jd��||vrt|�|jk\r�/t�|�||�|j
|�y)Nr�rFr�)r�ryr�r�r�rMr�)r.r�rnr�s   �rrMzSimpleLRUCache.__setitem__�sp������E��a�����o�#�d�)�t�y�y�"8��L�L�e�L�$���o�#�d�)�t�y�y�"8�
���C��'�����rJc�R��|jdxxdz
cc<t�|�	|�y)Nr�r)r�r�rR)r.r�r�s  �rrRzSimpleLRUCache.__delitem__�s$������E��a���
���C� rJ)r]r^r_rDr�rMrR�
__classcell__)r�s@rr�r��s���>�
��!�!rJr�c�$�eZdZd�Zd�Zd�Zd�Zy)�SimpleLRUCacheTestsc��|jd�}d|d<d|d<d|d<|j|jdddd��|jt|�ddg�|j|jdddd��y)	Nrr�t1�t2r"�t3rr�)r�r?r�rC)r.r!s  r�test_add_after_fullz'SimpleLRUCacheTests.test_add_after_full�sy���N�N�1�����$����$����$��������1�Q�q�#A�B�����a��4��,�/�������1�Q�q�#A�BrJc��|jd�}tdd�D]}|||<�	|j|jd��d�|j|jd��d�|j|jd	dd	d
��y)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�	���������.��7���������-�v�6�������1�Q�q�#A�BrJc��|jd�}tdd�D]}|||<�	|j|jdddd��|j|j	d�d�|j|jdddd��|j|j	dd�d�|j|jdddd��|jt|jd�|j|jdddd��y)Nr"rr%rr�r)r�r�r?r�r�r=rr�s   rr�zSimpleLRUCacheTests.test_pop�s����N�N�1����q�!��	�A��A�a�D�	�������1�Q�q�#A�B�������q��1�%�������1�Q�q�#A�B�������q�!��a�(�������1�Q�q�#A�B����(�A�E�E�1�-�������1�Q�q�#A�BrJc	��|jd�}tdd�D]}|||<�	|jt|�ttdd���|j|jdddd��|j|dd�|j|jdddd��|jt|�gd��y)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�	�����a��$�u�Q��{�"3�4�������1�Q�q�#A�B�����1��q�!�������1�Q�q�#A�B�����a��)�,rJN)r]r^r_r�r�r�r�r1rJrr�r��s��C�C�
C�-rJr�c�8�eZdZGd�deej
�Zy)�PySimpleLRUCacheTestsc��eZdZy)�PySimpleLRUCacheTests.type2testNr�r1rJrr�r�r�rJr�N)r]r^r_r�r}r<r�r1rJrrr�s��
�N�G�$7�$7�
rJrc��eZdZed��Zy)�CSimpleLRUCacheTestsc�N�Gd�dttj�}||_y)Nc��eZdZy)�2CSimpleLRUCacheTests.setUpClass.<locals>.type2testNr�r1rJrr�r�r�rJr�)r�r�r<r�)r�r�s  rr�zCSimpleLRUCacheTests.setUpClass�s��	���(:�(:�	�!��
rJN)r]r^r_r�r�r1rJrrr�s���"��"rJr�__main__)1r��
contextlibr�rer��randomrrr�r�unittestrc�collections.abcr�testrr�test.supportr�import_fresh_moduler}r��contextmanagerrr�TestCaser{rr�method�setattrr��
skipUnlessr�r�r�r�r��BasicTestMappingProtocolr�r�r�r�r�r�rrr]�mainr1rJr�<module>rs������	�
�%�
�
���*�'�&�,�-�
+�
+�M�5C�4D�F��	*��	*�	*�=�2@�1A�
C�����,��,�D1�D1�L&�!1�8�3D�3D�&��h�/�/��#�%*�E�G�P�F��#�V�W�5E�v�-N�O�
P������V�O�P�[�.��0A�0A�[�Q�[�|
�)C�
�
�&=�
�1��1B�1B�1�����V�O�P�1�h�.?�.?�1�Q�1�/�M�$J�$J�/�����V�O�P�/��!G�!G�/�Q�/�
/�]�%K�%K�
/�����V�O�P�
/�-�"H�"H�
/�Q�
/�!�!�2'-�'-�T
�/��1B�1B�
�����V�O�P�"�.��0A�0A�"�Q�"��z���H�M�M�O�rJ