Your IP : 216.73.216.213


Current Path : /opt/alt/python34/lib64/python3.4/test/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/test/__pycache__/test_copy.cpython-34.pyc

�
f f�X�@s�dZddlZddlZddlZddlZddlmZmZmZm	Z	m
Z
mZddlZddl
mZeeee	fZe
efZeeZGdd�dej�Zdd�Zd	d
�Zedkr�e�ndS)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�S)��TestCopycCs3|jtjtj�|jttjt��dS)N)�assertIs�copy�Error�errorZ
assertTrue�
issubclass�	Exception)�self�r�3/opt/alt/python34/lib64/python3.4/test/test_copy.py�test_exceptionsszTestCopy.test_exceptionscCs)d}tj|�}|j||�dS)N�*)r�assertEqual)r�x�yrrr�test_copy_basicszTestCopy.test_copy_basiccsgG�fdd�dt���d�}tj|�}|j|j|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)rrrr srr)�objectrr�	__class__r)rrrr)rr�test_copy_copys
zTestCopy.test_copy_copycspGdd�dt���fdd�}�d�}|jttj|�tj�|��tj|�}dS)Nc@seZdZdd�ZdS)z&TestCopy.test_copy_registry.<locals>.CcSstj|�}||_|S)N)r �__new__r)�clsr�objrrrr#,s	z.TestCopy.test_copy_registry.<locals>.C.__new__N)rrrr#rrrrr+srcs�|jffS)N)r)r%)rrr�pickle_C0sz-TestCopy.test_copy_registry.<locals>.pickle_Cr)r �assertRaises�	TypeErrorr�copyreg�pickle)rr&rrr)rr�test_copy_registry*szTestCopy.test_copy_registrycsaG�fdd�dt�}g�|�}tj|�}|j||�|j�dg�dS)Ncs.eZdZ�fdd�Zdd�ZdS)z'TestCopy.test_copy_reduce_ex.<locals>.Ccs�jd�dS)N��)�append)r�proto)�crr�
__reduce_ex__9s
z5TestCopy.test_copy_reduce_ex.<locals>.C.__reduce_ex__cSs|jd�dS)Nzshouldn't call this)�fail)rrrr�
__reduce__<sz2TestCopy.test_copy_reduce_ex.<locals>.C.__reduce__N)rrrr1r3r)r0rrr8srr,)r rr
r)rrrrr)r0r�test_copy_reduce_ex7s	zTestCopy.test_copy_reduce_excsaG�fdd�dt�}g�|�}tj|�}|j||�|j�dg�dS)Ncs"eZdZ�fdd�ZdS)z$TestCopy.test_copy_reduce.<locals>.Ccs�jd�dS)Nr,r-)r.)r)r0rrr3Fs
z/TestCopy.test_copy_reduce.<locals>.C.__reduce__N)rrrr3r)r0rrrEsrr,)r rr
r)rrrrr)r0r�test_copy_reduceDs	zTestCopy.test_copy_reducecCs<Gdd�dt�}|�}|jtjtj|�dS)Nc@seZdZdd�ZdS)z"TestCopy.test_copy_cant.<locals>.CcSs.|jd�rt|��ntj||�S)N�__reduce)�
startswith�AttributeErrorr �__getattribute__)r�namerrrr9Qsz3TestCopy.test_copy_cant.<locals>.C.__getattribute__N)rrrr9rrrrrPsr)r r'rr)rrrrrr�test_copy_cantOs	zTestCopy.test_copy_cantcCs�Gdd�d�}Gdd�dt�}dd�}Gdd�dd	tj�}dd
dd
ddddd|jdttd��|td�|t|g}x'|D]}|jtj|�|�q�WdS)Nc@seZdZdS)z*TestCopy.test_copy_atomic.<locals>.ClassicN)rrrrrrr�Classic[sr<c@seZdZdS)z+TestCopy.test_copy_atomic.<locals>.NewStyleN)rrrrrrr�NewStyle]sr=cSsdS)Nrrrrr�f_sz$TestCopy.test_copy_atomic.<locals>.fc@seZdZdS)z0TestCopy.test_copy_atomic.<locals>.WithMetaclassN)rrrrrrr�
WithMetaclassasr?�	metaclassr��dg��Q�	@TFy�?�hellouhelloሴsworld��
l)	r �abc�ABCMeta�__code__�bytes�range�maxr
r)rr<r=r>r?�testsrrrr�test_copy_atomicZs
zTestCopy.test_copy_atomiccCs,dddg}|jtj|�|�dS)Nr,rA�)rr)rrrrr�test_copy_listjszTestCopy.test_copy_listcCs#d}|jtj|�|�dS)Nr,rArN)r,rArN)rr)rrrrr�test_copy_tuplenszTestCopy.test_copy_tuplecCs1idd6dd6}|jtj|�|�dS)Nr,rrA�bar)rr)rrrrr�test_copy_dictrszTestCopy.test_copy_dictcCs<Gdd�d�}|d�}|jtj|�|�dS)Nc@s(eZdZdd�Zdd�ZdS)z*TestCopy.test_copy_inst_vanilla.<locals>.CcSs
||_dS)N)r)rrrrrrxsz3TestCopy.test_copy_inst_vanilla.<locals>.C.__init__cSs|j|jkS)N)r)r�otherrrr�__eq__zsz1TestCopy.test_copy_inst_vanilla.<locals>.C.__eq__N)rrrrrTrrrrrwsrr)rr)rrrrrr�test_copy_inst_vanillavszTestCopy.test_copy_inst_vanillacsBG�fdd�d���d�}|jtj|�|�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)rrSrrrrT�sz.TestCopy.test_copy_inst_copy.<locals>.C.__eq__N)rrrrrrTr)rrrr�srr)rr)rrr)rr�test_copy_inst_copyszTestCopy.test_copy_inst_copycCs<Gdd�d�}|d�}|jtj|�|�dS)Nc@s4eZdZdd�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)rrSrrrrT�sz5TestCopy.test_copy_inst_getinitargs.<locals>.C.__eq__N)rrrrrWrTrrrrr�srr)rr)rrrrrr�test_copy_inst_getinitargs�sz#TestCopy.test_copy_inst_getinitargscCs<Gdd�d�}|d�}|jtj|�|�dS)Nc@s4eZdZdd�Zdd�Zdd�ZdS)z+TestCopy.test_copy_inst_getstate.<locals>.CcSs
||_dS)N)r)rrrrrr�sz4TestCopy.test_copy_inst_getstate.<locals>.C.__init__cSsi|jd6S)Nr)r)rrrr�__getstate__�sz8TestCopy.test_copy_inst_getstate.<locals>.C.__getstate__cSs|j|jkS)N)r)rrSrrrrT�sz2TestCopy.test_copy_inst_getstate.<locals>.C.__eq__N)rrrrrYrTrrrrr�srr)rr)rrrrrr�test_copy_inst_getstate�sz TestCopy.test_copy_inst_getstatecCs<Gdd�d�}|d�}|jtj|�|�dS)Nc@s4eZdZdd�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)rrSrrrrT�sz2TestCopy.test_copy_inst_setstate.<locals>.C.__eq__N)rrrrr\rTrrrrr�srr)rr)rrrrrr�test_copy_inst_setstate�sz TestCopy.test_copy_inst_setstatecCsaGdd�d�}|d�}|jtj|�|�|d�}|jtj|�|�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)rrrrrY�szATestCopy.test_copy_inst_getstate_setstate.<locals>.C.__getstate__cSs
||_dS)N)r)rr[rrrr\�szATestCopy.test_copy_inst_getstate_setstate.<locals>.C.__setstate__cSs|j|jkS)N)r)rrSrrrrT�sz;TestCopy.test_copy_inst_getstate_setstate.<locals>.C.__eq__N)rrrrrYr\rTrrrrr�srrg)rr)rrrrrr� test_copy_inst_getstate_setstate�s
	z)TestCopy.test_copy_inst_getstate_setstatecCs)d}tj|�}|j||�dS)Nr)r�deepcopyr)rrrrrr�test_deepcopy_basic�szTestCopy.test_deepcopy_basiccCsug}||g}tj|�}|j||�|j||�|j|d|d�|j|d|d�dS)Nrr,)rr_r�assertIsNotr
)rrrrrr�test_deepcopy_memo�szTestCopy.test_deepcopy_memocCsLGdd�dt�}Gdd�dd|�}|jtj|�|�dS)Nc@seZdZdS)z/TestCopy.test_deepcopy_issubclass.<locals>.MetaN)rrrrrrr�Meta�srcc@seZdZdS)z,TestCopy.test_deepcopy_issubclass.<locals>.CN)rrrrrrrr�srr@)�typerrr_)rrcrrrr�test_deepcopy_issubclass�sz!TestCopy.test_deepcopy_issubclasscsgG�fdd�dt���d�}tj|�}|j|j|j�|j|j|j�dS)Ncs1eZdZdd�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__)rrrrrgr)rrrr�srr)r rr_rr!r)rrrr)rr�test_deepcopy_deepcopy�s
zTestCopy.test_deepcopy_deepcopycspGdd�dt���fdd�}�d�}|jttj|�tj�|��tj|�}dS)Nc@seZdZdd�ZdS)z*TestCopy.test_deepcopy_registry.<locals>.CcSstj|�}||_|S)N)r r#r)r$rr%rrrr#�s	z2TestCopy.test_deepcopy_registry.<locals>.C.__new__N)rrrr#rrrrr�srcs�|jffS)N)r)r%)rrrr&�sz1TestCopy.test_deepcopy_registry.<locals>.pickle_Cr)r r'r(rr_r)r*)rr&rrr)rr�test_deepcopy_registry�szTestCopy.test_deepcopy_registrycsaG�fdd�dt�}g�|�}tj|�}|j||�|j�dg�dS)Ncs.eZdZ�fdd�Zdd�ZdS)z+TestCopy.test_deepcopy_reduce_ex.<locals>.Ccs�jd�dS)Nr,r-)r.)rr/)r0rrr1�s
z9TestCopy.test_deepcopy_reduce_ex.<locals>.C.__reduce_ex__cSs|jd�dS)Nzshouldn't call this)r2)rrrrr3�sz6TestCopy.test_deepcopy_reduce_ex.<locals>.C.__reduce__N)rrrr1r3r)r0rrr�srr,)r rr_r
r)rrrrr)r0r�test_deepcopy_reduce_ex�s	z TestCopy.test_deepcopy_reduce_excsaG�fdd�dt�}g�|�}tj|�}|j||�|j�dg�dS)Ncs"eZdZ�fdd�ZdS)z(TestCopy.test_deepcopy_reduce.<locals>.Ccs�jd�dS)Nr,r-)r.)r)r0rrr3�s
z3TestCopy.test_deepcopy_reduce.<locals>.C.__reduce__N)rrrr3r)r0rrr�srr,)r rr_r
r)rrrrr)r0r�test_deepcopy_reduce�s	zTestCopy.test_deepcopy_reducecCs<Gdd�dt�}|�}|jtjtj|�dS)Nc@seZdZdd�ZdS)z&TestCopy.test_deepcopy_cant.<locals>.CcSs.|jd�rt|��ntj||�S)Nr6)r7r8r r9)rr:rrrr9
sz7TestCopy.test_deepcopy_cant.<locals>.C.__getattribute__N)rrrr9rrrrr	sr)r r'rrr_)rrrrrr�test_deepcopy_cants	zTestCopy.test_deepcopy_cantcCs�Gdd�d�}Gdd�dt�}dd�}dddd
ddd
dd|j|td�|tg}x'|D]}|jtj|�|�quWdS)Nc@seZdZdS)z.TestCopy.test_deepcopy_atomic.<locals>.ClassicN)rrrrrrrr<sr<c@seZdZdS)z/TestCopy.test_deepcopy_atomic.<locals>.NewStyleN)rrrrrrrr=sr=cSsdS)Nrrrrrr>sz(TestCopy.test_deepcopy_atomic.<locals>.frrArBg��Q�	@TFy�?rCuhelloሴrEl)r rHrJrKr
rr_)rr<r=r>rLrrrr�test_deepcopy_atomics
zTestCopy.test_deepcopy_atomiccCs]ddgdg}tj|�}|j||�|j||�|j|d|d�dS)Nr,rArNr)rr_rra)rrrrrr�test_deepcopy_list s
zTestCopy.test_deepcopy_listcCs�g}|j|�tj|�}x$tD]}|jt|||�q)W|j||�|j|d|�|jt	|�d�dS)Nrr,)
r.rr_�comparisonsr'�RuntimeErrorrar
r�len)rrr�oprrr�test_deepcopy_reflexive_list's

z%TestCopy.test_deepcopy_reflexive_listcCs)f}tj|�}|j||�dS)N)rr_r
)rrrrrr�test_deepcopy_empty_tuple1sz"TestCopy.test_deepcopy_empty_tuplecCs]ddgdf}tj|�}|j||�|j||�|j|d|d�dS)Nr,rArNr)rr_rra)rrrrrr�test_deepcopy_tuple6s
zTestCopy.test_deepcopy_tuplecCs)d}tj|�}|j||�dS)Nr,rArN�r,rA)rvrN)rr_r
)rrrrrr�!test_deepcopy_tuple_of_immutables=sz*TestCopy.test_deepcopy_tuple_of_immutablescCs�gf}|dj|�tj|�}x$tD]}|jt|||�q0W|j||�|j|d|d�|j|dd|�dS)Nr)r.rr_ror'rprar
)rrrrrrrr�test_deepcopy_reflexive_tupleBs	
z&TestCopy.test_deepcopy_reflexive_tuplecCseiddgd6dd6}tj|�}|j||�|j||�|j|d|d�dS)Nr,rArrNrQ)rr_rra)rrrrrr�test_deepcopy_dictLs
zTestCopy.test_deepcopy_dictcCs�i}||d<tj|�}x$tD]}|jt|||�q&Wx$tD]}|jt|||�qMW|j||�|j|d|�|j	t
|�d�dS)Nrr,)rr_�order_comparisonsr'r(�equality_comparisonsrprar
rrq)rrrrrrrr�test_deepcopy_reflexive_dictSs


z%TestCopy.test_deepcopy_reflexive_dictcCs@i}g}tj||�}|j|t|�d|�dS)Nr)rr_r
�id)rrfrrrrr�test_deepcopy_keepalive_sz TestCopy.test_deepcopy_keepalivecCs�i}ddddg}tj||�}|j||�|jt|�d�i}dg}tj||�}|j||�|jt|�d�dS)Nr,rArN�)r,rA)rr_rrq)rrfrrrrr�!test_deepcopy_dont_memo_immutablees	z*TestCopy.test_deepcopy_dont_memo_immutablecCs[Gdd�d�}|dg�}tj|�}|j||�|j|j|j�dS)Nc@s(eZdZdd�Zdd�ZdS)z.TestCopy.test_deepcopy_inst_vanilla.<locals>.CcSs
||_dS)N)r)rrrrrrvsz7TestCopy.test_deepcopy_inst_vanilla.<locals>.C.__init__cSs|j|jkS)N)r)rrSrrrrTxsz5TestCopy.test_deepcopy_inst_vanilla.<locals>.C.__eq__N)rrrrrTrrrrrusrr)rr_rrar)rrrrrrr�test_deepcopy_inst_vanillats
z#TestCopy.test_deepcopy_inst_vanillacsqG�fdd�d���dg�}tj|�}|j||�|j||�|j|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�tj|j|��S)N)rr_r)rrf)rrrrg�sz<TestCopy.test_deepcopy_inst_deepcopy.<locals>.C.__deepcopy__cSs|j|jkS)N)r)rrSrrrrT�sz6TestCopy.test_deepcopy_inst_deepcopy.<locals>.C.__eq__N)rrrrrgrTr)rrrr�srr)rr_rrar)rrrr)rr�test_deepcopy_inst_deepcopysz$TestCopy.test_deepcopy_inst_deepcopycCskGdd�d�}|dg�}tj|�}|j||�|j||�|j|j|j�dS)Nc@s4eZdZdd�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)rrrrrW�szBTestCopy.test_deepcopy_inst_getinitargs.<locals>.C.__getinitargs__cSs|j|jkS)N)r)rrSrrrrT�sz9TestCopy.test_deepcopy_inst_getinitargs.<locals>.C.__eq__N)rrrrrWrTrrrrr�srr)rr_rrar)rrrrrrr�test_deepcopy_inst_getinitargs�sz'TestCopy.test_deepcopy_inst_getinitargscCskGdd�d�}|dg�}tj|�}|j||�|j||�|j|j|j�dS)Nc@s4eZdZdd�Zdd�Zdd�ZdS)z/TestCopy.test_deepcopy_inst_getstate.<locals>.CcSs
||_dS)N)r)rrrrrr�sz8TestCopy.test_deepcopy_inst_getstate.<locals>.C.__init__cSsi|jd6S)Nr)r)rrrrrY�sz<TestCopy.test_deepcopy_inst_getstate.<locals>.C.__getstate__cSs|j|jkS)N)r)rrSrrrrT�sz6TestCopy.test_deepcopy_inst_getstate.<locals>.C.__eq__N)rrrrrYrTrrrrr�srr)rr_rrar)rrrrrrr�test_deepcopy_inst_getstate�sz$TestCopy.test_deepcopy_inst_getstatecCskGdd�d�}|dg�}tj|�}|j||�|j||�|j|j|j�dS)Nc@s4eZdZdd�Zdd�Zdd�ZdS)z/TestCopy.test_deepcopy_inst_setstate.<locals>.CcSs
||_dS)N)r)rrrrrr�sz8TestCopy.test_deepcopy_inst_setstate.<locals>.C.__init__cSs|d|_dS)Nr)r)rr[rrrr\�sz<TestCopy.test_deepcopy_inst_setstate.<locals>.C.__setstate__cSs|j|jkS)N)r)rrSrrrrT�sz6TestCopy.test_deepcopy_inst_setstate.<locals>.C.__eq__N)rrrrr\rTrrrrr�srr)rr_rrar)rrrrrrr�test_deepcopy_inst_setstate�sz$TestCopy.test_deepcopy_inst_setstatecCs�Gdd�d�}|dg�}tj|�}|j||�|j||�|j|j|j�|g�}tj|�}|j||�|j||�|j|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)rrrrrY�szETestCopy.test_deepcopy_inst_getstate_setstate.<locals>.C.__getstate__cSs
||_dS)N)r)rr[rrrr\�szETestCopy.test_deepcopy_inst_getstate_setstate.<locals>.C.__setstate__cSs|j|jkS)N)r)rrSrrrrT�sz?TestCopy.test_deepcopy_inst_getstate_setstate.<locals>.C.__eq__N)rrrrrYr\rTrrrrr�srr)rr_rrar)rrrrrrr�$test_deepcopy_inst_getstate_setstate�s	z-TestCopy.test_deepcopy_inst_getstate_setstatecCs[Gdd�d�}|�}||_tj|�}|j||�|j|j|�dS)Nc@seZdZdS)z0TestCopy.test_deepcopy_reflexive_inst.<locals>.CN)rrrrrrrr�sr)rrr_rar
)rrrrrrr�test_deepcopy_reflexive_inst�s		z%TestCopy.test_deepcopy_reflexive_instcCsaGdd�dt�}|�}tj|�}|j||�tj|�}|j||�dS)Nc@seZdZdd�ZdS)z+TestCopy.test_reconstruct_string.<locals>.CcSsdS)Nr-r)rrrrr3�sz6TestCopy.test_reconstruct_string.<locals>.C.__reduce__N)rrrr3rrrrr�sr)r rr
r_)rrrrrrr�test_reconstruct_string�s	z TestCopy.test_reconstruct_stringcs|G�fdd�dt����}d|_tj|�}|j|j|j�tj|�}|j|j|j�dS)Ncs"eZdZ�fdd�ZdS)z,TestCopy.test_reconstruct_nostate.<locals>.Ccs
�ffS)Nr)r)rrrr3�sz7TestCopy.test_reconstruct_nostate.<locals>.C.__reduce__N)rrrr3r)rrrr�srr)r rrr
r!r_)rrrr)rr�test_reconstruct_nostate�s		z!TestCopy.test_reconstruct_nostatecs�G�fdd�dt����}dg|_tj|�}|j||�tj|�}|j||�|j|j|j�dS)Ncs.eZdZ�fdd�Zdd�ZdS)z*TestCopy.test_reconstruct_state.<locals>.Ccs�f|jfS)N)�__dict__)r)rrrr3�sz5TestCopy.test_reconstruct_state.<locals>.C.__reduce__cSs|j|jkS)N)r�)rrSrrrrT�sz1TestCopy.test_reconstruct_state.<locals>.C.__eq__N)rrrr3rTr)rrrr�srr)r rrrr_ra)rrrr)rr�test_reconstruct_state�s	zTestCopy.test_reconstruct_statecs�G�fdd�dt����}dg|_tj|�}|j||�tj|�}|j||�|j|j|j�dS)Ncs:eZdZ�fdd�Zdd�Zdd�ZdS)z3TestCopy.test_reconstruct_state_setstate.<locals>.Ccs�f|jfS)N)r�)r)rrrr3�sz>TestCopy.test_reconstruct_state_setstate.<locals>.C.__reduce__cSs|jj|�dS)N)r��update)rr[rrrr\�sz@TestCopy.test_reconstruct_state_setstate.<locals>.C.__setstate__cSs|j|jkS)N)r�)rrSrrrrTsz:TestCopy.test_reconstruct_state_setstate.<locals>.C.__eq__N)rrrr3r\rTr)rrrr�srr)r rrrr_ra)rrrr)rr�test_reconstruct_state_setstate�s	z(TestCopy.test_reconstruct_state_setstatecCs^Gdd�dt�}|�}||_tj|�}|j||�|j|j|�dS)Nc@seZdZdS)z.TestCopy.test_reconstruct_reflexive.<locals>.CN)rrrrrrrrsr)r rrr_rar
)rrrrrrr�test_reconstruct_reflexives		z#TestCopy.test_reconstruct_reflexivecs�G�fdd�dt���ddgdg�}tj|�}|j||�|j||�|j|d|d�tj|�}|j||�|j||�|j|d|d�dS)Ncs.eZdZ�fdd�Zdd�ZdS)z&TestCopy.test_reduce_4tuple.<locals>.Ccs�f|jt|�fS)N)r��iter)r)rrrr3sz1TestCopy.test_reduce_4tuple.<locals>.C.__reduce__cSs(t|�t|�ko'|j|jkS)N)�listr�)rrSrrrrTsz-TestCopy.test_reduce_4tuple.<locals>.C.__eq__N)rrrr3rTr)rrrrsrr,rArNr)r�rrrar
r_)rrrr)rr�test_reduce_4tupleszTestCopy.test_reduce_4tuplecs�G�fdd�dt���dddgfdg�}tj|�}|j||�|j||�|j|d|d�tj|�}|j||�|j||�|j|d|d�dS)	Ncs.eZdZ�fdd�Zdd�ZdS)z&TestCopy.test_reduce_5tuple.<locals>.Ccs�f|jd|j�fS)N)r��items)r)rrrr3)sz1TestCopy.test_reduce_5tuple.<locals>.C.__reduce__cSs(t|�t|�ko'|j|jkS)N)�dictr�)rrSrrrrT+sz-TestCopy.test_reduce_5tuple.<locals>.C.__eq__N)rrrr3rTr)rrrr(srrr,rArQrN)zbarrN)r�rrrar
r_)rrrr)rr�test_reduce_5tuple'szTestCopy.test_reduce_5tuplecCsTGdd�dt�}|�}dg|_tj|�}|j|j|j�dS)Nc@seZdZdgZdS)z#TestCopy.test_copy_slots.<locals>.CrN)rrr�	__slots__rrrrr9srr)r rrr
)rrrrrrr�test_copy_slots8s
	zTestCopy.test_copy_slotscCsjGdd�dt�}|�}dg|_tj|�}|j|j|j�|j|j|j�dS)Nc@seZdZdgZdS)z'TestCopy.test_deepcopy_slots.<locals>.CrN)rrrr�rrrrrAsrr)r rrr_rra)rrrrrrr�test_deepcopy_slots@s	zTestCopy.test_deepcopy_slotscCs�Gdd�dt�}|didd6�}tj|�}|j||�|j|j|j�|j||�d|d<|j||�|j|j|j�dS)Ncs7eZdZd�fdd�Z�fdd�Z�S)z/TestCopy.test_deepcopy_dict_subclass.<locals>.CNcs8|si}nt|j��|_t�j|�dS)N)r��keys�_keys�superr)r�d)r!rrrKs	z8TestCopy.test_deepcopy_dict_subclass.<locals>.C.__init__cs9t�j||�||jkr5|jj|�ndS)N)r��__setitem__r�r.)r�key�item)r!rrr�Psz;TestCopy.test_deepcopy_dict_subclass.<locals>.C.__setitem__)rrrrr�rr)r!rrJsrr�rrr,rQ)r�rr_rr�ra�assertNotEqual)rrrrrrr�test_deepcopy_dict_subclassIs

z$TestCopy.test_deepcopy_dict_subclasscCs�Gdd�dt�}|ddgdg�}ddg|_tj|�}|jt|�t|��|j|j|j�|j|d|d�|j|j|j�dS)	Nc@seZdZdS)z+TestCopy.test_copy_list_subclass.<locals>.CN)rrrrrrrr^srr,rArNr�r)r�rrrr
)rrrrrrr�test_copy_list_subclass]sz TestCopy.test_copy_list_subclasscCs�Gdd�dt�}|ddgdg�}ddg|_tj|�}|jt|�t|��|j|j|j�|j|d|d�|j|j|j�dS)	Nc@seZdZdS)z/TestCopy.test_deepcopy_list_subclass.<locals>.CN)rrrrrrrrisrr,rArNrr�r)r�rrr_rra)rrrrrrr�test_deepcopy_list_subclasshsz$TestCopy.test_deepcopy_list_subclasscCsjGdd�dt�}|dddg�}|jt|�d�tj|�}|jt|�d�dS)Nc@seZdZdS)z,TestCopy.test_copy_tuple_subclass.<locals>.CN)rrrrrrrrtsrr,rArN)r,rArN)r,rArN)�tuplerr)rrrrrrr�test_copy_tuple_subclassss
z!TestCopy.test_copy_tuple_subclasscCs�Gdd�dt�}|ddgdg�}|jt|�ddgdf�tj|�}|jt|�ddgdf�|j||�|j|d|d�dS)Nc@seZdZdS)z0TestCopy.test_deepcopy_tuple_subclass.<locals>.CN)rrrrrrrr|srr,rArNr)r�rrr_ra)rrrrrrr�test_deepcopy_tuple_subclass{s""z%TestCopy.test_deepcopy_tuple_subclasscCs3Gdd�dt�}|jttj|��dS)Nc@seZdZdd�ZdS)z-TestCopy.test_getstate_exc.<locals>.EvilStatecSstd��dS)Nzain't got no stickin' state)�
ValueError)rrrrrY�sz:TestCopy.test_getstate_exc.<locals>.EvilState.__getstate__N)rrrrYrrrr�	EvilState�sr�)r r'r�r)rr�rrr�test_getstate_exc�szTestCopy.test_getstate_exccCsg|jtjt�t�dd�}|jtj|�|�dd�}|jtj|�|�dS)NcSs||S)Nr)rrrrrr�sz(TestCopy.test_copy_function.<locals>.foocSsdS)Nrrrrr�<lambda>�sz-TestCopy.test_copy_function.<locals>.<lambda>)rr�
global_foo)rrrQrrr�test_copy_function�s
zTestCopy.test_copy_functioncCsg|jtjt�t�dd�}|jtj|�|�dd�}|jtj|�|�dS)NcSs||S)Nr)rrrrrr�sz,TestCopy.test_deepcopy_function.<locals>.foocSsdS)Nrrrrrr��sz1TestCopy.test_deepcopy_function.<locals>.<lambda>)rrr_r�)rrrQrrr�test_deepcopy_function�s
zTestCopy.test_deepcopy_functioncCsmGdd�dt�}|�}tj|�}||�}|j||�~||�}|j||�dS)Nc@seZdZdS)z"TestCopy._check_weakref.<locals>.CN)rrrrrrrr�sr)r �weakref�refr
)rZ_copyrr%rrrrr�_check_weakref�s	zTestCopy._check_weakrefcCs|jtj�dS)N)r�r)rrrr�test_copy_weakref�szTestCopy.test_copy_weakrefcCs|jtj�dS)N)r�rr_)rrrr�test_deepcopy_weakref�szTestCopy.test_deepcopy_weakrefc
sGdd�dt���fdd�td�D�\}}}}|�}|||<|||<tj|�}|j||�|j||�|j|||�|j|||�|jt|�d�~~|jt|�d�����}}	|	||<|j||�dS)Nc@seZdZdS)z(TestCopy._check_copy_weakdict.<locals>.CN)rrrrrrrr�srcsg|]}���qSrr)�.0�i)rrr�
<listcomp>�s	z1TestCopy._check_copy_weakdict.<locals>.<listcomp>rrAr,)r rJrrarrqZassertNotIn)
rZ	_dicttype�a�br0r��u�vrrr)rr�_check_copy_weakdict�s +	


zTestCopy._check_copy_weakdictcCs|jtj�dS)N)r�r��WeakKeyDictionary)rrrr�test_copy_weakkeydict�szTestCopy.test_copy_weakkeydictcCs|jtj�dS)N)r�r��WeakValueDictionary)rrrr�test_copy_weakvaluedict�sz TestCopy.test_copy_weakvaluedictcsGdd�dt���fdd�td�D�\}}}}tj�}|||<|||<tj|�}|j||�|jt|�d�|j	|||�|j	|||�|j||j
|j
�|j||j
|j
�~|jt|�d�dS)Nc@seZdZdd�ZdS)z-TestCopy.test_deepcopy_weakkeydict.<locals>.CcSs
||_dS)N)r�)rr�rrrr�sz6TestCopy.test_deepcopy_weakkeydict.<locals>.C.__init__N)rrrrrrrrr�srcsg|]}�|��qSrr)r�r�)rrrr��s	z6TestCopy.test_deepcopy_weakkeydict.<locals>.<listcomp>rrAr,)r rJr�r�rr_r�rrqrar�)rr�r�r0r�r�r�r)rr�test_deepcopy_weakkeydict�s+

z"TestCopy.test_deepcopy_weakkeydictcs[Gdd�dt���fdd�td�D�\}}}}tj�}|||<|||<tj|�}|j||�|jt|�d�t	|j
�ddd	��\\}}\}	}
|j||�|j|j|j�|j
||�|j|	|�|j|	j|j�|j
|
|�~~~	~
~|jt|�d
�dS)Nc@seZdZdd�ZdS)z/TestCopy.test_deepcopy_weakvaluedict.<locals>.CcSs
||_dS)N)r�)rr�rrrr�sz8TestCopy.test_deepcopy_weakvaluedict.<locals>.C.__init__N)rrrrrrrrr�srcsg|]}�|��qSrr)r�r�)rrrr��s	z8TestCopy.test_deepcopy_weakvaluedict.<locals>.<listcomp>rrAr�cSs|djS)Nr)r�)Zpairrrrr��sz6TestCopy.test_deepcopy_weakvaluedict.<locals>.<lambda>r,)r rJr�r�rr_r�rrq�sortedr�rar�r
)rr�r�r0r�r�r�rr�z�tr)rr�test_deepcopy_weakvaluedict�s$+

0z$TestCopy.test_deepcopy_weakvaluedictcCstGdd�dt�}|�}|j|_tj|�}|j|j|j�|j|jj|�|j�dS)Nc@seZdZdd�ZdS)z0TestCopy.test_deepcopy_bound_method.<locals>.FoocSsdS)Nr)rrrr�m�sz2TestCopy.test_deepcopy_bound_method.<locals>.Foo.mN)rrrr�rrrr�Foo�sr�)r r�r�rr_rr
�__self__)rr�r>�grrr�test_deepcopy_bound_method�s	z#TestCopy.test_deepcopy_bound_methodN)Hrrrrrr"r+r4r5r;rMrOrPrRrUrVrXrZr]r^r`rbrerhrirjrkrlrmrnrsrtrurwrxryr|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�rrrrr	s�

	





	
r	cCs||S)Nr)rrrrrr��sr�cCstjt�dS)N)rZrun_unittestr	rrrr�	test_main�sr��__main__)�__doc__rr)r�rF�operatorrrrrrrZunittestZtestrrzr{roZTestCaser	r�r�rrrrr�<module>s".
���