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.7/test/__pycache__/test_copy.cpython-37.pyc
B

��g@g�@s�dZddlZddlZddlZddlZddlmZmZmZm	Z	m
Z
mZddlZeeee	fZ
e
efZe
eZGdd�dej�Zdd�Zedkr�e��dS)	zUnit tests for the copy module.�N)�le�lt�ge�gt�eq�nec@steZdZdd�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�d��ZOd�S)��TestCopycCs&|�tjtj�|�ttjt��dS)N)�assertIs�copy�Error�errorZ
assertTrue�
issubclass�	Exception)�self�r�*/usr/local/lib/python3.7/test/test_copy.py�test_exceptionsszTestCopy.test_exceptionscCsd}t�|�}|�||�dS)N�*)r
�assertEqual)r�x�yrrr�test_copy_basics
zTestCopy.test_copy_basiccsJG�fdd�dt���d�}t�|�}|�|j|j�|�|j|j�dS)Ncs eZdZdd�Z�fdd�ZdS)z"TestCopy.test_copy_copy.<locals>.CcSs
||_dS)N)�foo)rrrrr�__init__ sz+TestCopy.test_copy_copy.<locals>.C.__init__cs
�|j�S)N)r)r)�Crr�__copy__"sz+TestCopy.test_copy_copy.<locals>.C.__copy__N)�__name__�
__module__�__qualname__rrr)rrrrsrr)�objectr
r�	__class__r)rrrr)rr�test_copy_copys

zTestCopy.test_copy_copycsPGdd�dt���fdd�}�d�}|�ttj|�t��|��t�|�}dS)Nc@seZdZdd�ZdS)z&TestCopy.test_copy_registry.<locals>.CcSst�|�}||_|S)N)r�__new__r)�clsr�objrrrr"+s
z.TestCopy.test_copy_registry.<locals>.C.__new__N)rrrr"rrrrr*srcs�|jffS)N)r)r$)rrr�pickle_C/sz-TestCopy.test_copy_registry.<locals>.pickle_Cr)r�assertRaises�	TypeErrorr
�copyreg�pickle)rr%rrr)rr�test_copy_registry)szTestCopy.test_copy_registrycsFG�fdd�dt�}g�|�}t�|�}|�||�|��dg�dS)Ncs eZdZ�fdd�Zdd�ZdS)z'TestCopy.test_copy_reduce_ex.<locals>.Ccs��d�dS)N��)�append)r�proto)�crr�
__reduce_ex__8s
z5TestCopy.test_copy_reduce_ex.<locals>.C.__reduce_ex__cSs|�d�dS)Nzshouldn't call this)�fail)rrrr�
__reduce__;sz2TestCopy.test_copy_reduce_ex.<locals>.C.__reduce__N)rrrr0r2r)r/rrr7srr+)rr
r	r)rrrrr)r/r�test_copy_reduce_ex6s
zTestCopy.test_copy_reduce_excsFG�fdd�dt�}g�|�}t�|�}|�||�|��dg�dS)NcseZdZ�fdd�ZdS)z$TestCopy.test_copy_reduce.<locals>.Ccs��d�dS)Nr+r,)r-)r)r/rrr2Es
z/TestCopy.test_copy_reduce.<locals>.C.__reduce__N)rrrr2r)r/rrrDsrr+)rr
r	r)rrrrr)r/r�test_copy_reduceCs
zTestCopy.test_copy_reducecCs,Gdd�dt�}|�}|�tjtj|�dS)Nc@seZdZdd�ZdS)z"TestCopy.test_copy_cant.<locals>.CcSs|�d�rt|��t�||�S)N�__reduce)�
startswith�AttributeErrorr�__getattribute__)r�namerrrr8Ps
z3TestCopy.test_copy_cant.<locals>.C.__getattribute__N)rrrr8rrrrrOsr)rr&r
r)rrrrrr�test_copy_cantNszTestCopy.test_copy_cantcCs�Gdd�d�}Gdd�dt�}dd�}Gdd�dtjd	�}dd
tddd
dddddd|jdttd��td�tddd�||t|t	�g}x|D]}|�
t�|�|�q�WdS)Nc@seZdZdS)z*TestCopy.test_copy_atomic.<locals>.ClassicN)rrrrrrr�ClassicZsr;c@seZdZdS)z+TestCopy.test_copy_atomic.<locals>.NewStyleN)rrrrrrr�NewStyle\sr<cSsdS)Nrrrrr�f^sz$TestCopy.test_copy_atomic.<locals>.fc@seZdZdS)z0TestCopy.test_copy_atomic.<locals>.WithMetaclassN)rrrrrrr�
WithMetaclass`sr>)�	metaclass.r��dg��Q�	@TFy�?�hellouhelloሴsworld��
r+)r�abc�ABCMeta�NotImplemented�__code__�bytes�range�slice�max�propertyr	r
)rr;r<r=r>�testsrrrr�test_copy_atomicYs
zTestCopy.test_copy_atomiccCsVdddg}t�|�}|�||�|�||�g}t�|�}|�||�|�||�dS)Nr+r@�)r
r�assertIsNot)rrrrrr�test_copy_listjs


zTestCopy.test_copy_listcCsNd}|�t�|�|�d}|�t�|�|�dddgf}|�t�|�|�dS)N)r+r@rPrr+r@rP)r	r
)rrrrr�test_copy_tupletszTestCopy.test_copy_tuplecCsVddd�}t�|�}|�||�|�||�i}t�|�}|�||�|�||�dS)Nr+r@)r�bar)r
rrQ)rrrrrr�test_copy_dict|s


zTestCopy.test_copy_dictcCsXdddh}t�|�}|�||�|�||�t�}t�|�}|�||�|�||�dS)Nr+r@rP)r
rrQ�set)rrrrrr�
test_copy_set�s


zTestCopy.test_copy_setcCs<tdddh�}|�t�|�|�t�}|�t�|�|�dS)Nr+r@rP)�	frozensetr	r
)rrrrr�test_copy_frozenset�szTestCopy.test_copy_frozensetcCsVtd�}t�|�}|�||�|�||�t�}t�|�}|�||�|�||�dS)Nsabc)�	bytearrayr
rrQ)rrrrrr�test_copy_bytearray�s

zTestCopy.test_copy_bytearraycCs,Gdd�d�}|d�}|�t�|�|�dS)Nc@seZdZdd�Zdd�ZdS)z*TestCopy.test_copy_inst_vanilla.<locals>.CcSs
||_dS)N)r)rrrrrr�sz3TestCopy.test_copy_inst_vanilla.<locals>.C.__init__cSs|j|jkS)N)r)r�otherrrr�__eq__�sz1TestCopy.test_copy_inst_vanilla.<locals>.C.__eq__N)rrrrr]rrrrr�srr)rr
)rrrrrr�test_copy_inst_vanilla�szTestCopy.test_copy_inst_vanillacs0G�fdd�d���d�}|�t�|�|�dS)Ncs(eZdZdd�Z�fdd�Zdd�ZdS)z'TestCopy.test_copy_inst_copy.<locals>.CcSs
||_dS)N)r)rrrrrr�sz0TestCopy.test_copy_inst_copy.<locals>.C.__init__cs
�|j�S)N)r)r)rrrr�sz0TestCopy.test_copy_inst_copy.<locals>.C.__copy__cSs|j|jkS)N)r)rr\rrrr]�sz.TestCopy.test_copy_inst_copy.<locals>.C.__eq__N)rrrrrr]r)rrrr�srr)rr
)rrr)rr�test_copy_inst_copy�szTestCopy.test_copy_inst_copycCs,Gdd�d�}|d�}|�t�|�|�dS)Nc@s$eZdZdd�Zdd�Zdd�ZdS)z.TestCopy.test_copy_inst_getinitargs.<locals>.CcSs
||_dS)N)r)rrrrrr�sz7TestCopy.test_copy_inst_getinitargs.<locals>.C.__init__cSs|jfS)N)r)rrrr�__getinitargs__�sz>TestCopy.test_copy_inst_getinitargs.<locals>.C.__getinitargs__cSs|j|jkS)N)r)rr\rrrr]�sz5TestCopy.test_copy_inst_getinitargs.<locals>.C.__eq__N)rrrrr`r]rrrrr�srr)rr
)rrrrrr�test_copy_inst_getinitargs�sz#TestCopy.test_copy_inst_getinitargscCsZGdd�dt�}|d�}t�|�}|�||�|�||�|�||�|�|j|j�dS)Nc@s$eZdZdd�Zdd�Zdd�ZdS)z-TestCopy.test_copy_inst_getnewargs.<locals>.CcSst�|�}||_|S)N)�intr"r)r#rrrrrr"�s
z5TestCopy.test_copy_inst_getnewargs.<locals>.C.__new__cSs|jfS)N)r)rrrr�__getnewargs__�sz<TestCopy.test_copy_inst_getnewargs.<locals>.C.__getnewargs__cSs|j|jkS)N)r)rr\rrrr]�sz4TestCopy.test_copy_inst_getnewargs.<locals>.C.__eq__N)rrrr"rcr]rrrrr�srr)rbr
�assertIsInstancerrQr)rrrrrrr�test_copy_inst_getnewargs�s	
z"TestCopy.test_copy_inst_getnewargscCs\Gdd�dt�}|dd�}t�|�}|�||�|�||�|�||�|�|j|j�dS)Nc@s$eZdZdd�Zdd�Zdd�ZdS)z0TestCopy.test_copy_inst_getnewargs_ex.<locals>.CcSst�|�}||_|S)N)rbr"r)r#rrrrrr"�s
z8TestCopy.test_copy_inst_getnewargs_ex.<locals>.C.__new__cSsdd|jifS)Nrr)r)rrrr�__getnewargs_ex__�szBTestCopy.test_copy_inst_getnewargs_ex.<locals>.C.__getnewargs_ex__cSs|j|jkS)N)r)rr\rrrr]�sz7TestCopy.test_copy_inst_getnewargs_ex.<locals>.C.__eq__N)rrrr"rfr]rrrrr�srr)r)rbr
rdrrQr)rrrrrrr�test_copy_inst_getnewargs_ex�s	

z%TestCopy.test_copy_inst_getnewargs_excCs,Gdd�d�}|d�}|�t�|�|�dS)Nc@s$eZdZdd�Zdd�Zdd�ZdS)z+TestCopy.test_copy_inst_getstate.<locals>.CcSs
||_dS)N)r)rrrrrr�sz4TestCopy.test_copy_inst_getstate.<locals>.C.__init__cSs
d|jiS)Nr)r)rrrr�__getstate__�sz8TestCopy.test_copy_inst_getstate.<locals>.C.__getstate__cSs|j|jkS)N)r)rr\rrrr]�sz2TestCopy.test_copy_inst_getstate.<locals>.C.__eq__N)rrrrrhr]rrrrr�srr)rr
)rrrrrr�test_copy_inst_getstate�sz TestCopy.test_copy_inst_getstatecCs,Gdd�d�}|d�}|�t�|�|�dS)Nc@s$eZdZdd�Zdd�Zdd�ZdS)z+TestCopy.test_copy_inst_setstate.<locals>.CcSs
||_dS)N)r)rrrrrr�sz4TestCopy.test_copy_inst_setstate.<locals>.C.__init__cSs|d|_dS)Nr)r)r�staterrr�__setstate__�sz8TestCopy.test_copy_inst_setstate.<locals>.C.__setstate__cSs|j|jkS)N)r)rr\rrrr]�sz2TestCopy.test_copy_inst_setstate.<locals>.C.__eq__N)rrrrrkr]rrrrr�srr)rr
)rrrrrr�test_copy_inst_setstate�sz TestCopy.test_copy_inst_setstatecCsFGdd�d�}|d�}|�t�|�|�|d�}|�t�|�|�dS)Nc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
z4TestCopy.test_copy_inst_getstate_setstate.<locals>.CcSs
||_dS)N)r)rrrrrr�sz=TestCopy.test_copy_inst_getstate_setstate.<locals>.C.__init__cSs|jS)N)r)rrrrrh�szATestCopy.test_copy_inst_getstate_setstate.<locals>.C.__getstate__cSs
||_dS)N)r)rrjrrrrk�szATestCopy.test_copy_inst_getstate_setstate.<locals>.C.__setstate__cSs|j|jkS)N)r)rr\rrrr]�sz;TestCopy.test_copy_inst_getstate_setstate.<locals>.C.__eq__N)rrrrrhrkr]rrrrr�srrg)rr
)rrrrrr� test_copy_inst_getstate_setstate�s
	z)TestCopy.test_copy_inst_getstate_setstatecCsd}t�|�}|�||�dS)Nr)r
�deepcopyr)rrrrrr�test_deepcopy_basic	s
zTestCopy.test_deepcopy_basiccCsZg}||g}t�|�}|�||�|�||�|�|d|d�|�|d|d�dS)Nrr+)r
rnrrQr	)rrrrrr�test_deepcopy_memos
zTestCopy.test_deepcopy_memocCs8Gdd�dt�}Gdd�d|d�}|�t�|�|�dS)Nc@seZdZdS)z/TestCopy.test_deepcopy_issubclass.<locals>.MetaN)rrrrrrr�Metasrqc@seZdZdS)z,TestCopy.test_deepcopy_issubclass.<locals>.CN)rrrrrrrr sr)r?)�typerr
rn)rrqrrrr�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>.CcSs
||_dS)N)r)rrrrrr&sz3TestCopy.test_deepcopy_deepcopy.<locals>.C.__init__Ncs
�|j�S)N)r)r�memo)rrr�__deepcopy__(sz7TestCopy.test_deepcopy_deepcopy.<locals>.C.__deepcopy__)N)rrrrrur)rrrr%srr)rr
rnrr r)rrrr)rr�test_deepcopy_deepcopy$s

zTestCopy.test_deepcopy_deepcopycsPGdd�dt���fdd�}�d�}|�ttj|�t��|��t�|�}dS)Nc@seZdZdd�ZdS)z*TestCopy.test_deepcopy_registry.<locals>.CcSst�|�}||_|S)N)rr"r)r#rr$rrrr"1s
z2TestCopy.test_deepcopy_registry.<locals>.C.__new__N)rrrr"rrrrr0srcs�|jffS)N)r)r$)rrrr%5sz1TestCopy.test_deepcopy_registry.<locals>.pickle_Cr)rr&r'r
rnr(r))rr%rrr)rr�test_deepcopy_registry/szTestCopy.test_deepcopy_registrycsFG�fdd�dt�}g�|�}t�|�}|�||�|��dg�dS)Ncs eZdZ�fdd�Zdd�ZdS)z+TestCopy.test_deepcopy_reduce_ex.<locals>.Ccs��d�dS)Nr+r,)r-)rr.)r/rrr0>s
z9TestCopy.test_deepcopy_reduce_ex.<locals>.C.__reduce_ex__cSs|�d�dS)Nzshouldn't call this)r1)rrrrr2Asz6TestCopy.test_deepcopy_reduce_ex.<locals>.C.__reduce__N)rrrr0r2r)r/rrr=srr+)rr
rnr	r)rrrrr)r/r�test_deepcopy_reduce_ex<s
z TestCopy.test_deepcopy_reduce_excsFG�fdd�dt�}g�|�}t�|�}|�||�|��dg�dS)NcseZdZ�fdd�ZdS)z(TestCopy.test_deepcopy_reduce.<locals>.Ccs��d�dS)Nr+r,)r-)r)r/rrr2Ks
z3TestCopy.test_deepcopy_reduce.<locals>.C.__reduce__N)rrrr2r)r/rrrJsrr+)rr
rnr	r)rrrrr)r/r�test_deepcopy_reduceIs
zTestCopy.test_deepcopy_reducecCs,Gdd�dt�}|�}|�tjtj|�dS)Nc@seZdZdd�ZdS)z&TestCopy.test_deepcopy_cant.<locals>.CcSs|�d�rt|��t�||�S)Nr5)r6r7rr8)rr9rrrr8Vs
z7TestCopy.test_deepcopy_cant.<locals>.C.__getattribute__N)rrrr8rrrrrUsr)rr&r
rrn)rrrrrr�test_deepcopy_cantTszTestCopy.test_deepcopy_cantcCsrGdd�d�}Gdd�dt�}dd�}dddd	d
ddd
dd|j||tt�g}x|D]}|�t�|�|�qTWdS)Nc@seZdZdS)z.TestCopy.test_deepcopy_atomic.<locals>.ClassicN)rrrrrrrr;`sr;c@seZdZdS)z/TestCopy.test_deepcopy_atomic.<locals>.NewStyleN)rrrrrrrr<bsr<cSsdS)Nrrrrrr=dsz(TestCopy.test_deepcopy_atomic.<locals>.frr@rAg��Q�	@TFy�?rBuhelloሴ)rrHrLrMr	r
rn)rr;r<r=rNrrrr�test_deepcopy_atomic_s
zTestCopy.test_deepcopy_atomiccCsFddgdg}t�|�}|�||�|�||�|�|d|d�dS)Nr+r@rPr)r
rnrrQ)rrrrrr�test_deepcopy_listls

zTestCopy.test_deepcopy_listcCsfg}|�|�t�|�}xtD]}|�t|||�qW|�||�|�|d|�|�t	|�d�dS)Nrr+)
r-r
rn�comparisonsr&�RecursionErrorrQr	r�len)rrr�oprrr�test_deepcopy_reflexive_listss


z%TestCopy.test_deepcopy_reflexive_listcCsd}t�|�}|�||�dS)Nr)r
rnr	)rrrrrr�test_deepcopy_empty_tuple}s
z"TestCopy.test_deepcopy_empty_tuplecCsFddgdf}t�|�}|�||�|�||�|�|d|d�dS)Nr+r@rPr)r
rnrrQ)rrrrrr�test_deepcopy_tuple�s

zTestCopy.test_deepcopy_tuplecCsd}t�|�}|�||�dS)N))r+r@rP)r
rnr	)rrrrrr�!test_deepcopy_tuple_of_immutables�s
z*TestCopy.test_deepcopy_tuple_of_immutablescCstgf}|d�|�t�|�}xtD]}|�t|||�q$W|�||�|�|d|d�|�|dd|�dS)Nr)r-r
rnr}r&r~rQr	)rrrr�rrr�test_deepcopy_reflexive_tuple�s

z&TestCopy.test_deepcopy_reflexive_tuplecCsHddgdd�}t�|�}|�||�|�||�|�|d|d�dS)Nr+r@rP)rrTr)r
rnrrQ)rrrrrr�test_deepcopy_dict�s

zTestCopy.test_deepcopy_dictcCs�i}||d<t�|�}xtD]}|�t|||�qWxtD]}|�t|||�q:W|�||�|�|d|�|�	t
|�d�dS)Nrr+)r
rn�order_comparisonsr&r'�equality_comparisonsr~rQr	rr)rrrr�rrr�test_deepcopy_reflexive_dict�s


z%TestCopy.test_deepcopy_reflexive_dictcCs0i}g}t�||�}|�|t|�d|�dS)Nr)r
rnr	�id)rrtrrrrr�test_deepcopy_keepalive�sz TestCopy.test_deepcopy_keepalivecCsni}ddddg}t�||�}|�||�|�t|�d�i}dg}t�||�}|�||�|�t|�d�dS)Nr+r@rP�)r+r@)r
rnrr)rrtrrrrr�!test_deepcopy_dont_memo_immutable�sz*TestCopy.test_deepcopy_dont_memo_immutablecCsBGdd�d�}|dg�}t�|�}|�||�|�|j|j�dS)Nc@seZdZdd�Zdd�ZdS)z.TestCopy.test_deepcopy_inst_vanilla.<locals>.CcSs
||_dS)N)r)rrrrrr�sz7TestCopy.test_deepcopy_inst_vanilla.<locals>.C.__init__cSs|j|jkS)N)r)rr\rrrr]�sz5TestCopy.test_deepcopy_inst_vanilla.<locals>.C.__eq__N)rrrrr]rrrrr�srr)r
rnrrQr)rrrrrrr�test_deepcopy_inst_vanilla�s


z#TestCopy.test_deepcopy_inst_vanillacsRG�fdd�d���dg�}t�|�}|�||�|�||�|�|j|j�dS)Ncs(eZdZdd�Z�fdd�Zdd�ZdS)z/TestCopy.test_deepcopy_inst_deepcopy.<locals>.CcSs
||_dS)N)r)rrrrrr�sz8TestCopy.test_deepcopy_inst_deepcopy.<locals>.C.__init__cs�t�|j|��S)N)r
rnr)rrt)rrrru�sz<TestCopy.test_deepcopy_inst_deepcopy.<locals>.C.__deepcopy__cSs|j|jkS)N)r)rr\rrrr]�sz6TestCopy.test_deepcopy_inst_deepcopy.<locals>.C.__eq__N)rrrrrur]r)rrrr�srr)r
rnrrQr)rrrr)rr�test_deepcopy_inst_deepcopy�s

z$TestCopy.test_deepcopy_inst_deepcopycCsNGdd�d�}|dg�}t�|�}|�||�|�||�|�|j|j�dS)Nc@s$eZdZdd�Zdd�Zdd�ZdS)z2TestCopy.test_deepcopy_inst_getinitargs.<locals>.CcSs
||_dS)N)r)rrrrrr�sz;TestCopy.test_deepcopy_inst_getinitargs.<locals>.C.__init__cSs|jfS)N)r)rrrrr`�szBTestCopy.test_deepcopy_inst_getinitargs.<locals>.C.__getinitargs__cSs|j|jkS)N)r)rr\rrrr]�sz9TestCopy.test_deepcopy_inst_getinitargs.<locals>.C.__eq__N)rrrrr`r]rrrrr�srr)r
rnrrQr)rrrrrrr�test_deepcopy_inst_getinitargs�s

z'TestCopy.test_deepcopy_inst_getinitargscCslGdd�dt�}|dg�}t�|�}|�||�|�||�|�||�|�|j|j�|�|j|j�dS)Nc@s$eZdZdd�Zdd�Zdd�ZdS)z1TestCopy.test_deepcopy_inst_getnewargs.<locals>.CcSst�|�}||_|S)N)rbr"r)r#rrrrrr"�s
z9TestCopy.test_deepcopy_inst_getnewargs.<locals>.C.__new__cSs|jfS)N)r)rrrrrc�sz@TestCopy.test_deepcopy_inst_getnewargs.<locals>.C.__getnewargs__cSs|j|jkS)N)r)rr\rrrr]�sz8TestCopy.test_deepcopy_inst_getnewargs.<locals>.C.__eq__N)rrrr"rcr]rrrrr�srr)rbr
rnrdrrQr)rrrrrrr�test_deepcopy_inst_getnewargs�s	

z&TestCopy.test_deepcopy_inst_getnewargscCsnGdd�dt�}|dgd�}t�|�}|�||�|�||�|�||�|�|j|j�|�|j|j�dS)Nc@s$eZdZdd�Zdd�Zdd�ZdS)z4TestCopy.test_deepcopy_inst_getnewargs_ex.<locals>.CcSst�|�}||_|S)N)rbr"r)r#rrrrrr"�s
z<TestCopy.test_deepcopy_inst_getnewargs_ex.<locals>.C.__new__cSsdd|jifS)Nrr)r)rrrrrf�szFTestCopy.test_deepcopy_inst_getnewargs_ex.<locals>.C.__getnewargs_ex__cSs|j|jkS)N)r)rr\rrrr]sz;TestCopy.test_deepcopy_inst_getnewargs_ex.<locals>.C.__eq__N)rrrr"rfr]rrrrr�srr)r)rbr
rnrdrrQr)rrrrrrr� test_deepcopy_inst_getnewargs_ex�s	
z)TestCopy.test_deepcopy_inst_getnewargs_excCsNGdd�d�}|dg�}t�|�}|�||�|�||�|�|j|j�dS)Nc@s$eZdZdd�Zdd�Zdd�ZdS)z/TestCopy.test_deepcopy_inst_getstate.<locals>.CcSs
||_dS)N)r)rrrrrr
sz8TestCopy.test_deepcopy_inst_getstate.<locals>.C.__init__cSs
d|jiS)Nr)r)rrrrrhsz<TestCopy.test_deepcopy_inst_getstate.<locals>.C.__getstate__cSs|j|jkS)N)r)rr\rrrr]sz6TestCopy.test_deepcopy_inst_getstate.<locals>.C.__eq__N)rrrrrhr]rrrrrsrr)r
rnrrQr)rrrrrrr�test_deepcopy_inst_getstates

z$TestCopy.test_deepcopy_inst_getstatecCsNGdd�d�}|dg�}t�|�}|�||�|�||�|�|j|j�dS)Nc@s$eZdZdd�Zdd�Zdd�ZdS)z/TestCopy.test_deepcopy_inst_setstate.<locals>.CcSs
||_dS)N)r)rrrrrrsz8TestCopy.test_deepcopy_inst_setstate.<locals>.C.__init__cSs|d|_dS)Nr)r)rrjrrrrksz<TestCopy.test_deepcopy_inst_setstate.<locals>.C.__setstate__cSs|j|jkS)N)r)rr\rrrr]sz6TestCopy.test_deepcopy_inst_setstate.<locals>.C.__eq__N)rrrrrkr]rrrrrsrr)r
rnrrQr)rrrrrrr�test_deepcopy_inst_setstates

z$TestCopy.test_deepcopy_inst_setstatecCs�Gdd�d�}|dg�}t�|�}|�||�|�||�|�|j|j�|g�}t�|�}|�||�|�||�|�|j|j�dS)Nc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
z8TestCopy.test_deepcopy_inst_getstate_setstate.<locals>.CcSs
||_dS)N)r)rrrrrr)szATestCopy.test_deepcopy_inst_getstate_setstate.<locals>.C.__init__cSs|jS)N)r)rrrrrh+szETestCopy.test_deepcopy_inst_getstate_setstate.<locals>.C.__getstate__cSs
||_dS)N)r)rrjrrrrk-szETestCopy.test_deepcopy_inst_getstate_setstate.<locals>.C.__setstate__cSs|j|jkS)N)r)rr\rrrr]/sz?TestCopy.test_deepcopy_inst_getstate_setstate.<locals>.C.__eq__N)rrrrrhrkr]rrrrr(srr)r
rnrrQr)rrrrrrr�$test_deepcopy_inst_getstate_setstate's	


z-TestCopy.test_deepcopy_inst_getstate_setstatecCsBGdd�d�}|�}||_t�|�}|�||�|�|j|�dS)Nc@seZdZdS)z0TestCopy.test_deepcopy_reflexive_inst.<locals>.CN)rrrrrrrr>sr)rr
rnrQr	)rrrrrrr�test_deepcopy_reflexive_inst=s
z%TestCopy.test_deepcopy_reflexive_instcCspGdd�dt�}t|d��}t�|�}|�||�|�||�|�|j|j�|�|j|j�|�|j|�dS)Nc@seZdZdS)z'TestCopy.test_deepcopy_range.<locals>.IN)rrrrrrr�IGsr�rD)rbrJr
rnrQr�stoprd)rr�rrrrr�test_deepcopy_rangeFs
zTestCopy.test_deepcopy_rangecCsFGdd�dt�}|�}t�|�}|�||�t�|�}|�||�dS)Nc@seZdZdd�ZdS)z+TestCopy.test_reconstruct_string.<locals>.CcSsdS)Nr,r)rrrrr2Usz6TestCopy.test_reconstruct_string.<locals>.C.__reduce__N)rrrr2rrrrrTsr)rr
r	rn)rrrrrrr�test_reconstruct_stringSs

z TestCopy.test_reconstruct_stringcsXG�fdd�dt����}d|_t�|�}|�|j|j�t�|�}|�|j|j�dS)NcseZdZ�fdd�ZdS)z,TestCopy.test_reconstruct_nostate.<locals>.Ccs�dfS)Nrr)r)rrrr2_sz7TestCopy.test_reconstruct_nostate.<locals>.C.__reduce__N)rrrr2r)rrrr^srr)rrr
r	r rn)rrrr)rr�test_reconstruct_nostate]s

z!TestCopy.test_reconstruct_nostatecsbG�fdd�dt����}dg|_t�|�}|�||�t�|�}|�||�|�|j|j�dS)Ncs eZdZ�fdd�Zdd�ZdS)z*TestCopy.test_reconstruct_state.<locals>.Ccs�d|jfS)Nr)�__dict__)r)rrrr2jsz5TestCopy.test_reconstruct_state.<locals>.C.__reduce__cSs|j|jkS)N)r�)rr\rrrr]lsz1TestCopy.test_reconstruct_state.<locals>.C.__eq__N)rrrr2r]r)rrrrisrr)rrr
rrnrQ)rrrr)rr�test_reconstruct_statehs

zTestCopy.test_reconstruct_statecsbG�fdd�dt����}dg|_t�|�}|�||�t�|�}|�||�|�|j|j�dS)Ncs(eZdZ�fdd�Zdd�Zdd�ZdS)z3TestCopy.test_reconstruct_state_setstate.<locals>.Ccs�d|jfS)Nr)r�)r)rrrr2xsz>TestCopy.test_reconstruct_state_setstate.<locals>.C.__reduce__cSs|j�|�dS)N)r��update)rrjrrrrkzsz@TestCopy.test_reconstruct_state_setstate.<locals>.C.__setstate__cSs|j|jkS)N)r�)rr\rrrr]|sz:TestCopy.test_reconstruct_state_setstate.<locals>.C.__eq__N)rrrr2rkr]r)rrrrwsrr)rrr
rrnrQ)rrrr)rr�test_reconstruct_state_setstatevs

z(TestCopy.test_reconstruct_state_setstatecCsDGdd�dt�}|�}||_t�|�}|�||�|�|j|�dS)Nc@seZdZdS)z.TestCopy.test_reconstruct_reflexive.<locals>.CN)rrrrrrrr�sr)rrr
rnrQr	)rrrrrrr�test_reconstruct_reflexive�s
z#TestCopy.test_reconstruct_reflexivecs�G�fdd�dt���ddgdg�}t�|�}|�||�|�||�|�|d|d�t�|�}|�||�|�||�|�|d|d�dS)Ncs eZdZ�fdd�Zdd�ZdS)z&TestCopy.test_reduce_4tuple.<locals>.Ccs�d|jt|�fS)Nr)r��iter)r)rrrr2�sz1TestCopy.test_reduce_4tuple.<locals>.C.__reduce__cSst|�t|�ko|j|jkS)N)�listr�)rr\rrrr]�sz-TestCopy.test_reduce_4tuple.<locals>.C.__eq__N)rrrr2r]r)rrrr�srr+r@rPr)r�r
rrQr	rn)rrrr)rr�test_reduce_4tuple�s

zTestCopy.test_reduce_4tuplecs�G�fdd�dt���dddgfdg�}t�|�}|�||�|�||�|�|d|d�t�|�}|�||�|�||�|�|d|d�dS)Ncs eZdZ�fdd�Zdd�ZdS)z&TestCopy.test_reduce_5tuple.<locals>.Ccs�d|jd|��fS)Nr)r��items)r)rrrr2�sz1TestCopy.test_reduce_5tuple.<locals>.C.__reduce__cSst|�t|�ko|j|jkS)N)�dictr�)rr\rrrr]�sz-TestCopy.test_reduce_5tuple.<locals>.C.__eq__N)rrrr2r]r)rrrr�srrr+r@)rTrP)r�r
rrQr	rn)rrrr)rr�test_reduce_5tuple�s

zTestCopy.test_reduce_5tuplecCs<Gdd�dt�}|�}dg|_t�|�}|�|j|j�dS)Nc@seZdZdgZdS)z#TestCopy.test_copy_slots.<locals>.CrN)rrr�	__slots__rrrrr�srr)rrr
r	)rrrrrrr�test_copy_slots�s

zTestCopy.test_copy_slotscCsLGdd�dt�}|�}dg|_t�|�}|�|j|j�|�|j|j�dS)Nc@seZdZdgZdS)z'TestCopy.test_deepcopy_slots.<locals>.CrN)rrrr�rrrrr�srr)rrr
rnrrQ)rrrrrrr�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��|�dS)N)r��keys�_keys�superr)r�d)r rrr�sz8TestCopy.test_deepcopy_dict_subclass.<locals>.C.__init__cs(t��||�||jkr$|j�|�dS)N)r��__setitem__r�r-)r�key�item)r rrr��s
z;TestCopy.test_deepcopy_dict_subclass.<locals>.C.__setitem__)N)rrrrr��
__classcell__rr)r rr�srrr)r�r+rT)r�r
rnrr�rQ�assertNotEqual)rrrrrrr�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@seZdZdS)z+TestCopy.test_copy_list_subclass.<locals>.CN)rrrrrrrr�srr+r@rPr��r)r�rr
rr	)rrrrrrr�test_copy_list_subclass�s

z TestCopy.test_copy_list_subclasscCs�Gdd�dt�}|ddgdg�}ddg|_t�|�}|�t|�t|��|�|j|j�|�|d|d�|�|j|j�dS)	Nc@seZdZdS)z/TestCopy.test_deepcopy_list_subclass.<locals>.CN)rrrrrrrr�srr+r@rPr�r�r)r�rr
rnrrQ)rrrrrrr�test_deepcopy_list_subclass�s

z$TestCopy.test_deepcopy_list_subclasscCsLGdd�dt�}|dddg�}|�t|�d�t�|�}|�t|�d�dS)Nc@seZdZdS)z,TestCopy.test_copy_tuple_subclass.<locals>.CN)rrrrrrrr�srr+r@rP)r+r@rP)�tuplerr
)rrrrrrr�test_copy_tuple_subclass�s

z!TestCopy.test_copy_tuple_subclasscCs~Gdd�dt�}|ddgdg�}|�t|�ddgdf�t�|�}|�t|�ddgdf�|�||�|�|d|d�dS)Nc@seZdZdS)z0TestCopy.test_deepcopy_tuple_subclass.<locals>.CN)rrrrrrrr�srr+r@rPr)r�rr
rnrQ)rrrrrrr�test_deepcopy_tuple_subclass�s
z%TestCopy.test_deepcopy_tuple_subclasscCs&Gdd�dt�}|�ttj|��dS)Nc@seZdZdd�ZdS)z-TestCopy.test_getstate_exc.<locals>.EvilStatecSstd��dS)Nzain't got no stickin' state)�
ValueError)rrrrrhsz:TestCopy.test_getstate_exc.<locals>.EvilState.__getstate__N)rrrrhrrrr�	EvilStatesr�)rr&r�r
)rr�rrr�test_getstate_excszTestCopy.test_getstate_exccCsJ|�t�t�t�dd�}|�t�|�|�dd�}|�t�|�|�dS)NcSs||S)Nr)rrrrrr�z(TestCopy.test_copy_function.<locals>.foocSsdS)Nrrrrr�<lambda>
r�z-TestCopy.test_copy_function.<locals>.<lambda>)rr
�
global_foo)rrrTrrr�test_copy_functions
zTestCopy.test_copy_functioncCsJ|�t�t�t�dd�}|�t�|�|�dd�}|�t�|�|�dS)NcSs||S)Nr)rrrrrrr�z,TestCopy.test_deepcopy_function.<locals>.foocSsdS)Nrrrrrr�r�z1TestCopy.test_deepcopy_function.<locals>.<lambda>)rr
rnr�)rrrTrrr�test_deepcopy_function
s
zTestCopy.test_deepcopy_functioncCsNGdd�dt�}|�}t�|�}||�}|�||�~||�}|�||�dS)Nc@seZdZdS)z"TestCopy._check_weakref.<locals>.CN)rrrrrrrrsr)r�weakref�refr	)rZ_copyrr$rrrrr�_check_weakrefs
zTestCopy._check_weakrefcCs|�tj�dS)N)r�r
)rrrr�test_copy_weakrefszTestCopy.test_copy_weakrefcCs|�tj�dS)N)r�r
rn)rrrr�test_deepcopy_weakref"szTestCopy.test_deepcopy_weakrefc
s�Gdd�dt���fdd�td�D�\}}}}|�}|||<|||<t�|�}|�||�|�||�|�|||�|�|||�|�t|�d�~~|�t|�d�����}}	|	||<|�||�dS)Nc@seZdZdS)z(TestCopy._check_copy_weakdict.<locals>.CN)rrrrrrrr&srcsg|]
}���qSrr)�.0�i)rrr�
<listcomp>(sz1TestCopy._check_copy_weakdict.<locals>.<listcomp>r�r@r+)rrJr
rQrrZassertNotIn)
rZ	_dicttype�a�br/r��u�vrrr)rr�_check_copy_weakdict%s 
zTestCopy._check_copy_weakdictcCs|�tj�dS)N)r�r��WeakKeyDictionary)rrrr�test_copy_weakkeydict9szTestCopy.test_copy_weakkeydictcCs|�tj�dS)N)r�r��WeakValueDictionary)rrrr�test_copy_weakvaluedict<sz TestCopy.test_copy_weakvaluedictcs�Gdd�dt���fdd�td�D�\}}}}t��}|||<|||<t�|�}|�||�|�t|�d�|�	|||�|�	|||�|�||j
|j
�|�||j
|j
�~|�t|�d�dS)Nc@seZdZdd�ZdS)z-TestCopy.test_deepcopy_weakkeydict.<locals>.CcSs
||_dS)N)r�)rr�rrrrAsz6TestCopy.test_deepcopy_weakkeydict.<locals>.C.__init__N)rrrrrrrrr@srcsg|]}�|��qSrr)r�r�)rrrr�Csz6TestCopy.test_deepcopy_weakkeydict.<locals>.<listcomp>r�r@r+)rrJr�r�r
rnr�rrrQr�)rr�r�r/r�r�r�r)rr�test_deepcopy_weakkeydict?s
z"TestCopy.test_deepcopy_weakkeydictcs�Gdd�dt���fdd�td�D�\}}}}t��}|||<|||<t�|�}|�||�|�t|�d�t	|�
�dd�d	�\\}}\}	}
|�||�|�|j|j�|�
||�|�|	|�|�|	j|j�|�
|
|�~~~	~
~|�t|�d
�dS)Nc@seZdZdd�ZdS)z/TestCopy.test_deepcopy_weakvaluedict.<locals>.CcSs
||_dS)N)r�)rr�rrrrTsz8TestCopy.test_deepcopy_weakvaluedict.<locals>.C.__init__N)rrrrrrrrrSsrcsg|]}�|��qSrr)r�r�)rrrr�Vsz8TestCopy.test_deepcopy_weakvaluedict.<locals>.<listcomp>r�r@cSs
|djS)Nr)r�)Zpairrrrr�^r�z6TestCopy.test_deepcopy_weakvaluedict.<locals>.<lambda>)r�r+)rrJr�r�r
rnr�rr�sortedr�rQr�r	)rr�r�r/r�r�r�rr�z�tr)rr�test_deepcopy_weakvaluedictRs$
 z$TestCopy.test_deepcopy_weakvaluedictcCsTGdd�dt�}|�}|j|_t�|�}|�|j|j�|�|jj|�|��dS)Nc@seZdZdd�ZdS)z0TestCopy.test_deepcopy_bound_method.<locals>.FoocSsdS)Nr)rrrr�mksz2TestCopy.test_deepcopy_bound_method.<locals>.Foo.mN)rrrr�rrrr�Foojsr�)rr�r�r
rnrr	�__self__)rr�r=�grrr�test_deepcopy_bound_methodis
z#TestCopy.test_deepcopy_bound_methodN)Prrrrrr!r*r3r4r:rOrRrSrUrWrYr[r^r_rarergrirlrmrorprsrvrwrxryrzr{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�r�r�r�r�r�r�r�r�r�r�r�rrrrrs�





	




	

	
rcCs||S)Nr)rrrrrr�ur�r��__main__)�__doc__r
r(r�rE�operatorrrrrrrZunittestr�r�r}ZTestCaserr�r�mainrrrr�<module>s& l