HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.10/test/__pycache__/test_ordered_dict.cpython-310.opt-1.pyc
o

�in~�@s�ddlZddlZddlZddlZddlZddlmZmZddlZddl	Z	ddl
Z
ddlZddlm
Z
ddlmZmZddlmZejddgd�Zejddgd	�Zejd
d��ZGdd
�d
�ZGdd�dee
j�ZGdd�de
j�Zd��D]Zeeeeee��qu[e
� ed�Gdd�dee
j��Z!Gdd�de�Z"Gdd�de!�Z#Gdd�dej$�Z%e
� ed�Gdd�dej$��Z&Gdd�dej$�Z'e
� ed�Gd d!�d!ej$��Z(e)d"kr�e
�*�dSdS)#�N)�	randrange�shuffle)�MutableMapping)�
mapping_tests�support)�
import_helper�collections�_collections)Zblocked)Zfreshc	cs:�tj|}|tj|<zdVW|tj|<dS|tj|<w�N)�sys�modules)�nameZreplacementZoriginal_module�r�3/usr/local/lib/python3.10/test/test_ordered_dict.py�replaced_modules�

rc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Z d=d>�Z!d?d@�Z"dAdB�Z#dCdD�Z$dEdF�Z%dGdH�Z&dIdJ�Z'dKdL�Z(dMdN�Z)dOdP�Z*dQdR�Z+dSdT�Z,dUdV�Z-dWdX�Z.dYdZ�Z/d[d\�Z0d]d^�Z1e2j3d_d`��Z4daS)b�OrderedDictTestscCs^|j}|�t��|ddgd�Wd�n1swYgd�}|�t|t|�����|�|�t|d
it|������|�|�t||����|�|�t|gd�ddd����|�|�t|dd	����d
g�|�t|dd����dg�|�t|d�|�t|d
d
�|�t|j�|gd��}|jddgddd�|�t|���gd��dS)N��a���b��rr��c���d���e��rr)r�	rrr!�rr �*��self)r'r%��other)r)r%r�rrr)r�,)r �7r��f��r��gr�rrrrrr-)r2r0)	�OrderedDict�assertRaises�	TypeError�assertEqual�sorted�dict�items�list�__init__)r'r4�pairsrrrr�	test_init"s2�"����zOrderedDictTests.test_initcCsD|j}gd�}t|�||�}|di|��}|�t|���|�dS)Nr3r)r4rr7r;r:)r'r4r:Zargdictrrrr�test_468:szOrderedDictTests.test_468cCs|j}|�t��|��ddgd�Wd�n1swYgd�}|�}|�t|��|�t|���|�|�}|jdit|���|�t|���|�|�}|�|�|�t|���|�|�}|jgd�ddd�|�t|���|�|�}|jdd	�|�t|���d
g�|�}|jid�|�t|���difg�|�}|jdd
ddd�|�tt|����gd��|gd��}|jddgddd�|�t|���gd��|�t|�jd�|�t|�jdd�|�t|j�|�t|�jd�|�t|�jdd�|�t|j�dS)Nrrrr"rr!r$�r&)r'r@r(r)r/r0�)�red�bluer)r'))rCr/)r)r0)rBr!)r'rAr*rr-rr1r3r%r)	r4r5r6�updater9r7r8r:r;)r'r4r=�odrrrr�test_updateBsN�
��zOrderedDictTests.test_updatecs4g�G�fdd�d�}|�|��|��dg�dS)Ncs$eZdZ�fdd�Z�fdd�ZdS)z.OrderedDictTests.test_init_calls.<locals>.Spamc���d�dS)N�keysr��appendr&�ZcallsrrrHs�
z3OrderedDictTests.test_init_calls.<locals>.Spam.keyscrG)Nr:rrIr&rKrrr:vrLz4OrderedDictTests.test_init_calls.<locals>.Spam.itemsN)�__name__�
__module__�__qualname__rHr:rrKrr�SpamrsrPrH)r4r7)r'rPrrKr�test_init_callspsz OrderedDictTests.test_init_callscCs�|j}|�d�}|�t|���dd�dD��|jddd�}|�t|���dd�dD��|jddd�}|�t|���dd�dD��dS)N�abccS�g|]}|df�qSr
r��.0rrrr�
<listcomp>��z2OrderedDictTests.test_fromkeys.<locals>.<listcomp>��valuecSrSr
rrTrrrrV�rWrcSrS�rrrTrrrrV�rW)r4�fromkeysr7r;r:�r'r4rErrr�
test_fromkeys}s
"zOrderedDictTests.test_fromkeyscCs(|j}|�|�t�|�t|t��dSr
)r4�assertIsInstancer�
assertTrue�
issubclass)r'r4rrr�test_abc�szOrderedDictTests.test_abccCsN|j}gd�}t|�||�}|�t|�t|��|��|�t|�d�dS�N�)rrr)rrrrr-r)r4rr7�len�clear�r'r4r=rErrr�
test_clear�szOrderedDictTests.test_clearcCs�|j}gd�}||�}|d=|�d|�|�t��|d=Wd�n1s'wY|�t|���|dd�|dd��dS)Nrcrrr)r4�assertNotInr5�KeyErrorr7r;r:rfrrr�test_delitem�s�,zOrderedDictTests.test_delitemcCs>|j}|gd��}d|d<d|d<|�t|���gd��dS)N)�rrrr�rrr�
r�r.)rkr)rrmrlr)r.rn�r4r7r;r:r\rrr�test_setitem�s�zOrderedDictTests.test_setitemcCs|j}gd�}t|�||�}|�t|�dd�|D��|�t|���dd�|D��|�t|���dd�|D��|�t|���|�|�tt|��dd�t|�D��|�tt|����dd�t|�D��|�tt|����dd�t|�D��|�tt|����tt|���dS)	NrccS�g|]}|d�qSrZr�rU�trrrrV�rWz3OrderedDictTests.test_iterators.<locals>.<listcomp>cSrqrZrrrrrrrV�rWcSrq�rrrrrrrrV�rWcSrqrZrrrrrrrV�rWcSrqrZrrrrrrrV�rWcSrqrtrrrrrrrV�rW)r4rr7r;rH�valuesr:�reversedrfrrr�test_iterators�s$���$zOrderedDictTests.test_iteratorscCs^|j}|�d�}t|�}t|�}||=|�t��
t|�Wd�dS1s(wYdS)NrR)r4r[�iter�nextr5�	Exception)r'r4rE�it�keyrrr�%test_detect_deletion_during_iteration�s

"�z6OrderedDictTests.test_detect_deletion_during_iterationcCs�|j}|�t��|ddgd�Wd�n1swYgd�}||�}|�t|�dd�|D��|�t|���dd�|D��|�t|���dd�|D��|�t|���|�|�tt|��tdd�t|�D���dS)	NrrrcSrqrZrrrrrrrV�rWz:OrderedDictTests.test_sorted_iterators.<locals>.<listcomp>cSrqrZrrrrrrrV�rWcSrqrtrrrrrrrV�rWcSrqrZrrrrrrrV�rW)	r4r5r6r7r8rHrur:rvrfrrr�test_sorted_iterators�s��z&OrderedDictTests.test_sorted_iteratorscCs�|j}|�}g}|�t|�|�|�t|���|�|�t|���|�|�t|���|�|�tt|��|�|�tt|����|�|�tt|����|�|�tt|����|�dSr
)r4r7r;rHrur:rv)r'r4rE�emptyrrr�test_iterators_empty�sz%OrderedDictTests.test_iterators_emptycCs�|j}gd�}t|�||�}|r|�|��|���|s|�t��|��Wd�n1s1wY|�t|�d�dSrb)r4rr7�popitem�popr5rirdrfrrr�test_popitem�s�
�zOrderedDictTests.test_popitemcCsb|j}dd�td�D�}||�}td�D]}|�d�q|�d�|jdd�|�t|�d�dS)NcS�g|]}||f�qSrr�rU�irrrrV�rWz6OrderedDictTests.test_popitem_last.<locals>.<listcomp>�rAT�Zlastrn)r4�ranger�r7rd)r'r4r=�objr�rrr�test_popitem_last�s
z"OrderedDictTests.test_popitem_lastcCsJ|j}gd�}t|�||�}t|�|r&|��\}}|�|�|�|�|s|�t��
|�d�Wd�n1s;wY|�t|�d�|�|�|d�d�Gdd�d|�}|dd�}|�|�d	d
�d
�|�|�dd�d�|�|�dd�d�|�|jddd
�d�|�t��|�d�Wd�dS1s�wYdS)NrcZxyzri90c@�eZdZdd�ZdS)z*OrderedDictTests.test_pop.<locals>.MissingcS�dS�Nrr�r'r|rrr�__missing__�z6OrderedDictTests.test_pop.<locals>.Missing.__missing__N�rMrNrOr�rrrr�Missing�r�r�rrr!rr/��default)r4rr�r7r5rird)r'r4r=rE�k�vr��mrrr�test_pop�s.��
"�zOrderedDictTests.test_popcCs�|j}gd�}t|�||�}||�}|�||�|dd�|dd�}||�}|�||�|�|t|��|�t|�|�|�|||dd���dS)Nrcr���)r4rr7ZassertNotEqualr9)r'r4r=Zod1Zod2rrr�
test_equalityszOrderedDictTests.test_equalityc
s�j}gd�}||����fdd�}|����|t����|t����td�j��3ttjd�D]#}�j|d��|t�	t�
�|���Wd�n1sRwYq4Wd�n1sbwY|tt����|�}|�
��||�||���dS)Nrccsnd|�f}��|�|���|����t|���t�������t|�t�����t|�t���dS)Nz
copy: %s
od: %s)�assertIsNotr7r;r:rd�type)�dup�msg�rEr'rr�check"sz,OrderedDictTests.test_copying.<locals>.checkrr)�proto)r4�copy�deepcopyr�moduler��pickle�HIGHEST_PROTOCOL�subTest�loads�dumps�eval�reprrD)r'r4r=r�r�Zupdate_testrr�r�test_copyings(����
zOrderedDictTests.test_copyingcCs:|j}gd�}||�}|�tdd�|��dD���dS)Nrccss�|]	}t|�tkVqdSr
)r�r;)rUZpairrrr�	<genexpr>?s�z5OrderedDictTests.test_yaml_linkage.<locals>.<genexpr>r)r4r_�all�
__reduce__rfrrr�test_yaml_linkage7s$z"OrderedDictTests.test_yaml_linkagecCsj|j}gd�}||�}|�|jt�|�|��d�d|_|�|jdd�|�|��dddi�dS)Nrcrrm�x)r4r^�__dict__r9�assertIsNoner�r�r7rfrrr�test_reduce_not_too_fatAsz(OrderedDictTests.test_reduce_not_too_fatcCs�|j}|�}||d<td|j��6tdtjd�D]$}t�t�||��}|�||�|�	t
|���dg�|�|d|�qWd�dS1sIwYdS)Nrrr�)
r4rr�r�r�r�r�r�r�r7r;rH�assertIs)r'r4rEr�r�rrr�test_pickle_recursiveLs�"�z&OrderedDictTests.test_pickle_recursivecCsL|j}|gd��}|�t|�d�|�tt|��|�|�t|��d�dS)NrczIOrderedDict([('c', 1), ('b', 2), ('a', 3), ('d', 4), ('e', 5), ('f', 6)])z
OrderedDict())r4r7r�r�r\rrr�	test_reprYs
�zOrderedDictTests.test_reprcCs,|j}|�d�}||d<|�t|�d�dS)NrRr�z@OrderedDict([('a', None), ('b', None), ('c', None), ('x', ...)]))r4r[r7r�r\rrr�test_repr_recursiveas

�z$OrderedDictTests.test_repr_recursivecCsP|j}|�}|��|d<t|�}|�|t�|��|d<t|�}|�|t�dS)Nr%)r4rur�r^�strr:)r'r4rE�rrrr�test_repr_recursive_valuesisz+OrderedDictTests.test_repr_recursive_valuescCs�|j}gd�}t|�||�}t|���}|�|�dd�d�|�t|���|�|�|�dd�d�|�t|���dd�|�|jdd	d
�d	�Gdd�d|�}|�|��d
d	�d	�dS)Nrcrrmrr�r�)r�rmr2r#r�c@r�)z1OrderedDictTests.test_setdefault.<locals>.MissingcSr�r�rr�rrrr��r�z=OrderedDictTests.test_setdefault.<locals>.Missing.__missing__Nr�rrrrr��r�r�r!)r4rr;r:r7�
setdefault)r'r4r=rEZ
pair_orderr�rrr�test_setdefaultwsz OrderedDictTests.test_setdefaultcCs\|j}|�}d|d<d|d<|d=|�t|���dg�d|d<|�t|���ddg�dS)Nrrrrrrror\rrr�
test_reinsert�szOrderedDictTests.test_reinsertcCs2|j}|�d�}|�t|�td��|�d�|�t|�td��|�dd�|�t|�td��|�dd�|�t|�td��|�d�|�t|�td��|jddd�|�t|�td	��|�t��
|�d
�Wd�n1svwY|�t��|�d
d�Wd�dS1s�wYdS)N�abcderZabdecFZcabder rr�Zbcader�)r4r[r7r;�move_to_endr5rir\rrr�test_move_to_end�s&


�"�z!OrderedDictTests.test_move_to_endcCs�|j}|�d�}|jddd�|�t|�td��|jddd�|�t|�td��|�d�}|�d�|�t|�td��|�d�|�t|�td	��dS)
NrRrFr�ZcabrZacbZbcaZbac)r4r[r�r7r;r\rrr�test_move_to_end_issue25406�s



z,OrderedDictTests.test_move_to_end_issue25406cCs:|j}tdd�}|di|��}|�t�|�t�|��dS)Nrr�r)r4r9Z
assertGreaterr�	getsizeof)r'r4rrErrr�test_sizeof�s
zOrderedDictTests.test_sizeofcCsL|j}d��}|�|�}|�|��t|����|�|��t|����dS)Nz@the quick brown fox jumped over a lazy dog yesterday before dawn)r4�splitr[r7rHr9r:)r'r4�srErrr�
test_views�s

zOrderedDictTests.test_viewscCs:|j}Gdd�d|�}gd�}|�t||����|�dS)Nc@r�)z3OrderedDictTests.test_override_update.<locals>.MyODc_st��r
)rz)r'�args�kwdsrrrrD��z:OrderedDictTests.test_override_update.<locals>.MyOD.updateN)rMrNrOrDrrrr�MyOD�r�r�)rrrro)r'r4r�r:rrr�test_override_update�sz%OrderedDictTests.test_override_updatecCs4|j}d}td�D]	}|d|fg�}q	~t��dS)Ni�)r4r�r�
gc_collect)r'r4r��_rrr�test_highly_nested�sz#OrderedDictTests.test_highly_nestedcsj|j}g�G�fdd�d|�}d}td�D]}|d|fg�}||_q~t��|��tttd����dS)NcseZdZ�fdd�ZdS)z:OrderedDictTests.test_highly_nested_subclass.<locals>.MyODcs��|j�dSr
)rJr�r&�Zdeletedrr�__del__�szBOrderedDictTests.test_highly_nested_subclass.<locals>.MyOD.__del__N)rMrNrOr�rr�rrr��sr��d)r4r�r�rr�r7r;rv)r'r4r�r�r�rr�r�test_highly_nested_subclass�sz,OrderedDictTests.test_highly_nested_subclassc	Cs�|j}Gdd�d�}dd�}d}||�}||�}|||��}|�}d||<d||<d||<d|d<||=||=|�t|���|dfdg�dS)	Nc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
z9OrderedDictTests.test_delitem_hash_collision.<locals>.KeycSs||_tt|��|_dSr
)�_hashr��idrY)r'�hashrrrr<�szBOrderedDictTests.test_delitem_hash_collision.<locals>.Key.__init__cS�|jSr
)r�r&rrr�__hash__�r�zBOrderedDictTests.test_delitem_hash_collision.<locals>.Key.__hash__cSs$z|j|jkWStyYdSw)NF)rY�AttributeError)r'r)rrr�__eq__�s
�z@OrderedDictTests.test_delitem_hash_collision.<locals>.Key.__eq__cSr�r
rXr&rrr�__repr__�r�zBOrderedDictTests.test_delitem_hash_collision.<locals>.Key.__repr__N)rMrNrOr<r�r�r�rrrr�Key�s
r�cSs$d}||d@}|d>||dS)NrArrr)r�ZMINSIZEr�rrr�
blocking_hash�szCOrderedDictTests.test_delitem_hash_collision.<locals>.blocking_hashr.�after)r�.ro)	r'r4r�r�Z	COLLIDINGr|Z	colliding�blockingrErrr�test_delitem_hash_collision�s z,OrderedDictTests.test_delitem_hash_collisioncCs|j}Gdd�d�}|�}td�D]	}|�}|||<q|�t��t|���Wd�n1s1wY|�t��t|���Wd�n1sLwY|�t��t|�Wd�n1sewY|�t��
|��Wd�dS1swYdS)Nc@r�)z-OrderedDictTests.test_issue24347.<locals>.KeycSstd�S)Ni��)rr&rrrr�sz6OrderedDictTests.test_issue24347.<locals>.Key.__hash__N�rMrNrOr�rrrrr�r�r�r�)	r4r�r5rir;rur:r�r�)r'r4r�rEr�r|rrr�test_issue24347s$
��
�
"�z OrderedDictTests.test_issue24347cCs0|j}Gdd�d�}|�}d||�<|��dS)Nc@r�)z-OrderedDictTests.test_issue24348.<locals>.KeycSr�)Nrrr&rrrr�-r�z6OrderedDictTests.test_issue24348.<locals>.Key.__hash__Nr�rrrrr�,r�r�r)r4r�)r'r4r�rErrr�test_issue24348)s

z OrderedDictTests.test_issue24348cCsL|j}|�}dD]}dD]}t|�dkr|jdd�||}|||<qqdS)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.
        Z0123456789ABCDEFrFr�N)r4rdr�)r'r4rEZc0�c1r|rrr�test_issue246675s
��z OrderedDictTests.test_issue24667cC�.|j}|�}t�|dd�|�dt|��dS�N�spamr�NULL)r4r9�__setitem__rhr�r\rrr�test_dict_setitemN�z"OrderedDictTests.test_dict_setitemcC�`|j}|�}d|d<d|d<t�|d�|�t��
t|�Wd�dS1s)wYdS�Nrr�r�ham)r4r9�__delitem__r5rir�r\rrr�test_dict_delitemT�
"�z"OrderedDictTests.test_dict_delitemcCs:|j}|�}d|d<d|d<t�|�|�dt|��dS)Nrr�rr�r�)r4r9rerhr�r\rrr�test_dict_clear]s
z OrderedDictTests.test_dict_clearcCr�r�)r4r9r�r5rir�r\rrr�
test_dict_poper�zOrderedDictTests.test_dict_popcCs^|j}|�}d|d<d|d<t�|�|�t��
t|�Wd�dS1s(wYdSr�)r4r9r�r5rir�r\rrr�test_dict_popitemns

"�z"OrderedDictTests.test_dict_popitemcCr�r�)r4r9r�rhr�r\rrr�test_dict_setdefaultwr�z%OrderedDictTests.test_dict_setdefaultcCs.|j}|�}t�|dg�|�dt|��dS)N)r�rr�)r4r9rDrhr�r\rrr�test_dict_update}r�z!OrderedDictTests.test_dict_updatecsF|j�G�fdd�d�}d|j|<t�|�}~t��|�|��dS)NcseZdZ��ZdS)z/OrderedDictTests.test_reference_loop.<locals>.AN)rMrNrOrEr�r4rr�A�s
r�)r4rE�weakref�ref�gc�collectr�)r'r�r�rr�r�test_reference_loop�s

z$OrderedDictTests.test_reference_loopcCsPt�|t|j�t�|dd�|j�t�|dd�|j�t�|dd�|j�dS)NcS�t|���Sr
)rxrH�rrrr�<lambda>��z<OrderedDictTests.test_free_after_iterating.<locals>.<lambda>cSrr
)rxrurrrrr�rcSrr
)rxr:rrrrr�r)rZcheck_free_after_iteratingrxr4r&rrr�test_free_after_iterating�sz*OrderedDictTests.test_free_after_iteratingcCsZ|j}|dddd��}|dddd��}|��}|��}||O}|t|���O}|ddddd��}|�|t|�B|�|�||B|�|�||�|�||�|��}||O}|ddddd��}|�t|�|B|�|�||B|�|�||�|�t||B�|�|�tt|�|B�|�|�t|t|�B�|�|��}|d	O}|d
O}|�||�|�t	��|dBWd�n1s�wY|�t	��|d	BWd�n1s�wY|�t	��|dBWd�n1s�wY|�t	��|d
BWd�n	1�swY|�t
��
|dO}Wd�dS1�s&wYdS)Nrr)rrrrr)rrr)rrrr)rrrrr�ZBAD)r4r�r;r:r7r9r�r�r5r6�
ValueError)r'r4rrrr�expectedrrr�test_merge_operator�sP
�
�
�
�
$�z$OrderedDictTests.test_merge_operatorcCs6t|�dgi����}t��|�t�t|���dSr
)rxr4r:r�rr_Z
is_trackedry)r'r{rrr�!test_ordered_dict_items_result_gc�sz2OrderedDictTests.test_ordered_dict_items_result_gcN)5rMrNrOr>r?rFrQr]rargrjrprwr}r~r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrr
r�cpython_onlyrrrrrr sd.
		




	'			+rc@seZdZeZejZdS)�PurePythonOrderedDictTestsN�rMrNrO�py_collr�r4rrrrr
�s
r
c@seZdZdZeZeZdS)�CPythonBuiltinDictTestszaBuiltin dict preserves insertion order.

    Reuse some of tests in OrderedDict selectively.
    N)rMrNrO�__doc__�builtinsr�r9r4rrrrr�srz�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@sHeZdZeZejZejZejdd��Z	dd�Z
dd�Zejdd��Zd	S)
�CPythonOrderedDictTestscCsl|j}tj}tj}|j}|d�}|d�}|d�}|d�}|d�}	|�}
||
|�d|
_||
|�|
�dd�td	�D��||
||d
|d
d|d	|	�|
�dd�td	d
�D��||
||d|dd
|d
|	�||
�	�|d��||
�
�|d��||
��|d��|d�}|t|
�|�|t|
�	��|�|t|
�
��|�|t|
���|�dS)NZnQ2P3PnPn2PZ2nP2nZn2P�PZPn2PrcSr�rrr�rrrrV�rWz=CPythonOrderedDictTests.test_sizeof_exact.<locals>.<listcomp>rrAr!cSr�rrr�rrrrV�rWrm�ZiP2n2P)
r4�struct�calcsizerZcalcobjsize�check_sizeofr�rDr�rHr:rurx)r'r4r�sizer�Z	basicsizeZkeysizeZ	entrysize�pZnodesizerEZitersizerrr�test_sizeof_exact�s2

**z)CPythonOrderedDictTests.test_sizeof_exactcCs|j}|�d�}|�t|�td��|�t��t|�D]\}}|�|�|�|d�qWd�n1s6wY|�t��|D]}d|d<qCWd�n1sTwY|�t��|D]}|d=qaWd�n1sqwY|�t|�td��dS)Nr�r!r.rZbdeaf)	r4r[r7r;r5�RuntimeError�	enumerater�Z
assertLess)r'r4rEr�r�rrr� test_key_change_during_iterations(

��
����z8CPythonOrderedDictTests.test_key_change_during_iterationc
Cs�|j}gd�}||�}dD]U}t||�}t|��dd�}ttjd�D]=}|j||d��,t|��}t|�t�	||�}	t�
|	�}
|�t|
�|�|�t|�|�Wd�n1s\wYq$q
dS)Nrc)rHrur:r)�method_name�protocol)r4�getattrr;r�r�r�r�rxryr�r�r7)r'r4r=rEr�methr	r�r{rZ	unpickledrrr�test_iterators_picklings$


����z/CPythonOrderedDictTests.test_iterators_picklingcCsJt��|��}||_g}|�|�t�|�}|�|�~~~t��dSr
)r�rr4�cyclerJr�r�)r'r�r$Zx_refrrr�"test_weakref_list_is_not_traversed.s


z:CPythonOrderedDictTests.test_weakref_list_is_not_traversedN)
rMrNrO�c_collr�r4rrrrrr#r%rrrrr�s
 rc@�"eZdZeZGdd�dej�ZdS)�"PurePythonOrderedDictSubclassTestsc@�eZdZdS)z.PurePythonOrderedDictSubclassTests.OrderedDictN�rMrNrOrrrrr4F�r4Nrrrrrr(C�r(c@r')�CPythonOrderedDictSubclassTestsc@r))z+CPythonOrderedDictSubclassTests.OrderedDictNr*rrrrr4Mr+r4N)rMrNrOr&r�r4rrrrr-Jr,r-c@� eZdZedd��Zdd�ZdS)�PurePythonGeneralMappingTestscC�tj|_dSr
�rr4�	type2test��clsrrr�
setUpClassS�z(PurePythonGeneralMappingTests.setUpClasscC�|��}|�t|j�dSr
�Z_empty_mappingr5rir��r'rrrrr�W�z*PurePythonGeneralMappingTests.test_popitemN�rMrNrO�classmethodr5r�rrrrr/Qs
r/c@r.)�CPythonGeneralMappingTestscCr0r
�r&r4r2r3rrrr5_r6z%CPythonGeneralMappingTests.setUpClasscCr7r
r8r9rrrr�cr:z'CPythonGeneralMappingTests.test_popitemNr;rrrrr=\s
r=c@r.)�PurePythonSubclassMappingTestscC�Gdd�dtj�}||_dS)Nc@r))z@PurePythonSubclassMappingTests.setUpClass.<locals>.MyOrderedDictNr*rrrr�
MyOrderedDictlr+rAr1�r4rArrrr5j�
z)PurePythonSubclassMappingTests.setUpClasscCr7r
r8r9rrrr�pr:z+PurePythonSubclassMappingTests.test_popitemNr;rrrrr?hs
r?c@r.)�CPythonSubclassMappingTestscCr@)Nc@r))z=CPythonSubclassMappingTests.setUpClass.<locals>.MyOrderedDictNr*rrrrrAzr+rAr>rBrrrr5xrCz&CPythonSubclassMappingTests.setUpClasscCr7r
r8r9rrrr�~r:z(CPythonSubclassMappingTests.test_popitemNr;rrrrrDus
rD�__main__)+r�
contextlibr�r�r��randomrrrrZunittestr��collections.abcr�testrrZtest.supportrZimport_fresh_modulerr&�contextmanagerrrZTestCaser
rr��method�setattrr!Z
skipUnlessrr(r-ZBasicTestMappingProtocolr/r=r?rDrM�mainrrrr�<module>s^��
	0
�
^



�