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

�Ke�j����dZddlZddlZddlZddlZddlmZmZmZm	Z	m
Z
mZddlZddl
mZeeee	fZe
efZeezZGd�dej��Zd�Zedkrej��dSdS)	zUnit tests for the copy module.�N)�le�lt�ge�gt�eq�ne)�supportc���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�Z2d1�Z3d2�Z4d3�Z5d4�Z6d5�Z7d6�Z8d7�Z9d8�Z:d9�Z;d:�Z<d;�Z=d<�Z>d=�Z?d>�Z@d?�ZAd@�ZBdA�ZCdB�ZDdC�ZEdD�ZFdE�ZGdF�ZHdG�ZIdH�ZJdI�ZKdJ�ZLdK�ZMdL�ZNdM�ZOdN�ZPdOS)P�TestCopyc��|�tjtj��|�ttjt����dS�N)�assertIs�copy�Error�error�
assertTrue�
issubclass�	Exception��selfs �8/usr/local/apps/python3/lib/python3.11/test/test_copy.py�test_exceptionszTestCopy.test_exceptionss>���
�
�d�j�$�*�-�-�-����
�4�:�y�9�9�:�:�:�:�:�c�^�d}tj|��}|�||��dS�N�*)r�assertEqual�r�x�ys   r�test_copy_basiczTestCopy.test_copy_basics0�����I�a�L�L������A�����rc����G�fd�dt����d��}tj|��}|�|j|j��|�|j|j��dS)Nc� ��eZdZd�Z�fd�ZdS)�"TestCopy.test_copy_copy.<locals>.Cc��||_dSr
��foo�rr's  r�__init__z+TestCopy.test_copy_copy.<locals>.C.__init__!�
������rc�$���|j��Sr
r&�r�Cs �r�__copy__z+TestCopy.test_copy_copy.<locals>.C.__copy__#�����q���{�{�"rN)�__name__�
__module__�__qualname__r)r.�r-s�rr-r$ s=�������
�
�
�
#�
#�
#�
#�
#�
#�
#rr-r)�objectrr�	__class__r'�rrr r-s   @r�test_copy_copyzTestCopy.test_copy_copys����	#�	#�	#�	#�	#�	#�	#��	#�	#�	#�

�A�b�E�E���I�a�L�L�������a�k�2�2�2��������&�&�&�&�&rc���Gd�dt����fd�}�d��}|�ttj|��t	j�|���tj|��}|�||��|�t|�����|�|j	|j	��dS)Nc��eZdZd�ZdS)�&TestCopy.test_copy_registry.<locals>.Cc�H�t�|��}||_|Sr
�r4�__new__r'��clsr'�objs   rr=z.TestCopy.test_copy_registry.<locals>.C.__new__,����n�n�S�)�)������
rN�r0r1r2r=�rrr-r:+�#������
�
�
�
�
rr-c����|jffSr
r&�r@r-s �r�pickle_Cz-TestCopy.test_copy_registry.<locals>.pickle_C0�������z�?�"rr)
r4�assertRaises�	TypeErrorr�copyreg�pickle�assertIsNotr�typer'�rrGrr r-s    @r�test_copy_registryzTestCopy.test_copy_registry*s����	�	�	�	�	��	�	�	�
	#�	#�	#�	#�	#�
�A�b�E�E�����)�T�Y��2�2�2���q�(�A�&�&�&��I�a�L�L������A��������a���!�$�$�$��������&�&�&�&�&rc����G�fd�dt��}g�|��}tj|��}|�||��|��dg��dS)Nc� ��eZdZ�fd�Zd�ZdS)�'TestCopy.test_copy_reduce_ex.<locals>.Cc�2����d��dS�N����append�r�proto�cs  �r�
__reduce_ex__z5TestCopy.test_copy_reduce_ex.<locals>.C.__reduce_ex__<������������rrc�0�|�d��dS�Nzshouldn't call this��failrs r�
__reduce__z2TestCopy.test_copy_reduce_ex.<locals>.C.__reduce__?����	�	�/�0�0�0�0�0rN�r0r1r2r]rc�r\s�rr-rS;�=�������
�
�
�
�
�
1�
1�
1�
1�
1rr-rV�r4rrr�rr-rr r\s    @r�test_copy_reduce_exzTestCopy.test_copy_reduce_ex:s����	1�	1�	1�	1�	1�	1�	1��	1�	1�	1�
��
�A�C�C���I�a�L�L���
�
�a���������Q�C� � � � � rc����G�fd�dt��}g�|��}tj|��}|�||��|��dg��dS)Nc���eZdZ�fd�ZdS)�$TestCopy.test_copy_reduce.<locals>.Cc�2����d��dSrUrX�rr\s �rrcz/TestCopy.test_copy_reduce.<locals>.C.__reduce__Ir^rN�r0r1r2rcrfs�rr-rmH�.�������
�
�
�
�
�
�
rr-rVrhris    @r�test_copy_reducezTestCopy.test_copy_reduceGs����	�	�	�	�	�	�	��	�	�	�
��
�A�C�C���I�a�L�L���
�
�a���������Q�C� � � � � rc��Gd�dt��}|��}|�tjtj|��dS)Nc��eZdZd�ZdS)�"TestCopy.test_copy_cant.<locals>.Cc��|�d��rt|���t�||��S�N�__reduce��
startswith�AttributeErrorr4�__getattribute__�r�names  rr|z3TestCopy.test_copy_cant.<locals>.C.__getattribute__T�:���?�?�:�.�.�/�(��.�.�.��.�.�t�T�:�:�:rN�r0r1r2r|rCrrr-ruS�#������
;�
;�
;�
;�
;rr-)r4rIrr�rr-rs   r�test_copy_cantzTestCopy.test_copy_cantRs[��	;�	;�	;�	;�	;��	;�	;�	;�

�A�C�C�����$�*�d�i��3�3�3�3�3rc��Gd�d��}Gd�dt��}d�}Gd�dtj���}dd	td
ddzd
ddddd|jdtt
d����t
d��tddd��||t|t��g}|D]*}|�
tj|��|���+dS)Nc��eZdZdS)�*TestCopy.test_copy_atomic.<locals>.ClassicN�r0r1r2rCrr�Classicr�^��������Drr�c��eZdZdS)�+TestCopy.test_copy_atomic.<locals>.NewStyleNr�rCrr�NewStyler�`r�rr�c��dSr
rCrCrr�fz$TestCopy.test_copy_atomic.<locals>.fb����Drc��eZdZdS)�0TestCopy.test_copy_atomic.<locals>.WithMetaclassNr�rCrr�
WithMetaclassr�dr�rr���	metaclass.r��d���Q�	@TF��?�hello�helloሴsworld��
rV)r4�abc�ABCMeta�NotImplemented�__code__�bytes�range�slice�max�propertyrr)rr�r�r�r��testsrs       r�test_copy_atomiczTestCopy.test_copy_atomic]s-��	�	�	�	�	�	�	�	�	�	�	�	�	�v�	�	�	�	�	�	�	�	�	�	�	�c�k�	�	�	�	��s�N��Q��V�T�4����-����5��s���,�,�e�B�i�i��q�"�a����7�C���
�
�	D��
�	+�	+�A��M�M�$�)�A�,�,��*�*�*�*�	+�	+rc��gd�}tj|��}|�||��|�||��g}tj|��}|�||��|�||��dS)N�rVr���rrrMrs   r�test_copy_listzTestCopy.test_copy_listns����I�I���I�a�L�L������A��������A�������I�a�L�L������A��������A�����rc�
�d}|�tj|��|��d}|�tj|��|��dddgf}|�tj|��|��dS)Nr�rCrVr�r�)rr�rrs  r�test_copy_tuplezTestCopy.test_copy_tuplexss�����
�
�d�i��l�l�A�&�&�&����
�
�d�i��l�l�A�&�&�&�
��1�b�M���
�
�d�i��l�l�A�&�&�&�&�&rc��ddd�}tj|��}|�||��|�||��i}tj|��}|�||��|�||��dS)NrVr��r'�barr�rs   r�test_copy_dictzTestCopy.test_copy_dict�s����a� � ���I�a�L�L������A��������A�������I�a�L�L������A��������A�����rc�*�hd�}tj|��}|�||��|�||��t��}tj|��}|�||��|�||��dS�N>rVr�r�)rrrM�setrs   r�
test_copy_setzTestCopy.test_copy_set�s����I�I���I�a�L�L������A��������A�����E�E���I�a�L�L������A��������A�����rc���thd���}|�tj|��|��t��}|�tj|��|��dSr�)�	frozensetrrr�s  r�test_copy_frozensetzTestCopy.test_copy_frozenset�sZ���i�i�i� � ���
�
�d�i��l�l�A�&�&�&��K�K���
�
�d�i��l�l�A�&�&�&�&�&rc�@�td��}tj|��}|�||��|�||��t��}tj|��}|�||��|�||��dS)Nsabc)�	bytearrayrrrMrs   r�test_copy_bytearrayzTestCopy.test_copy_bytearray�s����f�����I�a�L�L������A��������A�����K�K���I�a�L�L������A��������A�����rc��Gd�d��}|d��}|�tj|��|��dS)Nc��eZdZd�Zd�ZdS)�*TestCopy.test_copy_inst_vanilla.<locals>.Cc��||_dSr
r&r(s  rr)z3TestCopy.test_copy_inst_vanilla.<locals>.C.__init__�r*rc�"�|j|jkSr
r&�r�others  r�__eq__z1TestCopy.test_copy_inst_vanilla.<locals>.C.__eq__�����x�5�9�,�,rN�r0r1r2r)r�rCrrr-r���2������
�
�
�
-�
-�
-�
-�
-rr-r�rrr�s   r�test_copy_inst_vanillazTestCopy.test_copy_inst_vanilla�s]��	-�	-�	-�	-�	-�	-�	-�	-�

�A�b�E�E�������1���q�)�)�)�)�)rc���G�fd�d����d��}|�tj|��|��dS)Nc�&��eZdZd�Z�fd�Zd�ZdS)�'TestCopy.test_copy_inst_copy.<locals>.Cc��||_dSr
r&r(s  rr)z0TestCopy.test_copy_inst_copy.<locals>.C.__init__�r*rc�$���|j��Sr
r&r,s �rr.z0TestCopy.test_copy_inst_copy.<locals>.C.__copy__�r/rc�"�|j|jkSr
r&r�s  rr�z.TestCopy.test_copy_inst_copy.<locals>.C.__eq__�r�rN)r0r1r2r)r.r�r3s�rr-r��sL�������
�
�
�
#�
#�
#�
#�
#�
-�
-�
-�
-�
-rr-rr��rrr-s  @r�test_copy_inst_copyzTestCopy.test_copy_inst_copy�sh���	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�
�A�b�E�E�������1���q�)�)�)�)�)rc��Gd�d��}|d��}|�tj|��|��dS)Nc� �eZdZd�Zd�Zd�ZdS)�.TestCopy.test_copy_inst_getinitargs.<locals>.Cc��||_dSr
r&r(s  rr)z7TestCopy.test_copy_inst_getinitargs.<locals>.C.__init__�r*rc��|jfSr
r&rs r�__getinitargs__z>TestCopy.test_copy_inst_getinitargs.<locals>.C.__getinitargs__������{�"rc�"�|j|jkSr
r&r�s  rr�z5TestCopy.test_copy_inst_getinitargs.<locals>.C.__eq__�r�rN�r0r1r2r)r�r�rCrrr-r���A������
�
�
�
#�
#�
#�
-�
-�
-�
-�
-rr-rr�r�s   r�test_copy_inst_getinitargsz#TestCopy.test_copy_inst_getinitargs��]��	-�	-�	-�	-�	-�	-�	-�	-�
�A�b�E�E�������1���q�)�)�)�)�)rc�.�Gd�dt��}|d��}tj|��}|�||��|�||��|�||��|�|j|j��dS)Nc� �eZdZd�Zd�Zd�ZdS)�-TestCopy.test_copy_inst_getnewargs.<locals>.Cc�H�t�|��}||_|Sr
��intr=r'�r?r'rs   rr=z5TestCopy.test_copy_inst_getnewargs.<locals>.C.__new__�����{�{�3�'�'������rc��|jfSr
r&rs r�__getnewargs__z<TestCopy.test_copy_inst_getnewargs.<locals>.C.__getnewargs__�����x�y� rc�"�|j|jkSr
r&r�s  rr�z4TestCopy.test_copy_inst_getnewargs.<locals>.C.__eq__�r�rN�r0r1r2r=r�r�rCrrr-r���A������
�
�
�
!�
!�
!�
-�
-�
-�
-�
-rr-r�r�r�assertIsInstancerrMr'�rr-rr s    r�test_copy_inst_getnewargsz"TestCopy.test_copy_inst_getnewargs�s���	-�	-�	-�	-�	-��	-�	-�	-�
�A�b�E�E���I�a�L�L�����a��#�#�#�����A��������A�����������&�&�&�&�&rc�0�Gd�dt��}|d���}tj|��}|�||��|�||��|�||��|�|j|j��dS)Nc� �eZdZd�Zd�Zd�ZdS)�0TestCopy.test_copy_inst_getnewargs_ex.<locals>.Cc�H�t�|��}||_|Sr
r�r�s   rr=z8TestCopy.test_copy_inst_getnewargs_ex.<locals>.C.__new__�r�rc��dd|jifS�NrCr'r&rs r�__getnewargs_ex__zBTestCopy.test_copy_inst_getnewargs_ex.<locals>.C.__getnewargs_ex__�����E�4�8�,�,�,rc�"�|j|jkSr
r&r�s  rr�z7TestCopy.test_copy_inst_getnewargs_ex.<locals>.C.__eq__�r�rN�r0r1r2r=r�r�rCrrr-r���A������
�
�
�
-�
-�
-�
-�
-�
-�
-�
-rr-rr&r�r�s    r�test_copy_inst_getnewargs_exz%TestCopy.test_copy_inst_getnewargs_ex�s���	-�	-�	-�	-�	-��	-�	-�	-�
�A�"�I�I�I���I�a�L�L�����a��#�#�#�����A��������A�����������&�&�&�&�&rc��Gd�d��}|d��}|�tj|��|��dS)Nc� �eZdZd�Zd�Zd�ZdS)�+TestCopy.test_copy_inst_getstate.<locals>.Cc��||_dSr
r&r(s  rr)z4TestCopy.test_copy_inst_getstate.<locals>.C.__init__�r*rc��d|jiS�Nr'r&rs r�__getstate__z8TestCopy.test_copy_inst_getstate.<locals>.C.__getstate__�����t�x�(�(rc�"�|j|jkSr
r&r�s  rr�z2TestCopy.test_copy_inst_getstate.<locals>.C.__eq__�r�rN�r0r1r2r)rr�rCrrr-r���A������
�
�
�
)�
)�
)�
-�
-�
-�
-�
-rr-rr�r�s   r�test_copy_inst_getstatez TestCopy.test_copy_inst_getstate�r�rc��Gd�d��}|d��}|�tj|��|��dS)Nc� �eZdZd�Zd�Zd�ZdS)�+TestCopy.test_copy_inst_setstate.<locals>.Cc��||_dSr
r&r(s  rr)z4TestCopy.test_copy_inst_setstate.<locals>.C.__init__�r*rc� �|d|_dSrr&�r�states  r�__setstate__z8TestCopy.test_copy_inst_setstate.<locals>.C.__setstate__���� ��<����rc�"�|j|jkSr
r&r�s  rr�z2TestCopy.test_copy_inst_setstate.<locals>.C.__eq__�r�rN�r0r1r2r)rr�rCrrr-r��A������
�
�
�
(�
(�
(�
-�
-�
-�
-�
-rr-rr�r�s   r�test_copy_inst_setstatez TestCopy.test_copy_inst_setstate�r�rc���Gd�d��}|d��}|�tj|��|��|d��}|�tj|��|��dS)Nc�&�eZdZd�Zd�Zd�Zd�ZdS)�4TestCopy.test_copy_inst_getstate_setstate.<locals>.Cc��||_dSr
r&r(s  rr)z=TestCopy.test_copy_inst_getstate_setstate.<locals>.C.__init__�r*rc��|jSr
r&rs rrzATestCopy.test_copy_inst_getstate_setstate.<locals>.C.__getstate__��	���x�rc��||_dSr
r&rs  rrzATestCopy.test_copy_inst_getstate_setstate.<locals>.C.__setstate__�
�� ����rc�"�|j|jkSr
r&r�s  rr�z;TestCopy.test_copy_inst_getstate_setstate.<locals>.C.__eq__r�rN�r0r1r2r)rrr�rCrrr-r��P������
�
�
�
 �
 �
 �
!�
!�
!�
-�
-�
-�
-�
-rr-rgr�r�s   r� test_copy_inst_getstate_setstatez)TestCopy.test_copy_inst_getstate_setstate�s���	-�	-�	-�	-�	-�	-�	-�	-�
�A�b�E�E�������1���q�)�)�)�
�A�c�F�F�������1���q�)�)�)�)�)rc�^�d}tj|��}|�||��dSr)r�deepcopyrrs   r�test_deepcopy_basiczTestCopy.test_deepcopy_basic
s2�����M�!��������A�����rc��g}||g}tj|��}|�||��|�||��|�|d|d��|�|d|d��dS�NrrV)rr#rrMrrs   r�test_deepcopy_memozTestCopy.test_deepcopy_memos���
��
��F���M�!��������A��������A��������1��q��t�$�$�$��
�
�a��d�A�a�D�!�!�!�!�!rc��Gd�dt��}Gd�d|���}|�tj|��|��dS)Nc��eZdZdS)�/TestCopy.test_deepcopy_issubclass.<locals>.MetaNr�rCrr�Metar*"r�rr+c��eZdZdS)�,TestCopy.test_deepcopy_issubclass.<locals>.CNr�rCrrr-r-$r�rr-r�)rNrrr#)rr+r-s   r�test_deepcopy_issubclassz!TestCopy.test_deepcopy_issubclasss���
	�	�	�	�	�4�	�	�	�	�	�	�	�	�$�	�	�	�	������q�)�)�1�-�-�-�-�-rc����G�fd�dt����d��}tj|��}|�|j|j��|�|j|j��dS)Nc�"��eZdZd�Zd�fd�	ZdS)�*TestCopy.test_deepcopy_deepcopy.<locals>.Cc��||_dSr
r&r(s  rr)z3TestCopy.test_deepcopy_deepcopy.<locals>.C.__init__*r*rNc�$���|j��Sr
r&�r�memor-s  �r�__deepcopy__z7TestCopy.test_deepcopy_deepcopy.<locals>.C.__deepcopy__,r/rr
)r0r1r2r)r6r3s�rr-r1)sB�������
�
�
�
#�
#�
#�
#�
#�
#�
#�
#rr-r)r4rr#rr5r'r6s   @r�test_deepcopy_deepcopyzTestCopy.test_deepcopy_deepcopy(s����	#�	#�	#�	#�	#�	#�	#��	#�	#�	#�

�A�b�E�E���M�!���������a�k�2�2�2��������&�&�&�&�&rc���Gd�dt����fd�}�d��}|�ttj|��tj�|���tj|��}|�||��|�t|�����|�|j
|j
��dS)Nc��eZdZd�ZdS)�*TestCopy.test_deepcopy_registry.<locals>.Cc�H�t�|��}||_|Sr
r<r>s   rr=z2TestCopy.test_deepcopy_registry.<locals>.C.__new__5rArNrBrCrrr-r:4rDrr-c����|jffSr
r&rFs �rrGz1TestCopy.test_deepcopy_registry.<locals>.pickle_C9rHrr)r4rIrJrr#rKrLrMrrNr'rOs    @r�test_deepcopy_registryzTestCopy.test_deepcopy_registry3s����	�	�	�	�	��	�	�	�
	#�	#�	#�	#�	#�
�A�b�E�E�����)�T�]�A�6�6�6���q�(�A�&�&�&��M�!��������A��������a���!�$�$�$��������&�&�&�&�&rc����G�fd�dt��}g�|��}tj|��}|�||��|��dg��dS)Nc� ��eZdZ�fd�Zd�ZdS)�+TestCopy.test_deepcopy_reduce_ex.<locals>.Cc�2����d��dSrUrXrZs  �rr]z9TestCopy.test_deepcopy_reduce_ex.<locals>.C.__reduce_ex__Er^rc�0�|�d��dSr`rars rrcz6TestCopy.test_deepcopy_reduce_ex.<locals>.C.__reduce__HrdrNrerfs�rr-r@Drgrr-rV�r4rr#rrris    @r�test_deepcopy_reduce_exz TestCopy.test_deepcopy_reduce_exCs����	1�	1�	1�	1�	1�	1�	1��	1�	1�	1�
��
�A�C�C���M�!�����
�
�a���������Q�C� � � � � rc����G�fd�dt��}g�|��}tj|��}|�||��|��dg��dS)Nc���eZdZ�fd�ZdS)�(TestCopy.test_deepcopy_reduce.<locals>.Cc�2����d��dSrUrXros �rrcz3TestCopy.test_deepcopy_reduce.<locals>.C.__reduce__Rr^rNrprfs�rr-rGQrqrr-rVrCris    @r�test_deepcopy_reducezTestCopy.test_deepcopy_reducePs����	�	�	�	�	�	�	��	�	�	�
��
�A�C�C���M�!�����
�
�a���������Q�C� � � � � rc��Gd�dt��}|��}|�tjtj|��dS)Nc��eZdZd�ZdS)�&TestCopy.test_deepcopy_cant.<locals>.Cc��|�d��rt|���t�||��Srwryr}s  rr|z7TestCopy.test_deepcopy_cant.<locals>.C.__getattribute__]rrNr�rCrrr-rL\r�rr-)r4rIrrr#r�s   r�test_deepcopy_cantzTestCopy.test_deepcopy_cant[s[��	;�	;�	;�	;�	;��	;�	;�	;�

�A�C�C�����$�*�d�m�Q�7�7�7�7�7rc�$�Gd�d��}Gd�dt��}d�}ddtddd	zd
ddd
ddd|j|td��|tt��g}|D]*}|�tj|��|���+dS)Nc��eZdZdS)�.TestCopy.test_deepcopy_atomic.<locals>.ClassicNr�rCrrr�rQgr�rr�c��eZdZdS)�/TestCopy.test_deepcopy_atomic.<locals>.NewStyleNr�rCrrr�rSir�rr�c��dSr
rCrCrrr�z(TestCopy.test_deepcopy_atomic.<locals>.fkr�r.rr�r�r�TFr�sbytesr�r�r�)	r4r�r�r�r�r�rrr#)rr�r�r�r�rs      r�test_deepcopy_atomiczTestCopy.test_deepcopy_atomicfs���	�	�	�	�	�	�	�	�	�	�	�	�	�v�	�	�	�	�	�	��s�N�B��3���d�E�2��7�M�1�:��5��9�9�g�s�H�J�J�@���	/�	/�A��M�M�$�-��*�*�A�.�.�.�.�	/�	/rc���ddgdg}tj|��}|�||��|�||��|�|d|d��dS�NrVr�r�r�rr#rrMrs   r�test_deepcopy_listzTestCopy.test_deepcopy_lists�n����V�Q�K���M�!��������A��������A��������1��q��t�$�$�$�$�$rc�T�g}|�|��tj|��}tD]}|�t
|||��� |�||��|�|d|��|�t|��d��dSr&)
rYrr#�comparisonsrI�RecursionErrorrMrr�len�rrr �ops    r�test_deepcopy_reflexive_listz%TestCopy.test_deepcopy_reflexive_listzs�����	��������M�!�����	8�	8�B����n�b�!�Q�7�7�7�7�����A�����
�
�a��d�A��������Q����#�#�#�#�#rc�^�d}tj|��}|�||��dS�NrC�rr#rrs   r�test_deepcopy_empty_tuplez"TestCopy.test_deepcopy_empty_tuple�s0�����M�!�����
�
�a������rc���ddgdf}tj|��}|�||��|�||��|�|d|d��dSrWrXrs   r�test_deepcopy_tuplezTestCopy.test_deepcopy_tuple�rZrc�^�d}tj|��}|�||��dS)N)�rVr�r�rdrs   r�!test_deepcopy_tuple_of_immutablesz*TestCopy.test_deepcopy_tuple_of_immutables�s0�����M�!�����
�
�a������rc�l�gf}|d�|��tj|��}tD]}|�t
|||��� |�||��|�|d|d��|�|dd|��dS�Nr)rYrr#r\rIr]rMrr_s    r�test_deepcopy_reflexive_tuplez&TestCopy.test_deepcopy_reflexive_tuple�s���
�E��	�!����A�����M�!�����	8�	8�B����n�b�!�Q�7�7�7�7�����A��������1��q��t�$�$�$��
�
�a��d�1�g�q�!�!�!�!�!rc���ddgdd�}tj|��}|�||��|�||��|�|d|d��dS)NrVr�r�r�r'rXrs   r�test_deepcopy_dictzTestCopy.test_deepcopy_dict�sr����F�1�%�%���M�!��������A��������A��������5��1�U�8�,�,�,�,�,rc��i}||d<tj|��}tD]}|�t|||��� t
D]}|�t|||��� |�||��|�|d|��|�	t|��d��dS)Nr'rV)rr#�order_comparisonsrIrJ�equality_comparisonsr]rMrrr^r_s    r�test_deepcopy_reflexive_dictz%TestCopy.test_deepcopy_reflexive_dict�s�������%���M�!����#�	3�	3�B����i��Q��2�2�2�2�&�	8�	8�B����n�b�!�Q�7�7�7�7�����A�����
�
�a��h��"�"�"�����Q����#�#�#�#�#rc��i}g}tj||��}|�|t|��d|��dSrl)rr#r�id�rr5rr s    r�test_deepcopy_keepalivez TestCopy.test_deepcopy_keepalive�sF�������M�!�T�"�"���
�
�d�2�d�8�8�n�Q�'��+�+�+�+�+rc�T�i}gd�}tj||��}|�||��|�t|��d��i}dg}tj||��}|�||��|�t|��d��dS)N)rVr�r��r�ri)rr#rr^rvs    r�!test_deepcopy_dont_memo_immutablez*TestCopy.test_deepcopy_dont_memo_immutable�s������L�L���M�!�T�"�"������A��������T���A�&�&�&���
�H���M�!�T�"�"������A��������T���A�&�&�&�&�&rc���Gd�d��}|dg��}tj|��}|�||��|�|j|j��dS)Nc��eZdZd�Zd�ZdS)�.TestCopy.test_deepcopy_inst_vanilla.<locals>.Cc��||_dSr
r&r(s  rr)z7TestCopy.test_deepcopy_inst_vanilla.<locals>.C.__init__�r*rc�"�|j|jkSr
r&r�s  rr�z5TestCopy.test_deepcopy_inst_vanilla.<locals>.C.__eq__�r�rNr�rCrrr-r}�r�rr-r�rr#rrMr'r�s    r�test_deepcopy_inst_vanillaz#TestCopy.test_deepcopy_inst_vanilla�s���	-�	-�	-�	-�	-�	-�	-�	-�

�A�r�d�G�G���M�!��������A�����������&�&�&�&�&rc���G�fd�d����dg��}tj|��}|�||��|�||��|�|j|j��dS)Nc�&��eZdZd�Z�fd�Zd�ZdS)�/TestCopy.test_deepcopy_inst_deepcopy.<locals>.Cc��||_dSr
r&r(s  rr)z8TestCopy.test_deepcopy_inst_deepcopy.<locals>.C.__init__�r*rc�J���tj|j|����Sr
)rr#r'r4s  �rr6z<TestCopy.test_deepcopy_inst_deepcopy.<locals>.C.__deepcopy__�s!����q���t�x��6�6�7�7�7rc�"�|j|jkSr
r&r�s  rr�z6TestCopy.test_deepcopy_inst_deepcopy.<locals>.C.__eq__�r�rN)r0r1r2r)r6r�r3s�rr-r��sL�������
�
�
�
8�
8�
8�
8�
8�
-�
-�
-�
-�
-rr-rr�r6s   @r�test_deepcopy_inst_deepcopyz$TestCopy.test_deepcopy_inst_deepcopy�s����	-�	-�	-�	-�	-�	-�	-�	-�	-�	-�
�A�r�d�G�G���M�!��������A��������A�����������&�&�&�&�&rc��Gd�d��}|dg��}tj|��}|�||��|�||��|�|j|j��dS)Nc� �eZdZd�Zd�Zd�ZdS)�2TestCopy.test_deepcopy_inst_getinitargs.<locals>.Cc��||_dSr
r&r(s  rr)z;TestCopy.test_deepcopy_inst_getinitargs.<locals>.C.__init__�r*rc��|jfSr
r&rs rr�zBTestCopy.test_deepcopy_inst_getinitargs.<locals>.C.__getinitargs__�r�rc�"�|j|jkSr
r&r�s  rr�z9TestCopy.test_deepcopy_inst_getinitargs.<locals>.C.__eq__�r�rNr�rCrrr-r��r�rr-rr�r�s    r�test_deepcopy_inst_getinitargsz'TestCopy.test_deepcopy_inst_getinitargs����	-�	-�	-�	-�	-�	-�	-�	-�
�A�r�d�G�G���M�!��������A��������A�����������&�&�&�&�&rc�p�Gd�dt��}|dg��}tj|��}|�||��|�||��|�||��|�|j|j��|�|j|j��dS)Nc� �eZdZd�Zd�Zd�ZdS)�1TestCopy.test_deepcopy_inst_getnewargs.<locals>.Cc�H�t�|��}||_|Sr
r�r�s   rr=z9TestCopy.test_deepcopy_inst_getnewargs.<locals>.C.__new__�r�rc��|jfSr
r&rs rr�z@TestCopy.test_deepcopy_inst_getnewargs.<locals>.C.__getnewargs__�r�rc�"�|j|jkSr
r&r�s  rr�z8TestCopy.test_deepcopy_inst_getnewargs.<locals>.C.__eq__�r�rNr�rCrrr-r��r�rr-r�r�rr#r�rrMr'r�s    r�test_deepcopy_inst_getnewargsz&TestCopy.test_deepcopy_inst_getnewargs�s���	-�	-�	-�	-�	-��	-�	-�	-�
�A�r�d�G�G���M�!�������a��#�#�#�����A��������A�����������&�&�&��������&�&�&�&�&rc�r�Gd�dt��}|dg���}tj|��}|�||��|�||��|�||��|�|j|j��|�|j|j��dS)Nc� �eZdZd�Zd�Zd�ZdS)�4TestCopy.test_deepcopy_inst_getnewargs_ex.<locals>.Cc�H�t�|��}||_|Sr
r�r�s   rr=z<TestCopy.test_deepcopy_inst_getnewargs_ex.<locals>.C.__new__r�rc��dd|jifSr�r&rs rr�zFTestCopy.test_deepcopy_inst_getnewargs_ex.<locals>.C.__getnewargs_ex__r�rc�"�|j|jkSr
r&r�s  rr�z;TestCopy.test_deepcopy_inst_getnewargs_ex.<locals>.C.__eq__r�rNr�rCrrr-r�r�rr-rr&r�r�s    r� test_deepcopy_inst_getnewargs_exz)TestCopy.test_deepcopy_inst_getnewargs_exs���	-�	-�	-�	-�	-��	-�	-�	-�
�A�2�$�K�K�K���M�!�������a��#�#�#�����A��������A�����������&�&�&��������&�&�&�&�&rc��Gd�d��}|dg��}tj|��}|�||��|�||��|�|j|j��dS)Nc� �eZdZd�Zd�Zd�ZdS)�/TestCopy.test_deepcopy_inst_getstate.<locals>.Cc��||_dSr
r&r(s  rr)z8TestCopy.test_deepcopy_inst_getstate.<locals>.C.__init__r*rc��d|jiSrr&rs rrz<TestCopy.test_deepcopy_inst_getstate.<locals>.C.__getstate__rrc�"�|j|jkSr
r&r�s  rr�z6TestCopy.test_deepcopy_inst_getstate.<locals>.C.__eq__r�rNrrCrrr-r�rrr-rr�r�s    r�test_deepcopy_inst_getstatez$TestCopy.test_deepcopy_inst_getstater�rc��Gd�d��}|dg��}tj|��}|�||��|�||��|�|j|j��dS)Nc� �eZdZd�Zd�Zd�ZdS)�/TestCopy.test_deepcopy_inst_setstate.<locals>.Cc��||_dSr
r&r(s  rr)z8TestCopy.test_deepcopy_inst_setstate.<locals>.C.__init__"r*rc� �|d|_dSrr&rs  rrz<TestCopy.test_deepcopy_inst_setstate.<locals>.C.__setstate__$rrc�"�|j|jkSr
r&r�s  rr�z6TestCopy.test_deepcopy_inst_setstate.<locals>.C.__eq__&r�rNrrCrrr-r�!rrr-rr�r�s    r�test_deepcopy_inst_setstatez$TestCopy.test_deepcopy_inst_setstate r�rc���Gd�d��}|dg��}tj|��}|�||��|�||��|�|j|j��|g��}tj|��}|�||��|�||��|�|j|j��dS)Nc�&�eZdZd�Zd�Zd�Zd�ZdS)�8TestCopy.test_deepcopy_inst_getstate_setstate.<locals>.Cc��||_dSr
r&r(s  rr)zATestCopy.test_deepcopy_inst_getstate_setstate.<locals>.C.__init__0r*rc��|jSr
r&rs rrzETestCopy.test_deepcopy_inst_getstate_setstate.<locals>.C.__getstate__2rrc��||_dSr
r&rs  rrzETestCopy.test_deepcopy_inst_getstate_setstate.<locals>.C.__setstate__4rrc�"�|j|jkSr
r&r�s  rr�z?TestCopy.test_deepcopy_inst_getstate_setstate.<locals>.C.__eq__6r�rNrrCrrr-r�/r rr-rr�r�s    r�$test_deepcopy_inst_getstate_setstatez-TestCopy.test_deepcopy_inst_getstate_setstate.s���	-�	-�	-�	-�	-�	-�	-�	-�
�A�r�d�G�G���M�!��������A��������A�����������&�&�&�
�A�b�E�E���M�!��������A��������A�����������&�&�&�&�&rc���Gd�d��}|��}||_tj|��}|�||��|�|j|��dS)Nc��eZdZdS)�0TestCopy.test_deepcopy_reflexive_inst.<locals>.CNr�rCrrr-r�Er�rr-)r'rr#rMrr�s    r�test_deepcopy_reflexive_instz%TestCopy.test_deepcopy_reflexive_instDs}��	�	�	�	�	�	�	�	�
�A�C�C������M�!��������A�����
�
�a�e�Q�����rc���Gd�dt��}|��}tj|��}|�||��tj|��}|�||��dS)Nc��eZdZd�ZdS)�+TestCopy.test_reconstruct_string.<locals>.Cc��dS)NrWrCrs rrcz6TestCopy.test_reconstruct_string.<locals>.C.__reduce__Qs���rrNrprCrrr-r�Ps#������
�
�
�
�
rr-)r4rrr#r�s    r�test_reconstruct_stringz TestCopy.test_reconstruct_stringOs���	�	�	�	�	��	�	�	�
�A�C�C���I�a�L�L���
�
�a������M�!�����
�
�a������rc�$��G�fd�dt������}d|_tj|��}|�|j|j��tj|��}|�|j|j��dS)Nc���eZdZ�fd�ZdS)�,TestCopy.test_reconstruct_nostate.<locals>.Cc����dfSrcrCr,s �rrcz7TestCopy.test_reconstruct_nostate.<locals>.C.__reduce__[s����2�w�rNrpr3s�rr-r�Zs.�������
�
�
�
�
�
�
rr-r)r4r'rrr5r#r6s   @r�test_reconstruct_nostatez!TestCopy.test_reconstruct_nostateYs����	�	�	�	�	�	�	��	�	�	�
�A�C�C������I�a�L�L���
�
�a�k�1�;�/�/�/��M�!�����
�
�a�k�1�;�/�/�/�/�/rc�>��G�fd�dt������}dg|_tj|��}|�||��tj|��}|�||��|�|j|j��dS)Nc� ��eZdZ�fd�Zd�ZdS)�*TestCopy.test_reconstruct_state.<locals>.Cc����d|jfSrc��__dict__r,s �rrcz5TestCopy.test_reconstruct_state.<locals>.C.__reduce__f�����2�t�}�-�-rc�"�|j|jkSr
r�r�s  rr�z1TestCopy.test_reconstruct_state.<locals>.C.__eq__h����}���6�6rN�r0r1r2rcr�r3s�rr-r�es=�������
.�
.�
.�
.�
.�
7�
7�
7�
7�
7rr-r�r4r'rrr#rMr6s   @r�test_reconstruct_statezTestCopy.test_reconstruct_stateds����	7�	7�	7�	7�	7�	7�	7��	7�	7�	7�

�A�C�C�������I�a�L�L������A�����M�!��������A�����������&�&�&�&�&rc�>��G�fd�dt������}dg|_tj|��}|�||��tj|��}|�||��|�|j|j��dS)Nc�&��eZdZ�fd�Zd�Zd�ZdS)�3TestCopy.test_reconstruct_state_setstate.<locals>.Cc����d|jfSrcr�r,s �rrcz>TestCopy.test_reconstruct_state_setstate.<locals>.C.__reduce__tr�rc�:�|j�|��dSr
)r��updaters  rrz@TestCopy.test_reconstruct_state_setstate.<locals>.C.__setstate__vs���
�$�$�U�+�+�+�+�+rc�"�|j|jkSr
r�r�s  rr�z:TestCopy.test_reconstruct_state_setstate.<locals>.C.__eq__xr�rN)r0r1r2rcrr�r3s�rr-r�ssL�������
.�
.�
.�
.�
.�
,�
,�
,�
7�
7�
7�
7�
7rr-rr�r6s   @r�test_reconstruct_state_setstatez(TestCopy.test_reconstruct_state_setstaters����	7�	7�	7�	7�	7�	7�	7��	7�	7�	7�
�A�C�C�������I�a�L�L������A�����M�!��������A�����������&�&�&�&�&rc���Gd�dt��}|��}||_tj|��}|�||��|�|j|��dS)Nc��eZdZdS)�.TestCopy.test_reconstruct_reflexive.<locals>.CNr�rCrrr-r��r�rr-)r4r'rr#rMrr�s    r�test_reconstruct_reflexivez#TestCopy.test_reconstruct_reflexive�s��	�	�	�	�	��	�	�	�
�A�C�C������M�!��������A�����
�
�a�e�Q�����rc����G�fd�dt����ddgdg��}tj|��}|�||��|�||��|�|d|d��tj|��}|�||��|�||��|�|d|d��dS)Nc� ��eZdZ�fd�Zd�ZdS)�&TestCopy.test_reduce_4tuple.<locals>.Cc�4���d|jt|��fSrc)r��iterr,s �rrcz1TestCopy.test_reduce_4tuple.<locals>.C.__reduce__�s����2�t�}�d�4�j�j�9�9rc�b�t|��t|��ko|j|jkSr
)�listr�r�s  rr�z-TestCopy.test_reduce_4tuple.<locals>.C.__eq__��,���T�
�
�d�5�k�k�1�8��
���7�9rNr�r3s�rr-r��s=�������
:�
:�
:�
:�
:�
9�
9�
9�
9�
9rr-rVr�r�r)r�rrrMrr#r6s   @r�test_reduce_4tuplezTestCopy.test_reduce_4tuple�s���	9�	9�	9�	9�	9�	9�	9��	9�	9�	9�
�A��1�v�q�k�N�N���I�a�L�L������A��������A�����
�
�a��d�A�a�D�!�!�!��M�!��������A��������A��������1��q��t�$�$�$�$�$rc����G�fd�dt����dddgfdg��}tj|��}|�||��|�||��|�|d|d��tj|��}|�||��|�||��|�|d|d��dS)Nc� ��eZdZ�fd�Zd�ZdS)�&TestCopy.test_reduce_5tuple.<locals>.Cc�@���d|jd|���fSrc)r��itemsr,s �rrcz1TestCopy.test_reduce_5tuple.<locals>.C.__reduce__�s����2�t�}�d�D�J�J�L�L�A�Arc�b�t|��t|��ko|j|jkSr
)�dictr�r�s  rr�z-TestCopy.test_reduce_5tuple.<locals>.C.__eq__�r�rNr�r3s�rr-r��sB�������
B�
B�
B�
B�
B�
9�
9�
9�
9�
9rr-r'rVr�)r�r�)r�rrrMrr#r6s   @r�test_reduce_5tuplezTestCopy.test_reduce_5tuple�s	���	9�	9�	9�	9�	9�	9�	9��	9�	9�	9�
�A���1�v��
�+�,�,���I�a�L�L������A��������A�����
�
�a��h��%��)�)�)��M�!��������A��������A��������5��1�U�8�,�,�,�,�,rc�d�����fd��G��fd�d������}��t��5tj|��ddd��n#1swxYwY��t��5tj|��ddd��dS#1swxYwYdS)Nc�2����d��dSr`ra)�args�kwargsrs  �r�state_setterz1TestCopy.test_reduce_6tuple.<locals>.state_setter�s����I�I�+�,�,�,�,�,rc���eZdZ��fd�ZdS)�&TestCopy.test_reduce_6tuple.<locals>.Cc����d|jdd�fSrcr�)rr-r�s ��rrcz1TestCopy.test_reduce_6tuple.<locals>.C.__reduce__�s����"�d�m�T�4��E�ErNrp)r-r�s��rr-r��s;�������
F�
F�
F�
F�
F�
F�
F�
Frr-�rIrJrr#)rrr-r�s` @@r�test_reduce_6tuplezTestCopy.test_reduce_6tuple�sk�����	-�	-�	-�	-�	-�	F�	F�	F�	F�	F�	F�	F�	F�	F�	F�	F�
�A�C�C��
�
�
�y�
)�
)�	�	��I�a�L�L�L�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�
�
�
�y�
)�
)�	�	��M�!����	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s#�A�A"�%A"�B%�%B)�,B)c�T��G�fd�d������}|�t��5tj|��ddd��n#1swxYwY|�t��5tj|��ddd��dS#1swxYwYdS)Nc���eZdZ�fd�ZdS)�+TestCopy.test_reduce_6tuple_none.<locals>.Cc����d|jdddfSrcr�r,s �rrcz6TestCopy.test_reduce_6tuple_none.<locals>.C.__reduce__�s����"�d�m�T�4��=�=rNrpr3s�rr-r��s.�������
>�
>�
>�
>�
>�
>�
>rr-r�r�s  @r�test_reduce_6tuple_nonez TestCopy.test_reduce_6tuple_none�s@���	>�	>�	>�	>�	>�	>�	>�	>�	>�	>�
�A�C�C��
�
�
�y�
)�
)�	�	��I�a�L�L�L�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�
�
�
�y�
)�
)�	�	��M�!����	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s#�A�A�A�;B�B!�$B!c��Gd�dt��}|��}dg|_tj|��}|�|j|j��dS)Nc��eZdZdgZdS)�#TestCopy.test_copy_slots.<locals>.Cr'N�r0r1r2�	__slots__rCrrr-r�����������I�I�Irr-r)r4r'rrr�s    r�test_copy_slotszTestCopy.test_copy_slots�sk��	 �	 �	 �	 �	 ��	 �	 �	 �
�A�C�C�������I�a�L�L���
�
�a�e�Q�U�#�#�#�#�#rc��Gd�dt��}|��}dg|_tj|��}|�|j|j��|�|j|j��dS)Nc��eZdZdgZdS)�'TestCopy.test_deepcopy_slots.<locals>.Cr'Nr�rCrrr-r�rrr-r)r4r'rr#rrMr�s    r�test_deepcopy_slotszTestCopy.test_deepcopy_slots�s���	 �	 �	 �	 �	 ��	 �	 �	 �
�A�C�C�������M�!�����������&�&�&��������&�&�&�&�&rc�~�Gd�dt��}|ddi���}tj|��}|�||��|�|j|j��|�||��d|d<|�||��|�|j|j��dS)Nc�*��eZdZd�fd�	Z�fd�Z�xZS)�/TestCopy.test_deepcopy_dict_subclass.<locals>.CNc���|si}t|�����|_t���|��dSr
)r��keys�_keys�superr))r�dr5s  �rr)z8TestCopy.test_deepcopy_dict_subclass.<locals>.C.__init__�sC������A�!�!�&�&�(�(�^�^��
���� � ��#�#�#�#�#rc���t���||��||jvr|j�|��dSdSr
)r
�__setitem__rrY)r�key�itemr5s   �rrz;TestCopy.test_deepcopy_dict_subclass.<locals>.C.__setitem__�sN������#�#�C��.�.�.��d�j�(�(��J�%�%�c�*�*�*�*�*�)�(rr
)r0r1r2r)r�
__classcell__)r5s@rr-r	�sV�������
$�
$�
$�
$�
$�
$�

+�
+�
+�
+�
+�
+�
+�
+�
+rr-r'r)rrVr�)r�rr#rrrM�assertNotEqualr�s    r�test_deepcopy_dict_subclassz$TestCopy.test_deepcopy_dict_subclass�s���		+�		+�		+�		+�		+��		+�		+�		+�
�A��q�	�N�N�N���M�!��������A���������!�'�*�*�*�����A������%�����A�q�!�!�!����A�G�Q�W�-�-�-�-�-rc��Gd�dt��}|ddgdg��}ddg|_tj|��}|�t|��t|����|�|j|j��|�|d|d��|�|j|j��dS)	Nc��eZdZdS)�+TestCopy.test_copy_list_subclass.<locals>.CNr�rCrrr-r�r�rr-rVr�r�ry�r)r�r'rrrr�s    r�test_copy_list_subclassz TestCopy.test_copy_list_subclass�s���	�	�	�	�	��	�	�	�
�A��1�v�q�k�N�N���A�����I�a�L�L������a���$�q�'�'�*�*�*��������&�&�&��
�
�a��d�A�a�D�!�!�!��
�
�a�e�Q�U�#�#�#�#�#rc��Gd�dt��}|ddgdg��}ddg|_tj|��}|�t|��t|����|�|j|j��|�|d|d��|�|j|j��dS)	Nc��eZdZdS)�/TestCopy.test_deepcopy_list_subclass.<locals>.CNr�rCrrr-r�r�rr-rVr�r�ryrr)r�r'rr#rrMr�s    r�test_deepcopy_list_subclassz$TestCopy.test_deepcopy_list_subclass�s���	�	�	�	�	��	�	�	�
�A��1�v�q�k�N�N���A�����M�!��������a���$�q�'�'�*�*�*��������&�&�&�����1��q��t�$�$�$��������&�&�&�&�&rc��Gd�dt��}|gd���}|�t|��d��tj|��}|�t|��d��dS)Nc��eZdZdS)�,TestCopy.test_copy_tuple_subclass.<locals>.CNr�rCrrr-r!r�rr-r�)�tuplerrr�s    r�test_copy_tuple_subclassz!TestCopy.test_copy_tuple_subclasss���	�	�	�	�	��	�	�	�
�A�i�i�i�L�L������q���9�-�-�-��I�a�L�L������q���9�-�-�-�-�-rc�~�Gd�dt��}|ddgdg��}|�t|��ddgdf��tj|��}|�t|��ddgdf��|�||��|�|d|d��dS)Nc��eZdZdS)�0TestCopy.test_deepcopy_tuple_subclass.<locals>.CNr�rCrrr-r&	r�rr-rVr�r�r)r"rrr#rMr�s    r�test_deepcopy_tuple_subclassz%TestCopy.test_deepcopy_tuple_subclasss���	�	�	�	�	��	�	�	�
�A��1�v�q�k�N�N������q���Q��F�A�;�/�/�/��M�!��������q���Q��F�A�;�/�/�/�����A��������1��q��t�$�$�$�$�$rc��Gd�dt��}|�ttj|����dS)Nc��eZdZd�ZdS)�-TestCopy.test_getstate_exc.<locals>.EvilStatec� �td���)Nzain't got no stickin' state)�
ValueErrorrs rrz:TestCopy.test_getstate_exc.<locals>.EvilState.__getstate__s�� �!>�?�?�?rN)r0r1r2rrCrr�	EvilStater*s(������
@�
@�
@�
@�
@rr-)r4rIr,r)rr-s  r�test_getstate_exczTestCopy.test_getstate_excs\��	@�	@�	@�	@�	@��	@�	@�	@�	
���*�d�i�����=�=�=�=�=rc��|�tjt��t��d�}|�tj|��|��d�}|�tj|��|��dS)Nc��||zSr
rC�rr s  rr'z(TestCopy.test_copy_function.<locals>.foo�
��a��c�zrc��dSr
rCrCrr�<lambda>z-TestCopy.test_copy_function.<locals>.<lambda>���d�r)rr�
global_foo�rr'r�s   r�test_copy_functionzTestCopy.test_copy_functionst�������:�.�.�
�;�;�;�!�!�!������3����-�-�-��l�������3����-�-�-�-�-rc��|�tjt��t��d�}|�tj|��|��d�}|�tj|��|��dS)Nc��||zSr
rCr1s  rr'z,TestCopy.test_deepcopy_function.<locals>.foo!r2rc��dSr
rCrCrrr4z1TestCopy.test_deepcopy_function.<locals>.<lambda>#r5r)rrr#r6r7s   r�test_deepcopy_functionzTestCopy.test_deepcopy_functionsx�������z�2�2�J�?�?�?�!�!�!������s�+�+�S�1�1�1��l�������s�+�+�S�1�1�1�1�1rc���Gd�dt��}|��}tj|��}||��}|�||��~||��}|�||��dS)Nc��eZdZdS)�"TestCopy._check_weakref.<locals>.CNr�rCrrr-r?'r�rr-)r4�weakref�refr)r�_copyr-r@rr s      r�_check_weakrefzTestCopy._check_weakref&s���	�	�	�	�	��	�	�	��a�c�c���K������E�!�H�H���
�
�a�������E�!�H�H���
�
�a������rc�D�|�tj��dSr
)rCrrs r�test_copy_weakrefzTestCopy.test_copy_weakref1s�����D�I�&�&�&�&�&rc�D�|�tj��dSr
)rCrr#rs r�test_deepcopy_weakrefzTestCopy.test_deepcopy_weakref4s�����D�M�*�*�*�*�*rc��
�Gd�dt���
�
fd�td��D��\}}}}|��}|||<|||<tj|��}|�||��|�||��|�|||��|�|||��|�t|��d��~~t
j��|�t|��d���
���
��}	}|	||<|�||��dS)Nc��eZdZdS)�(TestCopy._check_copy_weakdict.<locals>.CNr�rCrrr-rJ8r�rr-c�$��g|]}�����
SrCrC��.0�ir-s  �r�
<listcomp>z1TestCopy._check_copy_weakdict.<locals>.<listcomp>:s���,�,�,�a�a�a�c�c�,�,�,rryr�rV)	r4r�rrMrr^r	�
gc_collect�assertNotIn)r�	_dicttype�a�br\r�u�vrr r-s          @r�_check_copy_weakdictzTestCopy._check_copy_weakdict7sd���	�	�	�	�	��	�	�	�,�,�,�,�5��8�8�,�,�,�
��1�a���I�K�K����!����!���I�a�L�L������A��������A��������1��q�!�!�!�����1��q�!�!�!�����Q����#�#�#�
�q����������Q����#�#�#��q�s�s�A�A�C�C�1����!������A�����rc�D�|�tj��dSr
)rWr@�WeakKeyDictionaryrs r�test_copy_weakkeydictzTestCopy.test_copy_weakkeydictLs���!�!�'�";�<�<�<�<�<rc�D�|�tj��dSr
)rWr@�WeakValueDictionaryrs r�test_copy_weakvaluedictz TestCopy.test_copy_weakvaluedictOs���!�!�'�"=�>�>�>�>�>rc���Gd�dt����fd�td��D��\}}}}tj��}|||<|||<t	j|��}|�||��|�t|��d��|�	|||��|�	|||��|�||j
|j
��|�||j
|j
��~tj��|�t|��d��dS)Nc��eZdZd�ZdS)�-TestCopy.test_deepcopy_weakkeydict.<locals>.Cc��||_dSr
�rN�rrNs  rr)z6TestCopy.test_deepcopy_weakkeydict.<locals>.C.__init__T�
������rN�r0r1r2r)rCrrr-r`S�#������
�
�
�
�
rr-c�&��g|]
}�|����SrCrCrLs  �rrOz6TestCopy.test_deepcopy_weakkeydict.<locals>.<listcomp>V�!���-�-�-�q�a�a��d�d�-�-�-rryr�rV)
r4r�r@rYrr#rrr^rMrNr	rP)rrSrTr\rrUrVr-s       @r�test_deepcopy_weakkeydictz"TestCopy.test_deepcopy_weakkeydictRs[���	�	�	�	�	��	�	�	�.�-�-�-�E�!�H�H�-�-�-�
��1�a���%�'�'����!����!���M�!�������A�q�!�!�!�����Q����#�#�#�����1��q�!�!�!�����1��q�!�!�!�����1�����%�%�%�����1�����%�%�%�
����������Q����#�#�#�#�#rc�B��Gd�dt����fd�td��D��\}}}}tj��}|||<|||<t	j|��}|�||��|�t|��d��t|�
��d����\\}}\}	}
|�||��|�|j|j��|�
||��|�|	|��|�|	j|j��|�
|
|��~~~	~
~tj��|�t|��d��dS)	Nc��eZdZd�ZdS)�/TestCopy.test_deepcopy_weakvaluedict.<locals>.Cc��||_dSr
rbrcs  rr)z8TestCopy.test_deepcopy_weakvaluedict.<locals>.C.__init__hrdrNrerCrrr-rlgrfrr-c�&��g|]
}�|����SrCrCrLs  �rrOz8TestCopy.test_deepcopy_weakvaluedict.<locals>.<listcomp>jrhrryr�c��|djSrlrb)�pairs rr4z6TestCopy.test_deepcopy_weakvaluedict.<locals>.<lambda>rs��D��G�I�r)rrV)r4r�r@r\rr#rrr^�sortedr�rMrNrr	rP)rrSrTr\rrUrVrr �z�tr-s           @r�test_deepcopy_weakvaluedictz$TestCopy.test_deepcopy_weakvaluedictfs����	�	�	�	�	��	�	�	�.�-�-�-�E�!�H�H�-�-�-�
��1�a���'�)�)����!����!���M�!�������A�q�!�!�!�����Q����#�#�#�����	�	�/E�/E�F�F�F����A���A�����A���������a�c�"�"�"��
�
�a���������A���������a�c�"�"�"��
�
�a�����
�q�!�Q�
����������Q����#�#�#�#�#rc�(�Gd�dt��}|��}|j|_tj|��}|�|j|j��|�|jj|��|���dS)Nc��eZdZd�ZdS)�0TestCopy.test_deepcopy_bound_method.<locals>.Fooc��dSr
rCrs r�mz2TestCopy.test_deepcopy_bound_method.<locals>.Foo.m�s���rN)r0r1r2ryrCrr�Foorws#������
�
�
�
�
rrz)r4ryrTrr#rr�__self__)rrzr��gs    r�test_deepcopy_bound_methodz#TestCopy.test_deepcopy_bound_method~s���	�	�	�	�	�&�	�	�	�
�C�E�E���c����M�!���������a�c�"�"�"��
�
�a�c�l�A�&�&�&�	�������rN)Qr0r1r2rr!r7rPrjrrr�r�r�r�r�r�r�r�r�r�r�r�r�rrr!r$r'r.r7r=rDrIrNrUrYrarergrjrmrorsrwrzr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrr#r'r.r8r<rCrErGrWrZr]rirtr}rCrrrrs�������;�;�;����
	'�	'�	'�'�'�'� !�!�!�	!�	!�	!�4�4�4�+�+�+�"���'�'�'�������'�'�'����*�*�*�	*�	*�	*�	*�	*�	*�'�'�'�"'�'�'�"	*�	*�	*�	*�	*�	*�*�*�*�$���
	"�	"�	"�	.�	.�	.�	'�	'�	'�'�'�'� !�!�!�	!�	!�	!�8�8�8�/�/�/�%�%�%�$�$�$����
%�%�%����
"�"�"�-�-�-�
$�
$�
$�,�,�,�
'�
'�
'�	'�	'�	'�'�'�'�'�'�'�'�'�'�$'�'�'�$'�'�'�'�'�'�'�'�'�, � � ����	0�	0�	0�'�'�'�'�'�'�  � � �%�%�%�"-�-�-�"
�
�
����$�$�$�'�'�'�.�.�.�(	$�	$�	$�	'�	'�	'�.�.�.�%�%�%�>�>�>�.�.�.�2�2�2�	�	�	�'�'�'�+�+�+����*=�=�=�?�?�?�$�$�$�($�$�$�0	�	�	�	�	rrc��||zSr
rCr1s  rr6r6�s
��Q�q�S�jr�__main__)�__doc__rrKr@r��operatorrrrrrr�unittest�testr	rqrrr\�TestCaserr6r0�mainrCrr�<module>r�s��%�%�������������
�
�
�
�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�+�������������B��N���2�v���"6�6��w
�w
�w
�w
�w
�x� �w
�w
�w
�t!� � ��z����H�M�O�O�O�O�O��r