Server : LiteSpeed
System : Linux server51.dnsbootclub.com 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
User : nandedex ( 1060)
PHP Version : 8.1.33
Disable Function : NONE
Directory :  /opt/cppython/lib/python3.8/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]


Current File : //opt/cppython/lib/python3.8/test/__pycache__/test_ordered_dict.cpython-38.pyc
U

>��g�x�@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	cs0tj|}|tj|<z
dVW5|tj|<XdS�N)�sys�modules)�nameZreplacementZoriginal_module�r
�5/opt/cppython/lib/python3.8/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\�Z0e1j2d]d^��Z3d_S)`�OrderedDictTestsc
Cs`|j}|�t��|ddgd�W5QRXdddddg}|�t|t|�����|�|�t|ft|�����|�|�t||����|�|�t|ddddgddd	����|�|�t|d
d����dg�|�t|d
d
����dg�|�t|d
�|�t|dd�|�t|j�|dddddg�}|jddgddd�|�t|���dddddddg�dS)N��a���b���c���d���e��r�	rr�rr�*��self)r%r#��other)r'r#r
�r�,�r�7��f��r��gr�r1r/)	�OrderedDict�assertRaises�	TypeError�assertEqual�sorted�dict�items�list�__init__)r%r3�pairsrr
r
r�	test_inits.�
��zOrderedDictTests.test_initcCsJ|j}dddddddg}t|�||�}|f|�}|�t|���|�dS)Nrrrrrr,r2)r3rr6r:r9)r%r3r9Zargdictrr
r
r�test_4687s
zOrderedDictTests.test_468c
Cs$|j}|�t��|��ddgd�W5QRXdddddg}|�}|�t|��|�t|���|�|�}|jft|��|�t|���|�|�}|�|�|�t|���|�|�}|jddddgddd	�|�t|���|�|�}|jd
d�|�t|���dg�|�}|jid
�|�t|���difg�|�}|jddddd�|�tt|����ddddg�|dddddg�}|jddgddd�|�t|���dddddddg�|�t|�jd�|�t|�jdd�|�t|j�|�t|�jd�|�t|�jdd�|�t|j�dS)Nrrrrrr rrr"�r$)r%r?r&r'r.r/�)�red�bluer'r%)rBr.)r'r/)rAr)r%r@r(r*r,rr0r2r#r
)	r3r4r5�updater8r6r7r9r:)r%r3r<�odrr
r
r�test_update?sL

��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>}sz2OrderedDictTests.test_fromkeys.<locals>.<listcomp>��valuecSsg|]}|df�qSr	r
rPr
r
rrRsrcSsg|]}|df�qS�rr
rPr
r
rrR�s)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_abccCsV|j}ddddddg}t|�||�}|�t|�t|��|��|�t|�d�dS�N�rrr�rrrrr,r)r3rr6�len�clear�r%r3r<rDr
r
r�
test_clear�szOrderedDictTests.test_clearc	Csx|j}ddddddg}||�}|d=|�d|�|�t��|d=W5QRX|�t|���|dd�|d	d��dS)
Nr^rr_rrr,rrr)r3�assertNotInr4�KeyErrorr6r:r9rbr
r
r�test_delitem�szOrderedDictTests.test_delitemc	CsL|j}|dddddg�}d|d<d|d	<|�t|���ddd
dddg�dS)N)rrrr)rrr�
r�r-)rrg)r-rh�r3r6r:r9rWr
r
r�test_setitem�s�zOrderedDictTests.test_setitemcCs"|j}ddddddg}t|�||�}|�t|�dd�|D��|�t|���d	d�|D��|�t|���d
d�|D��|�t|���|�|�tt|��dd�t|�D��|�tt|����dd�t|�D��|�tt|����d
d�t|�D��|�tt|����tt|���dS)Nr^rr_rrr,cSsg|]}|d�qSrUr
�rQ�tr
r
rrR�sz3OrderedDictTests.test_iterators.<locals>.<listcomp>cSsg|]}|d�qSrUr
rkr
r
rrR�scSsg|]}|d�qS�rr
rkr
r
rrR�scSsg|]}|d�qSrUr
rkr
r
rrR�scSsg|]}|d�qSrUr
rkr
r
rrR�scSsg|]}|d�qSrmr
rkr
r
rrR�s)r3rr6r:rF�valuesr9�reversedrbr
r
r�test_iterators�s$���zOrderedDictTests.test_iteratorsc	CsH|j}|�d�}t|�}t|�}||=|�t��t|�W5QRXdS)NrO)r3rV�iter�nextr4�	Exception)r%r3rD�it�keyr
r
r�%test_detect_deletion_during_iteration�s
z6OrderedDictTests.test_detect_deletion_during_iterationc	Cs�|j}|�t��|ddgd�W5QRXdddddg}||�}|�t|�dd�|D��|�t|���dd�|D��|�t|���d	d�|D��|�t|���|�|�tt|��td
d�t|�D���dS)NrrrrrcSsg|]}|d�qSrUr
rkr
r
rrR�sz:OrderedDictTests.test_sorted_iterators.<locals>.<listcomp>cSsg|]}|d�qSrUr
rkr
r
rrR�scSsg|]}|d�qSrmr
rkr
r
rrR�scSsg|]}|d�qSrUr
rkr
r
rrR�s)	r3r4r5r6r7rFrnr9rorbr
r
r�test_sorted_iterators�s�z&OrderedDictTests.test_sorted_iteratorscCs�|j}|�}g}|�t|�|�|�t|���|�|�t|���|�|�t|���|�|�tt|��|�|�tt|����|�|�tt|����|�|�tt|����|�dSr	)r3r6r:rFrnr9ro)r%r3rD�emptyr
r
r�test_iterators_empty�sz%OrderedDictTests.test_iterators_emptyc	Csr|j}ddddddg}t|�||�}|r@|�|��|���q&|�t��|��W5QRX|�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�sz6OrderedDictTests.test_popitem_last.<locals>.<listcomp>�r@T�Zlastrh)r3�rangerzr6r`)r%r3r<�objr~r
r
r�test_popitem_last�s
z"OrderedDictTests.test_popitem_lastc	Cs&|j}ddddddg}t|�||�}t|�|rR|��\}}|�|�|�|�q.|�t��|�d�W5QRX|�t|�d�|�|�|d	�d	�Gd
d�d|�}|dd
�}|�|�dd�d�|�|�dd�d�|�|�dd�d�|�|jddd�d�|�t��|�d�W5QRXdS)Nr^rr_rrr,Zxyzri90c@seZdZdd�ZdS)z*OrderedDictTests.test_pop.<locals>.MissingcSsdS�Nrr
�r%rur
r
r�__missing__�sz6OrderedDictTests.test_pop.<locals>.Missing.__missing__N�rJrKrLr�r
r
r
r�Missing�sr�r�rrrrr.��default)r3rr{r6r4rer`)r%r3r<rD�k�vr��mr
r
r�test_pop�s(
zOrderedDictTests.test_popcCs�|j}ddddddg}t|�||�}||�}|�||�|dd�|dd�}||�}|�||�|�|t|��|�t|�|�|�|||dd���dS)	Nr^rr_rrr,r���)r3rr6ZassertNotEqualr8)r%r3r<Zod1Zod2r
r
r�
test_equality	szOrderedDictTests.test_equalitycs��j}ddddddg}||����fdd�}|����|t����|t����td	�j��Httjd
�D]2}�j|d��|t�	t�
�|���W5QRXqpW5QRX|tt����|�}|�
��||�||���dS)Nr^rr_rrr,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�copy�deepcopyr�moduler��pickle�HIGHEST_PROTOCOL�subTest�loads�dumps�eval�reprrC)r%r3r<r�r�Zupdate_testr
r�r�test_copyings ,
zOrderedDictTests.test_copyingcCsB|j}ddddddg}||�}|�tdd�|��d	D���dS)
Nr^rr_rrr,css|]}t|�tkVqdSr	)r�r:)rQZpairr
r
r�	<genexpr><sz5OrderedDictTests.test_yaml_linkage.<locals>.<genexpr>r)r3rZ�all�
__reduce__rbr
r
r�test_yaml_linkage4sz"OrderedDictTests.test_yaml_linkagecCsr|j}ddddddg}||�}|�|jt�|�|��d�d|_|�|jd	d�|�|��dd	di�dS)
Nr^rr_rrr,rrg�x)r3rY�__dict__r8�assertIsNoner�r�r6rbr
r
r�test_reduce_not_too_fat>sz(OrderedDictTests.test_reduce_not_too_fatc	Cs�|j}|�}||d<td|j��`tdtjd�D]H}t�t�||��}|�||�|�	t
|���dg�|�|d|�q2W5QRXdS)Nrrr�)
r3rr�r�r�r�r�r�r�r6r:rFZassertIs)r%r3rDr�r�r
r
r�test_pickle_recursiveIsz&OrderedDictTests.test_pickle_recursivecCsT|j}|ddddddg�}|�t|�d�|�tt|��|�|�t|��d�dS)	Nr^rr_rrr,zIOrderedDict([('c', 1), ('b', 2), ('a', 3), ('d', 4), ('e', 5), ('f', 6)])z
OrderedDict())r3r6r�r�rWr
r
r�	test_reprVs
�zOrderedDictTests.test_reprcCs,|j}|�d�}||d<|�t|�d�dS)NrOr�z@OrderedDict([('a', None), ('b', None), ('c', None), ('x', ...)]))r3rVr6r�rWr
r
r�test_repr_recursive^s

�z$OrderedDictTests.test_repr_recursivecCsP|j}|�}|��|d<t|�}|�|t�|��|d<t|�}|�|t�dS)Nr#)r3rnr�rY�strr9)r%r3rD�rr
r
r�test_repr_recursive_valuesfsz+OrderedDictTests.test_repr_recursive_valuescCs�|j}ddddddg}t|�||�}t|���}|�|�dd�d	�|�t|���|�|�|�d
d�d�|�t|���dd�|�|jd
dd�d�Gdd�d|�}|�|��dd�d�dS)Nr^rr_rrr,rrgrr�r�)r�rgr1r!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)NrrrrrrrirWr
r
r�
test_reinsert�szOrderedDictTests.test_reinsertc	Cs|j}|�d�}|�t|�td��|�d�|�t|�td��|�dd�|�t|�td��|�dd�|�t|�td��|�d�|�t|�td��|jddd	�|�t|�td
��|�t��|�d�W5QRX|�t��|�dd�W5QRXdS)N�abcderZabdecrZcabderrFr�Zbcader�)r3rVr6r:�move_to_endr4rerWr
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)r3rVr�r6r:rWr
r
r�test_move_to_end_issue25406�s



z,OrderedDictTests.test_move_to_end_issue25406cCs6|j}tdd�}|f|�}|�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�splitrVr6rFr8r9)r%r3�srDr
r
r�
test_views�s

zOrderedDictTests.test_viewscCs<|j}Gdd�d|�}dddg}|�t||����|�dS)Nc@seZdZdd�ZdS)z3OrderedDictTests.test_override_update.<locals>.MyODc_s
t��dSr	)rs)r%�args�kwdsr
r
rrC�sz:OrderedDictTests.test_override_update.<locals>.MyOD.updateN)rJrKrLrCr
r
r
r�MyOD�sr�rrrri)r%r3r�r9r
r
r�test_override_update�s
z%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:ro)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��idrT)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|jkWStk
r$YdSXdS)NF)rT�AttributeError)r%r'r
r
r�__eq__�sz@OrderedDictTests.test_delitem_hash_collision.<locals>.Key.__eq__cSs|jSr	rSr$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�.ri)	r%r3r�r�Z	COLLIDINGruZ	colliding�blockingrDr
r
r�test_delitem_hash_collision�sz,OrderedDictTests.test_delitem_hash_collisionc	Cs�|j}Gdd�d�}|�}td�D]}|�}|||<q"|�t��t|���W5QRX|�t��t|���W5QRX|�t��t|�W5QRX|�t��|��W5QRXdS)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:rnr9r�r�)r%r3r�rDr~rur
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)r3rz)r%r3r�rDr
r
r�test_issue24348&s

z OrderedDictTests.test_issue24348cCsL|j}|�}dD]6}dD],}t|�dkr4|jdd�||}|||<qqdS)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)r3r`rz)r%r3rDZc0�c1rur
r
r�test_issue246672sz OrderedDictTests.test_issue24667cCs.|j}|�}t�|dd�|�dt|��dS�N�spamr�NULL)r3r8�__setitem__rdr�rWr
r
r�test_dict_setitemKsz"OrderedDictTests.test_dict_setitemc	CsJ|j}|�}d|d<d|d<t�|d�|�t��t|�W5QRXdS�Nrr�r�ham)r3r8�__delitem__r4rer�rWr
r
r�test_dict_delitemQsz"OrderedDictTests.test_dict_delitemcCs:|j}|�}d|d<d|d<t�|�|�dt|��dS)Nrr�rr�r�)r3r8rardr�rWr
r
r�test_dict_clearZs
z OrderedDictTests.test_dict_clearc	CsJ|j}|�}d|d<d|d<t�|d�|�t��t|�W5QRXdSr�)r3r8r{r4rer�rWr
r
r�
test_dict_popbszOrderedDictTests.test_dict_popc	CsH|j}|�}d|d<d|d<t�|�|�t��t|�W5QRXdSr�)r3r8rzr4rer�rWr
r
r�test_dict_popitemks
z"OrderedDictTests.test_dict_popitemcCs.|j}|�}t�|dd�|�dt|��dSr�)r3r8r�rdr�rWr
r
r�test_dict_setdefaulttsz%OrderedDictTests.test_dict_setdefaultcCs.|j}|�}t�|dg�|�dt|��dS)N)r�rr�)r3r8rCrdr�rWr
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	)rqrF�rr
r
r�<lambda>��z<OrderedDictTests.test_free_after_iterating.<locals>.<lambda>cSst|���Sr	)rqrnr�r
r
rr��r�cSst|���Sr	)rqr9r�r
r
rr��r�)rZcheck_free_after_iteratingrqr3r$r
r
r�test_free_after_iterating�sz*OrderedDictTests.test_free_after_iteratingcCs6t|�dgi����}t��|�t�t|���dSr	)rqr3r9r�r�rZZ
is_trackedrr)r%rtr
r
r�!test_ordered_dict_items_result_gc�sz2OrderedDictTests.test_ordered_dict_items_result_gcN)4rJrKrLr=r>rErNrXr\rcrfrjrprvrwryr|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
rrs`.
		




	'			rc@seZdZeZejZdS)�PurePythonOrderedDictTestsN�rJrKrL�py_collr�r3r
r
r
rr��sr�c@seZdZdZeZeZdS)�CPythonBuiltinDictTestszaBuiltin dict preserves insertion order.

    Reuse some of tests in OrderedDict selectively.
    N)rJrKrL�__doc__�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@rrcSsg|]}||f�qSr
r
r}r
r
rrR�sz=CPythonOrderedDictTests.test_sizeof_exact.<locals>.<listcomp>rcSsg|]}||f�qSr
r
r}r
r
rrR�srg�ZiP2n2P)
r3�struct�calcsizerZcalcobjsize�check_sizeofr�rCr�rFr9rnrq)r%r3r��sizer�Z	basicsizeZ	entrysize�pZnodesizerDZitersizer
r
r�test_sizeof_exact�s0&&z)CPythonOrderedDictTests.test_sizeof_exactc	Cs�|j}|�d�}|�t|�td��|�t��.t|�D]\}}|�|�|�|d�q8W5QRX|�t��|D]}d|d<qrW5QRX|�t��|D]
}|d=q�W5QRX|�t|�td��dS)Nr�rr-rZbdeaf)	r3rVr6r:r4�RuntimeError�	enumerater�Z
assertLess)r%r3rDr~r�r
r
r� test_key_change_during_iteration�s

z8CPythonOrderedDictTests.test_key_change_during_iterationcCs�|j}ddddddg}||�}dD]�}t||�}t|��dd�}ttjd�D]f}|j||d	��Nt|��}t|�t�	||�}	t�
|	�}
|�t|
�|�|�t|�|�W5QRXqPq"dS)
Nr^rr_rrr,)rFrnr9r)�method_name�protocol)r3�getattrr:r�r�r�r�rqrrr�r�r6)r%r3r<rDr�methZexpectedr~rtrZ	unpickledr
r
r�test_iterators_pickling�s


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
rr3sr3Nr�r
r
r
rrsrc@s"eZdZeZGdd�dej�ZdS)�CPythonOrderedDictSubclassTestsc@seZdZdS)z+CPythonOrderedDictSubclassTests.OrderedDictNrr
r
r
rr3sr3N)rJrKrLrr�r3r
r
r
rrsrc@s eZdZedd��Zdd�ZdS)�PurePythonGeneralMappingTestscCstj|_dSr	�r�r3�	type2test��clsr
r
r�
setUpClass$sz(PurePythonGeneralMappingTests.setUpClasscCs|��}|�t|j�dSr	�Z_empty_mappingr4rerz�r%rr
r
rr|(sz*PurePythonGeneralMappingTests.test_popitemN�rJrKrL�classmethodrr|r
r
r
rr"s
rc@s eZdZedd��Zdd�ZdS)�CPythonGeneralMappingTestscCstj|_dSr	�rr3rrr
r
rr0sz%CPythonGeneralMappingTests.setUpClasscCs|��}|�t|j�dSr	rrr
r
rr|4sz'CPythonGeneralMappingTests.test_popitemNrr
r
r
rr-s
rc@s eZdZedd��Zdd�ZdS)�PurePythonSubclassMappingTestscCsGdd�dtj�}||_dS)Nc@seZdZdS)z@PurePythonSubclassMappingTests.setUpClass.<locals>.MyOrderedDictNrr
r
r
r�
MyOrderedDict=srr�rrr
r
rr;sz)PurePythonSubclassMappingTests.setUpClasscCs|��}|�t|j�dSr	rrr
r
rr|Asz+PurePythonSubclassMappingTests.test_popitemNrr
r
r
rr9s
rc@s eZdZedd��Zdd�ZdS)�CPythonSubclassMappingTestscCsGdd�dtj�}||_dS)Nc@seZdZdS)z=CPythonSubclassMappingTests.setUpClass.<locals>.MyOrderedDictNrr
r
r
rrKsrrr r
r
rrIsz&CPythonSubclassMappingTests.setUpClasscCs|��}|�t|j�dSr	rrr
r
rr|Osz(CPythonSubclassMappingTests.test_popitemNrr
r
r
rr!Fs
r!�__main__))r��
contextlibr�r�r��randomrrr�r
Zunittestr��collections.abcr�testrrZimport_fresh_moduler�r�contextmanagerrrZTestCaser�r�r��method�setattrr	Z
skipUnlessr�rrZBasicTestMappingProtocolrrrr!rJ�mainr
r
r
r�<module>sN
	
�

]




F1le Man4ger