Your IP : 216.73.216.213


Current Path : /opt/alt/python39/lib64/python3.9/test/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/test/__pycache__/test_ordered_dict.cpython-39.opt-2.pyc

a

XC?h�}�@s�ddlZddlZddlZddlZddlZddlmZmZddlZddl	Z	ddl
Z
ddlZddlm
Z
ddlmZmZejddgd�Zejddgd�Zejd	d
��ZGdd�d�ZGd
d�dee
j�ZGdd�de
j�Zd��D]Zeeeeee��q�[e
�ed�Gdd�dee
j��ZGdd�de�Z Gdd�de�Z!Gdd�dej"�Z#e
�ed�Gdd�dej"��Z$Gdd�dej"�Z%e
�ed�Gdd �d ej"��Z&e'd!k�r�e
�(�dS)"�N)�	randrange�shuffle)�MutableMapping)�
mapping_tests�support�collections�_collections)Zblocked)Zfreshc	cs:tj|}|tj|<zdVW|tj|<n|tj|<0dS�N)�sys�modules)�nameZreplacementZoriginal_module�r
�;/opt/alt/python39/lib64/python3.9/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�n1s40Ygd�}|�t|t|�����|�|�t|fit|������|�|�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,)r1r/)	�OrderedDict�assertRaises�	TypeError�assertEqual�sorted�dict�items�list�__init__)r&r3�pairsrr
r
r�	test_inits,,"�
��zOrderedDictTests.test_initcCsD|j}gd�}t|�||�}|fi|��}|�t|���|�dS)Nr2)r3rr6r:r9)r&r3r9Zargdictrr
r
r�test_4687szOrderedDictTests.test_468cCs|j}|�t��"|��ddgd�Wd�n1s80Ygd�}|�}|�t|��|�t|���|�|�}|jfit|���|�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.r/�)�red�bluer(r&))rBr.)r(r/)rAr )r&r@r)rr,rr0r2r$r
)	r3r4r5�updater8r6r7r9r:)r&r3r<�odrr
r
r�test_update?sL0
��zOrderedDictTests.test_updatecs4g�G�fdd�d�}|�|��|��dg�dS)Ncs$eZdZ�fdd�Z�fdd�ZdS)z.OrderedDictTests.test_init_calls.<locals>.Spamcs��d�dS)N�keysr
��appendr%�Zcallsr
rrFps
z3OrderedDictTests.test_init_calls.<locals>.Spam.keyscs��d�dS)Nr9r
rGr%rIr
rr9ss
z4OrderedDictTests.test_init_calls.<locals>.Spam.itemsN)�__name__�
__module__�__qualname__rFr9r
rIr
r�SpamosrMrF)r3r6)r&rMr
rIr�test_init_callsmsz OrderedDictTests.test_init_callscCs�|j}|�d�}|�t|���dd�dD��|jddd�}|�t|���dd�dD��|jddd�}|�t|���dd�dD��dS)N�abccSsg|]}|df�qSr	r
��.0rr
r
r�
<listcomp>}�z2OrderedDictTests.test_fromkeys.<locals>.<listcomp>��valuecSsg|]}|df�qSr	r
rPr
r
rrRrSrcSsg|]}|df�qS�rr
rPr
r
rrR�rS)r3�fromkeysr6r:r9�r&r3rDr
r
r�
test_fromkeyszs
zOrderedDictTests.test_fromkeyscCs(|j}|�|�t�|�t|t��dSr	)r3�assertIsInstancer�
assertTrue�
issubclass)r&r3r
r
r�test_abc�szOrderedDictTests.test_abccCsN|j}gd�}t|�||�}|�t|�t|��|��|�t|�d�dS�N�)rrr)rrrrr,r)r3rr6�len�clear�r&r3r<rDr
r
r�
test_clear�szOrderedDictTests.test_clearcCs�|j}gd�}||�}|d=|�d|�|�t��|d=Wd�n1sN0Y|�t|���|dd�|dd��dS)Nr_rrr)r3�assertNotInr4�KeyErrorr6r:r9rbr
r
r�test_delitem�s$zOrderedDictTests.test_delitemcCs>|j}|gd��}d|d<d|d<|�t|���gd��dS)N)�rrrr�rrr�
r�r-)rgr)rrirhr)r-rj�r3r6r:r9rXr
r
r�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)	Nr_cSsg|]}|d�qSrVr
�rQ�tr
r
rrR�rSz3OrderedDictTests.test_iterators.<locals>.<listcomp>cSsg|]}|d�qSrVr
rmr
r
rrR�rScSsg|]}|d�qS�rr
rmr
r
rrR�rScSsg|]}|d�qSrVr
rmr
r
rrR�rScSsg|]}|d�qSrVr
rmr
r
rrR�rScSsg|]}|d�qSror
rmr
r
rrR�rS)r3rr6r:rF�valuesr9�reversedrbr
r
r�test_iterators�s$���zOrderedDictTests.test_iteratorscCs\|j}|�d�}t|�}t|�}||=|�t��t|�Wd�n1sN0YdS)NrO)r3rW�iter�nextr4�	Exception)r&r3rD�it�keyr
r
r�%test_detect_deletion_during_iteration�s
z6OrderedDictTests.test_detect_deletion_during_iterationcCs�|j}|�t��|ddgd�Wd�n1s40Ygd�}||�}|�t|�dd�|D��|�t|���dd�|D��|�t|���dd�|D��|�t|���|�|�tt|��tdd�t|�D���dS)	NrrrcSsg|]}|d�qSrVr
rmr
r
rrR�rSz:OrderedDictTests.test_sorted_iterators.<locals>.<listcomp>cSsg|]}|d�qSrVr
rmr
r
rrR�rScSsg|]}|d�qSror
rmr
r
rrR�rScSsg|]}|d�qSrVr
rmr
r
rrR�rS)	r3r4r5r6r7rFrpr9rqrbr
r
r�test_sorted_iterators�s,�z&OrderedDictTests.test_sorted_iteratorscCs�|j}|�}g}|�t|�|�|�t|���|�|�t|���|�|�t|���|�|�tt|��|�|�tt|����|�|�tt|����|�|�tt|����|�dSr	)r3r6r:rFrpr9rq)r&r3rD�emptyr
r
r�test_iterators_empty�sz%OrderedDictTests.test_iterators_emptycCs~|j}gd�}t|�||�}|r8|�|��|���q|�t��|��Wd�n1s`0Y|�t|�d�dSr^)r3rr6�popitem�popr4rer`rbr
r
r�test_popitem�s&zOrderedDictTests.test_popitemcCsb|j}dd�td�D�}||�}td�D]}|�d�q(|�d�|jdd�|�t|�d�dS)NcSsg|]}||f�qSr
r
�rQ�ir
r
rrR�rSz6OrderedDictTests.test_popitem_last.<locals>.<listcomp>�r@T�Zlastrj)r3�ranger|r6r`)r&r3r<�objr�r
r
r�test_popitem_last�s
z"OrderedDictTests.test_popitem_lastcCsH|j}gd�}t|�||�}t|�|rJ|��\}}|�|�|�|�q&|�t��|�d�Wd�n1st0Y|�t|�d�|�|�|d�d�Gdd�d|�}|dd�}|�|�d	d
�d
�|�|�dd�d�|�|�dd�d�|�|jddd
�d�|�t��|�d�Wd�n1�s:0YdS)Nr_Zxyzri90c@seZdZdd�ZdS)z*OrderedDictTests.test_pop.<locals>.MissingcSsdS�Nrr
�r&rwr
r
r�__missing__�sz6OrderedDictTests.test_pop.<locals>.Missing.__missing__N�rJrKrLr�r
r
r
r�Missing�sr�r�rrr rr.��default)r3rr}r6r4rer`)r&r3r<rD�k�vr��mr
r
r�test_pop�s((
zOrderedDictTests.test_popcCs�|j}gd�}t|�||�}||�}|�||�|dd�|dd�}||�}|�||�|�|t|��|�t|�|�|�|||dd���dS)Nr_r���)r3rr6ZassertNotEqualr8)r&r3r<Zod1Zod2r
r
r�
test_equality	szOrderedDictTests.test_equalityc
s�j}gd�}||����fdd�}|����|t����|t����td�j��fttjd�D]F}�j|d��&|t�	t�
�|���Wd�qh1s�0YqhWd�n1s�0Y|tt����|�}|�
��||�||���dS)Nr_csnd|�f}��|�|���|����t|���t�������t|�t�����t|�t���dS)Nz
copy: %s
od: %s)�assertIsNotr6r:r9r`�type)�dup�msg�rDr&r
r�checksz,OrderedDictTests.test_copying.<locals>.checkrr)�proto)r3�copyZdeepcopyr�moduler��pickle�HIGHEST_PROTOCOL�subTest�loads�dumps�eval�reprrC)r&r3r<r�r�Zupdate_testr
r�r�test_copyings T
zOrderedDictTests.test_copyingcCs:|j}gd�}||�}|�tdd�|��dD���dS)Nr_css|]}t|�tkVqdSr	)r�r:)rQZpairr
r
r�	<genexpr><rSz5OrderedDictTests.test_yaml_linkage.<locals>.<genexpr>r)r3r[�all�
__reduce__rbr
r
r�test_yaml_linkage4sz"OrderedDictTests.test_yaml_linkagecCsj|j}gd�}||�}|�|jt�|�|��d�d|_|�|jdd�|�|��dddi�dS)Nr_rri�x)r3rZ�__dict__r8�assertIsNoner�r�r6rbr
r
r�test_reduce_not_too_fat>sz(OrderedDictTests.test_reduce_not_too_fatcCs�|j}|�}||d<td|j��jtdtjd�D]H}t�t�||��}|�||�|�	t
|���dg�|�|d|�q2Wd�n1s�0YdS)Nrrr�)
r3rr�r�r�r�r�r�r�r6r:rF�assertIs)r&r3rDr�r�r
r
r�test_pickle_recursiveIsz&OrderedDictTests.test_pickle_recursivecCsL|j}|gd��}|�t|�d�|�tt|��|�|�t|��d�dS)Nr_zIOrderedDict([('c', 1), ('b', 2), ('a', 3), ('d', 4), ('e', 5), ('f', 6)])z
OrderedDict())r3r6r�r�rXr
r
r�	test_reprVs
�zOrderedDictTests.test_reprcCs,|j}|�d�}||d<|�t|�d�dS)NrOr�z@OrderedDict([('a', None), ('b', None), ('c', None), ('x', ...)]))r3rWr6r�rXr
r
r�test_repr_recursive^s

�z$OrderedDictTests.test_repr_recursivecCsP|j}|�}|��|d<t|�}|�|t�|��|d<t|�}|�|t�dS)Nr$)r3rpr�rZ�strr9)r&r3rD�rr
r
r�test_repr_recursive_valuesfs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)Nr_rrirr�r�)r�rir1r"r�c@seZdZdd�ZdS)z1OrderedDictTests.test_setdefault.<locals>.MissingcSsdSr�r
r�r
r
rr��sz=OrderedDictTests.test_setdefault.<locals>.Missing.__missing__Nr�r
r
r
rr��sr�r )r3rr:r9r6�
setdefault)r&r3r<rDZ
pair_orderr�r
r
r�test_setdefaulttsz OrderedDictTests.test_setdefaultcCs\|j}|�}d|d<d|d<|d=|�t|���dg�d|d<|�t|���ddg�dS)NrrrrrrrkrXr
r
r�
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�n1s�0Y|�t��|�d
d�Wd�n1�s$0YdS)N�abcderZabdecFZcabderrr�Zbcader�)r3rWr6r:�move_to_endr4rerXr
r
r�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)
NrOrFr�ZcabrZacbZbcaZbac)r3rWr�r6r:rXr
r
r�test_move_to_end_issue25406�s



z,OrderedDictTests.test_move_to_end_issue25406cCs:|j}tdd�}|fi|��}|�t�|�t�|��dS)Nrr�)r3r8Z
assertGreaterr
�	getsizeof)r&r3rrDr
r
r�test_sizeof�s
zOrderedDictTests.test_sizeofcCsL|j}d��}|�|�}|�|��t|����|�|��t|����dS)Nz@the quick brown fox jumped over a lazy dog yesterday before dawn)r3�splitrWr6rFr8r9)r&r3�srDr
r
r�
test_views�s

zOrderedDictTests.test_viewscCs:|j}Gdd�d|�}gd�}|�t||����|�dS)Nc@seZdZdd�ZdS)z3OrderedDictTests.test_override_update.<locals>.MyODc_s
t��dSr	)ru)r&�args�kwdsr
r
rrC�sz:OrderedDictTests.test_override_update.<locals>.MyOD.updateN)rJrKrLrCr
r
r
r�MyOD�sr�)rrrrk)r&r3r�r9r
r
r�test_override_update�sz%OrderedDictTests.test_override_updatecCs4|j}d}td�D]}|d|fg�}q~t��dS)Ni�)r3r�r�
gc_collect)r&r3r��_r
r
r�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	)rHr�r%�Zdeletedr
r�__del__�szBOrderedDictTests.test_highly_nested_subclass.<locals>.MyOD.__del__N)rJrKrLr�r
r�r
rr��sr��d)r3r�r�rr�r6r:rq)r&r3r�r�r�r
r�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��idrU)r&�hashr
r
rr;�szBOrderedDictTests.test_delitem_hash_collision.<locals>.Key.__init__cSs|jSr	)r�r%r
r
r�__hash__�szBOrderedDictTests.test_delitem_hash_collision.<locals>.Key.__hash__cSs(z|j|jkWSty"YdS0dS)NF)rU�AttributeError)r&r(r
r
r�__eq__�sz@OrderedDictTests.test_delitem_hash_collision.<locals>.Key.__eq__cSs|jSr	rTr%r
r
r�__repr__�szBOrderedDictTests.test_delitem_hash_collision.<locals>.Key.__repr__N)rJrKrLr;r�r�r�r
r
r
r�Key�sr�cSs$d}||d@}|d>||dS)Nr@rrr
)r�ZMINSIZEr�r
r
r�
blocking_hash�szCOrderedDictTests.test_delitem_hash_collision.<locals>.blocking_hashr.�after)r�.rk)	r&r3r�r�Z	COLLIDINGrwZ	collidingZblockingrDr
r
r�test_delitem_hash_collision�sz,OrderedDictTests.test_delitem_hash_collisioncCs
|j}Gdd�d�}|�}td�D]}|�}|||<q"|�t��t|���Wd�n1sb0Y|�t��t|���Wd�n1s�0Y|�t��t|�Wd�n1s�0Y|�t��|��Wd�n1s�0YdS)Nc@seZdZdd�ZdS)z-OrderedDictTests.test_issue24347.<locals>.KeycSstd�S)Ni��)rr%r
r
rr�sz6OrderedDictTests.test_issue24347.<locals>.Key.__hash__N�rJrKrLr�r
r
r
rr�sr�r�)	r3r�r4rer:rpr9r�r�)r&r3r�rDr�rwr
r
r�test_issue24347s
**&z OrderedDictTests.test_issue24347cCs0|j}Gdd�d�}|�}d||�<|��dS)Nc@seZdZdd�ZdS)z-OrderedDictTests.test_issue24348.<locals>.KeycSsdS)Nrr
r%r
r
rr�*sz6OrderedDictTests.test_issue24348.<locals>.Key.__hash__Nr�r
r
r
rr�)sr�r)r3r|)r&r3r�rDr
r
r�test_issue24348&s

z OrderedDictTests.test_issue24348cCsL|j}|�}dD]6}dD],}t|�dkr4|jdd�||}|||<qqdS)NZ0123456789ABCDEFrFr�)r3r`r|)r&r3rDZc0Zc1rwr
r
r�test_issue246672sz OrderedDictTests.test_issue24667cCs.|j}|�}t�|dd�|�dt|��dS�N�spamr�NULL)r3r8�__setitem__rdr�rXr
r
r�test_dict_setitemKsz"OrderedDictTests.test_dict_setitemcCs^|j}|�}d|d<d|d<t�|d�|�t��t|�Wd�n1sP0YdS�Nrr�r�ham)r3r8�__delitem__r4rer�rXr
r
r�test_dict_delitemQsz"OrderedDictTests.test_dict_delitemcCs:|j}|�}d|d<d|d<t�|�|�dt|��dS)Nrr�rr�r�)r3r8rardr�rXr
r
r�test_dict_clearZs
z OrderedDictTests.test_dict_clearcCs^|j}|�}d|d<d|d<t�|d�|�t��t|�Wd�n1sP0YdSr�)r3r8r}r4rer�rXr
r
r�
test_dict_popbszOrderedDictTests.test_dict_popcCs\|j}|�}d|d<d|d<t�|�|�t��t|�Wd�n1sN0YdSr�)r3r8r|r4rer�rXr
r
r�test_dict_popitemks
z"OrderedDictTests.test_dict_popitemcCs.|j}|�}t�|dd�|�dt|��dSr�)r3r8r�rdr�rXr
r
r�test_dict_setdefaulttsz%OrderedDictTests.test_dict_setdefaultcCs.|j}|�}t�|dg�|�dt|��dS)N)r�rr�)r3r8rCrdr�rXr
r
r�test_dict_updatezsz!OrderedDictTests.test_dict_updatecsF|j�G�fdd�d�}d|j|<t�|�}~t��|�|��dS)NcseZdZ��ZdS)z/OrderedDictTests.test_reference_loop.<locals>.AN)rJrKrLrDr
�r3r
r�A�sr�)r3rD�weakref�ref�gc�collectr�)r&r�r�r
r�r�test_reference_loop�s

z$OrderedDictTests.test_reference_loopcCsPt�|t|j�t�|dd�|j�t�|dd�|j�t�|dd�|j�dS)NcSst|���Sr	)rsrF�rr
r
r�<lambda>�rSz<OrderedDictTests.test_free_after_iterating.<locals>.<lambda>cSst|���Sr	)rsrpr�r
r
rr��rScSst|���Sr	)rsr9r�r
r
rr��rS)rZcheck_free_after_iteratingrsr3r%r
r
r�test_free_after_iterating�sz*OrderedDictTests.test_free_after_iteratingcCs^|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�n1�s�0Y|�t	��|d	BWd�n1�s�0Y|�t	��|dBWd�n1�s�0Y|�t	��|d
BWd�n1�s0Y|�t
��|dO}Wd�n1�sP0YdS)Nrr)rrrrr)rrr)rrrr)rrrrr
�ZBAD)r3r�r:r9r6r8r�r�r4r5�
ValueError)r&r3rrrr�expectedr
r
r�test_merge_operator�sF((((z$OrderedDictTests.test_merge_operatorcCs6t|�dgi����}t��|�t�t|���dSr	)rsr3r9r�r�r[Z
is_trackedrt)r&rvr
r
r�!test_ordered_dict_items_result_gc�sz2OrderedDictTests.test_ordered_dict_items_result_gcN)5rJrKrLr=r>rErNrYr]rcrfrlrrrxryr{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�r�r�cpython_onlyr�r
r
r
rrsb.
		




	'			+rc@seZdZeZejZdS)�PurePythonOrderedDictTestsN�rJrKrL�py_collr�r3r
r
r
rr��sr�c@seZdZeZeZdS)�CPythonBuiltinDictTestsN)rJrKrL�builtinsr�r8r3r
r
r
rr��sr�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@sHeZdZeZejZejZejdd��Z	dd�Z
dd�Zejdd��Zd	S)
�CPythonOrderedDictTestscCs||j}tj}tj}|j}|d�|d�}|d�}|d�}|d�}|�}	||	|dd|�d|	_||	|dd|�|	�d	d
�td�D��||	|d|dd|d|�|	�dd
�tdd
�D��||	|d|dd
|d
|�||	�	�|d��||	�
�|d��||	��|d��|d�}
|t|	�|
�|t|	�	��|
�|t|	�
��|
�|t|	���|
�dS)NZnQ2P3PnPn2PZ2nP2nZn2P�PZPn2Pr@r rcSsg|]}||f�qSr
r
rr
r
rrR�rSz=CPythonOrderedDictTests.test_sizeof_exact.<locals>.<listcomp>rcSsg|]}||f�qSr
r
rr
r
rrR�rSri�ZiP2n2P)
r3�struct�calcsizerZcalcobjsize�check_sizeofr�rCr�rFr9rprs)r&r3r�sizer�Z	basicsizeZ	entrysize�pZnodesizerDZitersizer
r
r�test_sizeof_exact�s0&&z)CPythonOrderedDictTests.test_sizeof_exactcCs|j}|�d�}|�t|�td��|�t��8t|�D]\}}|�|�|�|d�q8Wd�n1sl0Y|�t��"|D]}d|d<q�Wd�n1s�0Y|�t�� |D]
}|d=q�Wd�n1s�0Y|�t|�td��dS)Nr�r r-rZbdeaf)	r3rWr6r:r4�RuntimeError�	enumerater�Z
assertLess)r&r3rDr�r�r
r
r� test_key_change_during_iterations

,(&z8CPythonOrderedDictTests.test_key_change_during_iterationc
Cs�|j}gd�}||�}dD]�}t||�}t|��dd�}ttjd�D]z}|j||d��Xt|��}t|�t�	||�}	t�
|	�}
|�t|
�|�|�t|�|�Wd�qH1s�0YqHqdS)Nr_)rFrpr9r)�method_nameZprotocol)r3�getattrr:r�r�r�r�rsrtr�r�r6)r&r3r<rDr	Zmethr�r�rvrZ	unpickledr
r
r�test_iterators_picklings


z/CPythonOrderedDictTests.test_iterators_picklingcCsJt��|��}||_g}|�|�t�|�}|�|�~~~t��dSr	)r�r�r3�cyclerHr�r�)r&r�rZx_refr
r
r�"test_weakref_list_is_not_traversed*s


z:CPythonOrderedDictTests.test_weakref_list_is_not_traversedN)
rJrKrL�c_collr�r3rrr�rrrr
r
r
r
rr��s
r�c@s"eZdZeZGdd�dej�ZdS)�"PurePythonOrderedDictSubclassTestsc@seZdZdS)z.PurePythonOrderedDictSubclassTests.OrderedDictN�rJrKrLr
r
r
rr3Bsr3Nr�r
r
r
rr?src@s"eZdZeZGdd�dej�ZdS)�CPythonOrderedDictSubclassTestsc@seZdZdS)z+CPythonOrderedDictSubclassTests.OrderedDictNrr
r
r
rr3Isr3N)rJrKrLrr�r3r
r
r
rrFsrc@s eZdZedd��Zdd�ZdS)�PurePythonGeneralMappingTestscCstj|_dSr	�r�r3�	type2test��clsr
r
r�
setUpClassOsz(PurePythonGeneralMappingTests.setUpClasscCs|��}|�t|j�dSr	�Z_empty_mappingr4rer|�r&rr
r
rr~Ssz*PurePythonGeneralMappingTests.test_popitemN�rJrKrL�classmethodrr~r
r
r
rrMs
rc@s eZdZedd��Zdd�ZdS)�CPythonGeneralMappingTestscCstj|_dSr	�rr3rrr
r
rr[sz%CPythonGeneralMappingTests.setUpClasscCs|��}|�t|j�dSr	rrr
r
rr~_sz'CPythonGeneralMappingTests.test_popitemNrr
r
r
rrXs
rc@s eZdZedd��Zdd�ZdS)�PurePythonSubclassMappingTestscCsGdd�dtj�}||_dS)Nc@seZdZdS)z@PurePythonSubclassMappingTests.setUpClass.<locals>.MyOrderedDictNrr
r
r
r�
MyOrderedDicthsrr�rrr
r
rrfsz)PurePythonSubclassMappingTests.setUpClasscCs|��}|�t|j�dSr	rrr
r
rr~lsz+PurePythonSubclassMappingTests.test_popitemNrr
r
r
rrds
rc@s eZdZedd��Zdd�ZdS)�CPythonSubclassMappingTestscCsGdd�dtj�}||_dS)Nc@seZdZdS)z=CPythonSubclassMappingTests.setUpClass.<locals>.MyOrderedDictNrr
r
r
rrvsrrr r
r
rrtsz&CPythonSubclassMappingTests.setUpClasscCs|��}|�t|j�dSr	rrr
r
rr~zsz(CPythonSubclassMappingTests.test_popitemNrr
r
r
rr!qs
r!�__main__))r��
contextlibr�r�r�Zrandomrrrr
Zunittestr��collections.abcr�testrrZimport_fresh_moduler�r�contextmanagerrrZTestCaser�r�r��method�setattrr
Z
skipUnlessr�rrZBasicTestMappingProtocolrrrr!rJ�mainr
r
r
r�<module>sN
	0
�

]