Uname: Linux web3.us.cloudlogin.co 5.10.226-xeon-hst #2 SMP Fri Sep 13 12:28:44 UTC 2024 x86_64
Software: Apache
PHP version: 8.1.31 [ PHP INFO ] PHP os: Linux
Server Ip: 162.210.96.117
Your Ip: 3.21.40.24
User: edustar (269686) | Group: tty (888)
Safe Mode: OFF
Disable Function:
NONE

name : test_copy.cpython-310.pyc
o

`b�f�@s�dZddlZddlZddlZddlZddlmZmZmZm	Z	m
Z
mZddlZddl
mZeeee	fZe
efZeeZGdd�dej�Zdd�Zed	krQe��dSdS)
zUnit tests for the copy module.�N)�le�lt�ge�gt�eq�ne)�supportc@sleZdZdd�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^�Z1d_d`�Z2dadb�Z3dcdd�Z4dedf�Z5dgdh�Z6didj�Z7dkdl�Z8dmdn�Z9dodp�Z:dqdr�Z;dsdt�Z<dudv�Z=dwdx�Z>dydz�Z?d{d|�Z@d}d~�ZAdd��ZBd�d��ZCd�d��ZDd�d��ZEd�d��ZFd�d��ZGd�d��ZHd�d��ZId�d��ZJd�d��ZKd�d��ZLd�d��ZMd�d��ZNd�S)��TestCopycCs&|�tjtj�|�ttjt��dS�N)�assertIs�copy�Error�errorZ
assertTrue�
issubclass�	Exception��self�r�7/usr/local/python-3.10/lib/python3.10/test/test_copy.py�test_exceptionsszTestCopy.test_exceptionscCsd}t�|�}|�||�dS�N�*)r�assertEqual�r�x�yrrr�test_copy_basic�
zTestCopy.test_copy_basiccsJG�fdd�dt���d�}t�|�}|�|j|j�|�|j|j�dS)Ncs eZdZdd�Z�fdd�ZdS)z"TestCopy.test_copy_copy.<locals>.CcS�
||_dSr
��foo�rr rrr�__init__!�
z+TestCopy.test_copy_copy.<locals>.C.__init__c�
�|j�Sr
rr��Crr�__copy__#r#z+TestCopy.test_copy_copy.<locals>.C.__copy__N)�__name__�
__module__�__qualname__r"r'rr%rrr& sr&r)�objectrr�	__class__r rrr%r�test_copy_copy�

zTestCopy.test_copy_copycsPGdd�dt���fdd�}�d�}|�ttj|�t��|��t�|�}dS)Nc@�eZdZdd�ZdS)z&TestCopy.test_copy_registry.<locals>.CcS�t�|�}||_|Sr
�r+�__new__r ��clsr �objrrrr2,�
z.TestCopy.test_copy_registry.<locals>.C.__new__N�r(r)r*r2rrrrr&+�r&c��|jffSr
r�r5r%rr�pickle_C0�z-TestCopy.test_copy_registry.<locals>.pickle_Cr)r+�assertRaises�	TypeErrorr�copyreg�pickle�rr;rrrr%r�test_copy_registry*�zTestCopy.test_copy_registryc�FG�fdd�dt�}g�|�}t�|�}|�||�|��dg�dS)Nc� eZdZ�fdd�Zdd�ZdS)z'TestCopy.test_copy_reduce_ex.<locals>.Cc���d�dS�N����append�r�proto��crr�
__reduce_ex__9�
z5TestCopy.test_copy_reduce_ex.<locals>.C.__reduce_ex__cS�|�d�dS�Nzshouldn't call this�Zfailrrrr�
__reduce__<�z2TestCopy.test_copy_reduce_ex.<locals>.C.__reduce__N�r(r)r*rPrUrrNrrr&8�r&rH�r+rrr�rr&rrrrNr�test_copy_reduce_ex7�
zTestCopy.test_copy_reduce_excrD)Nc�eZdZ�fdd�ZdS)z$TestCopy.test_copy_reduce.<locals>.CcrFrGrJrrNrrrUFrQz/TestCopy.test_copy_reduce.<locals>.C.__reduce__N�r(r)r*rUrrNrrr&E�r&rHrYrZrrNr�test_copy_reduceD�
zTestCopy.test_copy_reducecCs,Gdd�dt�}|�}|�tjtj|�dS)Nc@r/)z"TestCopy.test_copy_cant.<locals>.CcS�|�d�r	t|��t�||�S�NZ__reduce��
startswith�AttributeErrorr+�__getattribute__�r�namerrrrgQ�
z3TestCopy.test_copy_cant.<locals>.C.__getattribute__N�r(r)r*rgrrrrr&Pr8r&)r+r=rr
�rr&rrrr�test_copy_cantO�zTestCopy.test_copy_cantcCs�Gdd�d�}Gdd�dt�}dd�}Gdd�dtjd	�}dd
tddd
dddddd|jdttd��td�tddd�||t|t	�g}|D]}|�
t�|�|�qDdS)Nc@�eZdZdS)z*TestCopy.test_copy_atomic.<locals>.ClassicN�r(r)r*rrrr�Classic[�rqc@ro)z+TestCopy.test_copy_atomic.<locals>.NewStyleNrprrrr�NewStyle]rrrscS�dSr
rrrrr�f_�z$TestCopy.test_copy_atomic.<locals>.fc@ro)z0TestCopy.test_copy_atomic.<locals>.WithMetaclassNrprrrr�
WithMetaclassarrrw��	metaclass.r��d���Q�	@TF��?�hello�helloሴsworld��
rH)r+�abc�ABCMeta�NotImplemented�__code__�bytes�range�slice�max�propertyrr)rrqrsrurw�testsrrrr�test_copy_atomicZs��zTestCopy.test_copy_atomiccCsTgd�}t�|�}|�||�|�||�g}t�|�}|�||�|�||�dS)N�rHrz��rr�assertIsNotrrrr�test_copy_listks

zTestCopy.test_copy_listcCsNd}|�t�|�|�d}|�t�|�|�dddgf}|�t�|�|�dS)Nr�rrHrzr�)rr�rrrrr�test_copy_tupleuszTestCopy.test_copy_tuplecCsVddd�}t�|�}|�||�|�||�i}t�|�}|�||�|�||�dS)NrHrz�r �barr�rrrr�test_copy_dict}s


zTestCopy.test_copy_dictcCsVhd�}t�|�}|�||�|�||�t�}t�|�}|�||�|�||�dS�N>rHrzr�)rrr��setrrrr�
test_copy_set��

zTestCopy.test_copy_setcCs:thd��}|�t�|�|�t�}|�t�|�|�dSr�)�	frozensetrrr�rrr�test_copy_frozenset�szTestCopy.test_copy_frozensetcCsVtd�}t�|�}|�||�|�||�t�}t�|�}|�||�|�||�dS)Nsabc)�	bytearrayrrr�rrrr�test_copy_bytearray�r�zTestCopy.test_copy_bytearraycC�,Gdd�d�}|d�}|�t�|�|�dS)Nc@�eZdZdd�Zdd�ZdS)z*TestCopy.test_copy_inst_vanilla.<locals>.CcSrr
rr!rrrr"�r#z3TestCopy.test_copy_inst_vanilla.<locals>.C.__init__cS�|j|jkSr
r�r�otherrrr�__eq__�r<z1TestCopy.test_copy_inst_vanilla.<locals>.C.__eq__N�r(r)r*r"r�rrrrr&��r&r�rrrlrrr�test_copy_inst_vanilla�szTestCopy.test_copy_inst_vanillacs0G�fdd�d���d�}|�t�|�|�dS)Nc�(eZdZdd�Z�fdd�Zdd�ZdS)z'TestCopy.test_copy_inst_copy.<locals>.CcSrr
rr!rrrr"�r#z0TestCopy.test_copy_inst_copy.<locals>.C.__init__cr$r
rrr%rrr'�r#z0TestCopy.test_copy_inst_copy.<locals>.C.__copy__cSr�r
rr�rrrr��r<z.TestCopy.test_copy_inst_copy.<locals>.C.__eq__N)r(r)r*r"r'r�rr%rrr&��r&rr�r�rr%r�test_copy_inst_copy�szTestCopy.test_copy_inst_copycCr�)Nc@�$eZdZdd�Zdd�Zdd�ZdS)z.TestCopy.test_copy_inst_getinitargs.<locals>.CcSrr
rr!rrrr"�r#z7TestCopy.test_copy_inst_getinitargs.<locals>.C.__init__cS�|jfSr
rrrrr�__getinitargs__��z>TestCopy.test_copy_inst_getinitargs.<locals>.C.__getinitargs__cSr�r
rr�rrrr��r<z5TestCopy.test_copy_inst_getinitargs.<locals>.C.__eq__N�r(r)r*r"r�r�rrrrr&��r&rr�rlrrr�test_copy_inst_getinitargs��z#TestCopy.test_copy_inst_getinitargscCsZGdd�dt�}|d�}t�|�}|�||�|�||�|�||�|�|j|j�dS)Nc@r�)z-TestCopy.test_copy_inst_getnewargs.<locals>.CcSr0r
��intr2r �r4r rrrrr2�r6z5TestCopy.test_copy_inst_getnewargs.<locals>.C.__new__cSr�r
rrrrr�__getnewargs__�r�z<TestCopy.test_copy_inst_getnewargs.<locals>.C.__getnewargs__cSr�r
rr�rrrr��r<z4TestCopy.test_copy_inst_getnewargs.<locals>.C.__eq__N�r(r)r*r2r�r�rrrrr&��r&r�r�r�assertIsInstancerr�r rZrrr�test_copy_inst_getnewargs�s	
z"TestCopy.test_copy_inst_getnewargscCs\Gdd�dt�}|dd�}t�|�}|�||�|�||�|�||�|�|j|j�dS)Nc@r�)z0TestCopy.test_copy_inst_getnewargs_ex.<locals>.CcSr0r
r�r�rrrr2�r6z8TestCopy.test_copy_inst_getnewargs_ex.<locals>.C.__new__cS�dd|jifS�Nrr rrrrr�__getnewargs_ex__�rVzBTestCopy.test_copy_inst_getnewargs_ex.<locals>.C.__getnewargs_ex__cSr�r
rr�rrrr��r<z7TestCopy.test_copy_inst_getnewargs_ex.<locals>.C.__eq__N�r(r)r*r2r�r�rrrrr&�r�r&rrr�rZrrr�test_copy_inst_getnewargs_ex�s
	
z%TestCopy.test_copy_inst_getnewargs_excCr�)Nc@r�)z+TestCopy.test_copy_inst_getstate.<locals>.CcSrr
rr!rrrr"�r#z4TestCopy.test_copy_inst_getstate.<locals>.C.__init__cS�
d|jiS�Nr rrrrr�__getstate__�r#z8TestCopy.test_copy_inst_getstate.<locals>.C.__getstate__cSr�r
rr�rrrr��r<z2TestCopy.test_copy_inst_getstate.<locals>.C.__eq__N�r(r)r*r"r�r�rrrrr&�r�r&rr�rlrrr�test_copy_inst_getstate�r�z TestCopy.test_copy_inst_getstatecCr�)Nc@r�)z+TestCopy.test_copy_inst_setstate.<locals>.CcSrr
rr!rrrr"�r#z4TestCopy.test_copy_inst_setstate.<locals>.C.__init__cS�|d|_dSr�r�r�staterrr�__setstate__�rVz8TestCopy.test_copy_inst_setstate.<locals>.C.__setstate__cSr�r
rr�rrrr��r<z2TestCopy.test_copy_inst_setstate.<locals>.C.__eq__N�r(r)r*r"r�r�rrrrr&�r�r&rr�rlrrr�test_copy_inst_setstate�r�z TestCopy.test_copy_inst_setstatecCsFGdd�d�}|d�}|�t�|�|�|d�}|�t�|�|�dS)Nc@�,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
z4TestCopy.test_copy_inst_getstate_setstate.<locals>.CcSrr
rr!rrrr"�r#z=TestCopy.test_copy_inst_getstate_setstate.<locals>.C.__init__cS�|jSr
rrrrrr���zATestCopy.test_copy_inst_getstate_setstate.<locals>.C.__getstate__cSrr
rr�rrrr��r#zATestCopy.test_copy_inst_getstate_setstate.<locals>.C.__setstate__cSr�r
rr�rrrr�r<z;TestCopy.test_copy_inst_getstate_setstate.<locals>.C.__eq__N�r(r)r*r"r�r�r�rrrrr&��
r&rgr�rlrrr� test_copy_inst_getstate_setstate�s
	z)TestCopy.test_copy_inst_getstate_setstatecCsd}t�|�}|�||�dSr)r�deepcopyrrrrr�test_deepcopy_basic
rzTestCopy.test_deepcopy_basiccCsZg}||g}t�|�}|�||�|�||�|�|d|d�|�|d|d�dS�NrrH)rr�rr�rrrrr�test_deepcopy_memos
zTestCopy.test_deepcopy_memocCs8Gdd�dt�}Gdd�d|d�}|�t�|�|�dS)Nc@ro)z/TestCopy.test_deepcopy_issubclass.<locals>.MetaNrprrrr�Metarrr�c@ro)z,TestCopy.test_deepcopy_issubclass.<locals>.CNrprrrrr&!rrr&rx)�typerrr�)rr�r&rrr�test_deepcopy_issubclasssz!TestCopy.test_deepcopy_issubclasscsJG�fdd�dt���d�}t�|�}|�|j|j�|�|j|j�dS)Ncs"eZdZdd�Zd�fdd�	ZdS)z*TestCopy.test_deepcopy_deepcopy.<locals>.CcSrr
rr!rrrr"'r#z3TestCopy.test_deepcopy_deepcopy.<locals>.C.__init__Ncr$r
r�r�memor%rr�__deepcopy__)r#z7TestCopy.test_deepcopy_deepcopy.<locals>.C.__deepcopy__r
)r(r)r*r"r�rr%rrr&&sr&r)r+rr�rr,r rrr%r�test_deepcopy_deepcopy%r.zTestCopy.test_deepcopy_deepcopycsPGdd�dt���fdd�}�d�}|�ttj|�t��|��t�|�}dS)Nc@r/)z*TestCopy.test_deepcopy_registry.<locals>.CcSr0r
r1r3rrrr22r6z2TestCopy.test_deepcopy_registry.<locals>.C.__new__Nr7rrrrr&1r8r&cr9r
rr:r%rrr;6r<z1TestCopy.test_deepcopy_registry.<locals>.pickle_Cr)r+r=r>rr�r?r@rArr%r�test_deepcopy_registry0rCzTestCopy.test_deepcopy_registryc�FG�fdd�dt�}g�|�}t�|�}|�||�|��dg�dS)NcrE)z+TestCopy.test_deepcopy_reduce_ex.<locals>.CcrFrGrJrLrNrrrP?rQz9TestCopy.test_deepcopy_reduce_ex.<locals>.C.__reduce_ex__cSrRrSrTrrrrrUBrVz6TestCopy.test_deepcopy_reduce_ex.<locals>.C.__reduce__NrWrrNrrr&>rXr&rH�r+rr�rrrZrrNr�test_deepcopy_reduce_ex=r\z TestCopy.test_deepcopy_reduce_excr�)Ncr])z(TestCopy.test_deepcopy_reduce.<locals>.CcrFrGrJrrNrrrULrQz3TestCopy.test_deepcopy_reduce.<locals>.C.__reduce__Nr^rrNrrr&Kr_r&rHr�rZrrNr�test_deepcopy_reduceJrazTestCopy.test_deepcopy_reducecCs,Gdd�dt�}|�}|�tjtj|�dS)Nc@r/)z&TestCopy.test_deepcopy_cant.<locals>.CcSrbrcrdrhrrrrgWrjz7TestCopy.test_deepcopy_cant.<locals>.C.__getattribute__Nrkrrrrr&Vr8r&)r+r=rr
r�rlrrr�test_deepcopy_cantUrnzTestCopy.test_deepcopy_cantcCstGdd�d�}Gdd�dt�}dd�}dddd	d
ddd
dd|j|td�|tt�g}|D]}|�t�|�|�q,dS)Nc@ro)z.TestCopy.test_deepcopy_atomic.<locals>.ClassicNrprrrrrqarrrqc@ro)z/TestCopy.test_deepcopy_atomic.<locals>.NewStyleNrprrrrrscrrrscSrtr
rrrrrruervz(TestCopy.test_deepcopy_atomic.<locals>.frrzr{r|TFr}r~rr�)r+r�r�r�r�rrr�)rrqrsrur�rrrr�test_deepcopy_atomic`s��zTestCopy.test_deepcopy_atomiccCsFddgdg}t�|�}|�||�|�||�|�|d|d�dS�NrHrzr�r�rr�rr�rrrr�test_deepcopy_listm�

zTestCopy.test_deepcopy_listcCsbg}|�|�t�|�}tD]
}|�t|||�q|�||�|�|d|�|�t	|�d�dSr�)
rKrr��comparisonsr=�RecursionErrorr�rr�len�rrr�oprrr�test_deepcopy_reflexive_listts

z%TestCopy.test_deepcopy_reflexive_listcC�d}t�|�}|�||�dS�Nr�rr�rrrrr�test_deepcopy_empty_tuple~rz"TestCopy.test_deepcopy_empty_tuplecCsFddgdf}t�|�}|�||�|�||�|�|d|d�dSr�r�rrrr�test_deepcopy_tuple�r�zTestCopy.test_deepcopy_tuplecCr�)N)�rHrzr�r�rrrr�!test_deepcopy_tuple_of_immutables�rz*TestCopy.test_deepcopy_tuple_of_immutablescCspgf}|d�|�t�|�}tD]
}|�t|||�q|�||�|�|d|d�|�|dd|�dS�Nr)rKrr�r�r=r�r�rr�rrr�test_deepcopy_reflexive_tuple�s
z&TestCopy.test_deepcopy_reflexive_tuplecCsHddgdd�}t�|�}|�||�|�||�|�|d|d�dS)NrHrzr�r�r r�rrrr�test_deepcopy_dict�s

zTestCopy.test_deepcopy_dictcCszi}||d<t�|�}tD]
}|�t|||�q
tD]
}|�t|||�q|�||�|�|d|�|�	t
|�d�dS)Nr rH)rr��order_comparisonsr=r>�equality_comparisonsr�r�rrr�r�rrr�test_deepcopy_reflexive_dict�s
z%TestCopy.test_deepcopy_reflexive_dictcCs0i}g}t�||�}|�|t|�d|�dSr�)rr�r�id�rr�rrrrr�test_deepcopy_keepalive�sz TestCopy.test_deepcopy_keepalivecCsji}gd�}t�||�}|�||�|�t|�d�i}dg}t�||�}|�||�|�t|�d�dS)N)rHrzr��rzr�)rr�rr�r�rrr�!test_deepcopy_dont_memo_immutable�sz*TestCopy.test_deepcopy_dont_memo_immutablecCsBGdd�d�}|dg�}t�|�}|�||�|�|j|j�dS)Nc@r�)z.TestCopy.test_deepcopy_inst_vanilla.<locals>.CcSrr
rr!rrrr"�r#z7TestCopy.test_deepcopy_inst_vanilla.<locals>.C.__init__cSr�r
rr�rrrr��r<z5TestCopy.test_deepcopy_inst_vanilla.<locals>.C.__eq__Nr�rrrrr&�r�r&r�rr�rr�r rZrrr�test_deepcopy_inst_vanilla�s


z#TestCopy.test_deepcopy_inst_vanillacsRG�fdd�d���dg�}t�|�}|�||�|�||�|�|j|j�dS)Ncr�)z/TestCopy.test_deepcopy_inst_deepcopy.<locals>.CcSrr
rr!rrrr"�r#z8TestCopy.test_deepcopy_inst_deepcopy.<locals>.C.__init__cs�t�|j|��Sr
)rr�r r�r%rrr���z<TestCopy.test_deepcopy_inst_deepcopy.<locals>.C.__deepcopy__cSr�r
rr�rrrr��r<z6TestCopy.test_deepcopy_inst_deepcopy.<locals>.C.__eq__N)r(r)r*r"r�r�rr%rrr&�r�r&rrrrr%r�test_deepcopy_inst_deepcopy�s

z$TestCopy.test_deepcopy_inst_deepcopycC�NGdd�d�}|dg�}t�|�}|�||�|�||�|�|j|j�dS)Nc@r�)z2TestCopy.test_deepcopy_inst_getinitargs.<locals>.CcSrr
rr!rrrr"�r#z;TestCopy.test_deepcopy_inst_getinitargs.<locals>.C.__init__cSr�r
rrrrrr��r�zBTestCopy.test_deepcopy_inst_getinitargs.<locals>.C.__getinitargs__cSr�r
rr�rrrr��r<z9TestCopy.test_deepcopy_inst_getinitargs.<locals>.C.__eq__Nr�rrrrr&�r�r&rrrZrrr�test_deepcopy_inst_getinitargs��

z'TestCopy.test_deepcopy_inst_getinitargscCslGdd�dt�}|dg�}t�|�}|�||�|�||�|�||�|�|j|j�|�|j|j�dS)Nc@r�)z1TestCopy.test_deepcopy_inst_getnewargs.<locals>.CcSr0r
r�r�rrrr2�r6z9TestCopy.test_deepcopy_inst_getnewargs.<locals>.C.__new__cSr�r
rrrrrr��r�z@TestCopy.test_deepcopy_inst_getnewargs.<locals>.C.__getnewargs__cSr�r
rr�rrrr��r<z8TestCopy.test_deepcopy_inst_getnewargs.<locals>.C.__eq__Nr�rrrrr&�r�r&r�r�rr�r�rr�r rZrrr�test_deepcopy_inst_getnewargs�s
	
z&TestCopy.test_deepcopy_inst_getnewargscCsnGdd�dt�}|dgd�}t�|�}|�||�|�||�|�||�|�|j|j�|�|j|j�dS)Nc@r�)z4TestCopy.test_deepcopy_inst_getnewargs_ex.<locals>.CcSr0r
r�r�rrrr2�r6z<TestCopy.test_deepcopy_inst_getnewargs_ex.<locals>.C.__new__cSr�r�rrrrrr�rVzFTestCopy.test_deepcopy_inst_getnewargs_ex.<locals>.C.__getnewargs_ex__cSr�r
rr�rrrr�r<z;TestCopy.test_deepcopy_inst_getnewargs_ex.<locals>.C.__eq__Nr�rrrrr&�r�r&rrrrZrrr� test_deepcopy_inst_getnewargs_ex�s	
z)TestCopy.test_deepcopy_inst_getnewargs_excCr)Nc@r�)z/TestCopy.test_deepcopy_inst_getstate.<locals>.CcSrr
rr!rrrr"r#z8TestCopy.test_deepcopy_inst_getstate.<locals>.C.__init__cSr�r�rrrrrr�r#z<TestCopy.test_deepcopy_inst_getstate.<locals>.C.__getstate__cSr�r
rr�rrrr�r<z6TestCopy.test_deepcopy_inst_getstate.<locals>.C.__eq__Nr�rrrrr&
r�r&rrrZrrr�test_deepcopy_inst_getstaterz$TestCopy.test_deepcopy_inst_getstatecCr)Nc@r�)z/TestCopy.test_deepcopy_inst_setstate.<locals>.CcSrr
rr!rrrr"r#z8TestCopy.test_deepcopy_inst_setstate.<locals>.C.__init__cSr�r�rr�rrrr�rVz<TestCopy.test_deepcopy_inst_setstate.<locals>.C.__setstate__cSr�r
rr�rrrr� r<z6TestCopy.test_deepcopy_inst_setstate.<locals>.C.__eq__Nr�rrrrr&r�r&rrrZrrr�test_deepcopy_inst_setstaterz$TestCopy.test_deepcopy_inst_setstatecCs�Gdd�d�}|dg�}t�|�}|�||�|�||�|�|j|j�|g�}t�|�}|�||�|�||�|�|j|j�dS)Nc@r�)
z8TestCopy.test_deepcopy_inst_getstate_setstate.<locals>.CcSrr
rr!rrrr"*r#zATestCopy.test_deepcopy_inst_getstate_setstate.<locals>.C.__init__cSr�r
rrrrrr�,r�zETestCopy.test_deepcopy_inst_getstate_setstate.<locals>.C.__getstate__cSrr
rr�rrrr�.r#zETestCopy.test_deepcopy_inst_getstate_setstate.<locals>.C.__setstate__cSr�r
rr�rrrr�0r<z?TestCopy.test_deepcopy_inst_getstate_setstate.<locals>.C.__eq__Nr�rrrrr&)r�r&rrrZrrr�$test_deepcopy_inst_getstate_setstate(s
	

z-TestCopy.test_deepcopy_inst_getstate_setstatecCsBGdd�d�}|�}||_t�|�}|�||�|�|j|�dS)Nc@ro)z0TestCopy.test_deepcopy_reflexive_inst.<locals>.CNrprrrrr&?rrr&)r rr�r�rrZrrr�test_deepcopy_reflexive_inst>s
z%TestCopy.test_deepcopy_reflexive_instcCsFGdd�dt�}|�}t�|�}|�||�t�|�}|�||�dS)Nc@r/)z+TestCopy.test_reconstruct_string.<locals>.CcSsdS)NrIrrrrrrUKrvz6TestCopy.test_reconstruct_string.<locals>.C.__reduce__Nr^rrrrr&Jr8r&)r+rrr�rZrrr�test_reconstruct_stringIs

z TestCopy.test_reconstruct_stringcsXG�fdd�dt����}d|_t�|�}|�|j|j�t�|�}|�|j|j�dS)Ncr])z,TestCopy.test_reconstruct_nostate.<locals>.Ccs�dfSr�rrr%rrrUUr�z7TestCopy.test_reconstruct_nostate.<locals>.C.__reduce__Nr^rr%rrr&Tr_r&r)r+r rrr,r�rrr%r�test_reconstruct_nostateSs

z!TestCopy.test_reconstruct_nostatec�bG�fdd�dt����}dg|_t�|�}|�||�t�|�}|�||�|�|j|j�dS)NcrE)z*TestCopy.test_reconstruct_state.<locals>.Cc��d|jfSr���__dict__rr%rrrU`r<z5TestCopy.test_reconstruct_state.<locals>.C.__reduce__cSr�r
rr�rrrr�br<z1TestCopy.test_reconstruct_state.<locals>.C.__eq__N�r(r)r*rUr�rr%rrr&_�r&r�r+r rrr�r�rrr%r�test_reconstruct_state^s

zTestCopy.test_reconstruct_statecr)Ncs(eZdZ�fdd�Zdd�Zdd�ZdS)z3TestCopy.test_reconstruct_state_setstate.<locals>.Ccrr�rrr%rrrUnr<z>TestCopy.test_reconstruct_state_setstate.<locals>.C.__reduce__cSs|j�|�dSr
)r�updater�rrrr�p�z@TestCopy.test_reconstruct_state_setstate.<locals>.C.__setstate__cSr�r
rr�rrrr�rr<z:TestCopy.test_reconstruct_state_setstate.<locals>.C.__eq__N)r(r)r*rUr�r�rr%rrr&msr&rrrrr%r�test_reconstruct_state_setstatels

z(TestCopy.test_reconstruct_state_setstatecCsDGdd�dt�}|�}||_t�|�}|�||�|�|j|�dS)Nc@ro)z.TestCopy.test_reconstruct_reflexive.<locals>.CNrprrrrr&}rrr&)r+r rr�r�rrZrrr�test_reconstruct_reflexive|s
z#TestCopy.test_reconstruct_reflexivecs�G�fdd�dt���ddgdg�}t�|�}|�||�|�||�|�|d|d�t�|�}|�||�|�||�|�|d|d�dS)NcrE)z&TestCopy.test_reduce_4tuple.<locals>.Ccs�d|jt|�fSr�)r�iterrr%rrrU�rz1TestCopy.test_reduce_4tuple.<locals>.C.__reduce__cS�t|�t|�ko
|j|jkSr
)�listrr�rrrr���
�z-TestCopy.test_reduce_4tuple.<locals>.C.__eq__Nrrr%rrr&�rr&rHrzr�r)rrrr�rr�rrr%r�test_reduce_4tuple�s

zTestCopy.test_reduce_4tuplecs�G�fdd�dt���dddgfdg�}t�|�}|�||�|�||�|�|d|d�t�|�}|�||�|�||�|�|d|d�dS)NcrE)z&TestCopy.test_reduce_5tuple.<locals>.Ccs�d|jd|��fSr�)r�itemsrr%rrrU�sz1TestCopy.test_reduce_5tuple.<locals>.C.__reduce__cSrr
)�dictrr�rrrr��r z-TestCopy.test_reduce_5tuple.<locals>.C.__eq__Nrrr%rrr&�rr&r rHrz)r�r�)r#rrr�rr�rrr%r�test_reduce_5tuple�s

zTestCopy.test_reduce_5tuplecCs<Gdd�dt�}|�}dg|_t�|�}|�|j|j�dS)Nc@�eZdZdgZdS)z#TestCopy.test_copy_slots.<locals>.Cr N�r(r)r*�	__slots__rrrrr&��
r&r)r+r rrrZrrr�test_copy_slots�s

zTestCopy.test_copy_slotscCsLGdd�dt�}|�}dg|_t�|�}|�|j|j�|�|j|j�dS)Nc@r%)z'TestCopy.test_deepcopy_slots.<locals>.Cr Nr&rrrrr&�r(r&r)r+r rr�rr�rZrrr�test_deepcopy_slots�s
zTestCopy.test_deepcopy_slotscCsxGdd�dt�}|ddid�}t�|�}|�||�|�|j|j�|�||�d|d<|�||�|�|j|j�dS)Ncs*eZdZd�fdd�	Z�fdd�Z�ZS)z/TestCopy.test_deepcopy_dict_subclass.<locals>.CNcs&|si}t|���|_t��|�dSr
)r�keys�_keys�superr")r�d�r,rrr"�sz8TestCopy.test_deepcopy_dict_subclass.<locals>.C.__init__cs,t��||�||jvr|j�|�dSdSr
)r-�__setitem__r,rK)r�key�itemr/rrr0�s
�z;TestCopy.test_deepcopy_dict_subclass.<locals>.C.__setitem__r
)r(r)r*r"r0�
__classcell__rrr/rr&�sr&r r)r.rHr�)r#rr�rr,r��assertNotEqualrZrrr�test_deepcopy_dict_subclass�s

z$TestCopy.test_deepcopy_dict_subclasscCs�Gdd�dt�}|ddgdg�}ddg|_t�|�}|�t|�t|��|�|j|j�|�|d|d�|�|j|j�dS)	Nc@ro)z+TestCopy.test_copy_list_subclass.<locals>.CNrprrrrr&�rrr&rHrzr�r��r)rr rrrrZrrr�test_copy_list_subclass��

z TestCopy.test_copy_list_subclasscCs�Gdd�dt�}|ddgdg�}ddg|_t�|�}|�t|�t|��|�|j|j�|�|d|d�|�|j|j�dS)	Nc@ro)z/TestCopy.test_deepcopy_list_subclass.<locals>.CNrprrrrr&�rrr&rHrzr�r�r6r)rr rr�rr�rZrrr�test_deepcopy_list_subclass�r8z$TestCopy.test_deepcopy_list_subclasscCsJGdd�dt�}|gd��}|�t|�d�t�|�}|�t|�d�dS)Nc@ro)z,TestCopy.test_copy_tuple_subclass.<locals>.CNrprrrrr&�rrr&r�)�tuplerrrZrrr�test_copy_tuple_subclass�s

z!TestCopy.test_copy_tuple_subclasscCs~Gdd�dt�}|ddgdg�}|�t|�ddgdf�t�|�}|�t|�ddgdf�|�||�|�|d|d�dS)Nc@ro)z0TestCopy.test_deepcopy_tuple_subclass.<locals>.CNrprrrrr&�rrr&rHrzr�r)r:rrr�r�rZrrr�test_deepcopy_tuple_subclass�s
z%TestCopy.test_deepcopy_tuple_subclasscCs&Gdd�dt�}|�ttj|��dS)Nc@r/)z-TestCopy.test_getstate_exc.<locals>.EvilStatecSstd��)Nzain't got no stickin' state)�
ValueErrorrrrrr��r�z:TestCopy.test_getstate_exc.<locals>.EvilState.__getstate__N)r(r)r*r�rrrr�	EvilState�r8r>)r+r=r=r)rr>rrr�test_getstate_exc�szTestCopy.test_getstate_exccCsJ|�t�t�t�dd�}|�t�|�|�dd�}|�t�|�|�dS)NcS�||Sr
r�rrrrrr ��z(TestCopy.test_copy_function.<locals>.foocSrtr
rrrrr�<lambda>�z-TestCopy.test_copy_function.<locals>.<lambda>)rr�
global_foo�rr r�rrr�test_copy_function��
zTestCopy.test_copy_functioncCsJ|�t�t�t�dd�}|�t�|�|�dd�}|�t�|�|�dS)NcSr@r
rrArrrr rBz,TestCopy.test_deepcopy_function.<locals>.foocSrtr
rrrrrrCrDz1TestCopy.test_deepcopy_function.<locals>.<lambda>)rrr�rErFrrr�test_deepcopy_functionrHzTestCopy.test_deepcopy_functioncCsNGdd�dt�}|�}t�|�}||�}|�||�~||�}|�||�dS)Nc@ro)z"TestCopy._check_weakref.<locals>.CNrprrrrr&rrr&)r+�weakref�refr)rZ_copyr&r5rrrrr�_check_weakref
s
zTestCopy._check_weakrefcCs|�tj�dSr
)rLrrrrr�test_copy_weakrefrzTestCopy.test_copy_weakrefcC�|�tj�dSr
)rLrr�rrrr�test_deepcopy_weakrefrzTestCopy.test_deepcopy_weakrefc
s�Gdd�dt���fdd�td�D�\}}}}|�}|||<|||<t�|�}|�||�|�||�|�|||�|�|||�|�t|�d�~~t��|�t|�d�����}}	|	||<|�||�dS)Nc@ro)z(TestCopy._check_copy_weakdict.<locals>.CNrprrrrr&rrr&csg|]}���qSrr��.0�ir%rr�
<listcomp>sz1TestCopy._check_copy_weakdict.<locals>.<listcomp>r�rzrH)	r+r�rr�rr�r�
gc_collectZassertNotIn)
rZ	_dicttype�a�brOr.�u�vrrrr%r�_check_copy_weakdicts"
zTestCopy._check_copy_weakdictcCrNr
)rYrJ�WeakKeyDictionaryrrrr�test_copy_weakkeydict0rzTestCopy.test_copy_weakkeydictcCrNr
)rYrJ�WeakValueDictionaryrrrr�test_copy_weakvaluedict3rz TestCopy.test_copy_weakvaluedictcs�Gdd�dt���fdd�td�D�\}}}}t��}|||<|||<t�|�}|�||�|�t|�d�|�	|||�|�	|||�|�||j
|j
�|�||j
|j
�~t��|�t|�d�dS)Nc@r/)z-TestCopy.test_deepcopy_weakkeydict.<locals>.CcSrr
�rR�rrRrrrr"8r#z6TestCopy.test_deepcopy_weakkeydict.<locals>.C.__init__N�r(r)r*r"rrrrr&7r8r&c�g|]}�|��qSrrrPr%rrrS:�z6TestCopy.test_deepcopy_weakkeydict.<locals>.<listcomp>r�rzrH)
r+r�rJrZrr�r4rr�r�rRrrT)rrUrVrOr.rWrXrr%r�test_deepcopy_weakkeydict6s
z"TestCopy.test_deepcopy_weakkeydictcsGdd�dt���fdd�td�D�\}}}}t��}|||<|||<t�|�}|�||�|�t|�d�t	|�
�dd�d	�\\}}\}	}
|�||�|�|j|j�|�
||�|�|	|�|�|	j|j�|�
|
|�~~~	~
~t��|�t|�d
�dS)Nc@r/)z/TestCopy.test_deepcopy_weakvaluedict.<locals>.CcSrr
r^r_rrrr"Lr#z8TestCopy.test_deepcopy_weakvaluedict.<locals>.C.__init__Nr`rrrrr&Kr8r&crarrrPr%rrrSNrbz8TestCopy.test_deepcopy_weakvaluedict.<locals>.<listcomp>r�rzcSs
|djSr�r^)ZpairrrrrCVs
z6TestCopy.test_deepcopy_weakvaluedict.<locals>.<lambda>)r1rH)r+r�rJr\rr�r4rr��sortedr"r�rRrrrT)rrUrVrOr.rWrXrr�z�trr%r�test_deepcopy_weakvaluedictJs&
 z$TestCopy.test_deepcopy_weakvaluedictcCsTGdd�dt�}|�}|j|_t�|�}|�|j|j�|�|jj|�|��dS)Nc@r/)z0TestCopy.test_deepcopy_bound_method.<locals>.FoocSrtr
rrrrr�mdrvz2TestCopy.test_deepcopy_bound_method.<locals>.Foo.mN)r(r)r*rhrrrr�Foocr8ri)r+rhrVrr�rr�__self__)rriru�grrr�test_deepcopy_bound_methodbs
z#TestCopy.test_deepcopy_bound_methodN)Or(r)r*rrr-rBr[r`rmr�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�rrrrr	r
rrr
rrrrrrr!r$r)r*r5r7r9r;r<r?rGrIrLrMrOrYr[r]rcrgrlrrrrr	s�





	





	
r	cCr@r
rrArrrrEnrBrE�__main__)�__doc__rr?rJr��operatorrrrrrrZunittest�testrr�r�r�ZTestCaser	rEr(�mainrrrr�<module>s, d�
© 2025 GrazzMean