a 4dg@g@sdZddlZddlZddlZddlZddlmZmZmZm Z m Z m Z ddl Z eeee fZ e e fZe eZGddde jZddZedkre dS) zUnit tests for the copy module.N)leltgegteqnec@steZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3d4Zd5d6Zd7d8Zd9d:Zd;d<Z d=d>Z!d?d@Z"dAdBZ#dCdDZ$dEdFZ%dGdHZ&dIdJZ'dKdLZ(dMdNZ)dOdPZ*dQdRZ+dSdTZ,dUdVZ-dWdXZ.dYdZZ/d[d\Z0d]d^Z1d_d`Z2dadbZ3dcddZ4dedfZ5dgdhZ6didjZ7dkdlZ8dmdnZ9dodpZ:dqdrZ;dsdtZdydzZ?d{d|Z@d}d~ZAddZBddZCddZDddZEddZFddZGddZHddZIddZJddZKddZLddZMddZNddZOdS)TestCopycCs&|tjtj|ttjtdSN)assertIscopyErrorerrorZ assertTrue issubclass Exceptionselfr*/usr/local/lib/python3.9/test/test_copy.pytest_exceptionsszTestCopy.test_exceptionscCsd}t|}|||dSN*)r assertEqualrxyrrrtest_copy_basics zTestCopy.test_copy_basiccsJGfdddtd}t|}||j|j||j|jdS)Ncs eZdZddZfddZdS)z"TestCopy.test_copy_copy..CcSs ||_dSr foorrrrr__init__ sz+TestCopy.test_copy_copy..C.__init__cs |jSr rrCrr__copy__"sz+TestCopy.test_copy_copy..C.__copy__N)__name__ __module__ __qualname__rr"rr rrr!sr!r)objectr r __class__rrrr rtest_copy_copys  zTestCopy.test_copy_copycsPGdddtfdd}d}|ttj|t|t|}dS)Nc@seZdZddZdS)z&TestCopy.test_copy_registry..CcSst|}||_|Sr r&__new__rclsrobjrrrr*+s z.TestCopy.test_copy_registry..C.__new__Nr#r$r%r*rrrrr!*sr!cs |jffSr rr-r rrpickle_C/sz-TestCopy.test_copy_registry..pickle_Cr)r& assertRaises TypeErrorr copyregpicklerr0rrrr rtest_copy_registry)s  zTestCopy.test_copy_registrycsFGfdddt}g|}t|}||||dgdS)Ncs eZdZfddZddZdS)z'TestCopy.test_copy_reduce_ex..CcsddSNappendrprotocrr __reduce_ex__8s z5TestCopy.test_copy_reduce_ex..C.__reduce_ex__cSs|ddSNzshouldn't call thisZfailrrrr __reduce__;sz2TestCopy.test_copy_reduce_ex..C.__reduce__Nr#r$r%r@rCrr>rrr!7s r!r8r&r r rrr!rrrr>rtest_copy_reduce_ex6s   zTestCopy.test_copy_reduce_excsFGfdddt}g|}t|}||||dgdS)NcseZdZfddZdS)z$TestCopy.test_copy_reduce..CcsddSr7r:rr>rrrCEs z/TestCopy.test_copy_reduce..C.__reduce__Nr#r$r%rCrr>rrr!Dsr!r8rErFrr>rtest_copy_reduceCs   zTestCopy.test_copy_reducecCs,Gdddt}|}|tjtj|dS)Nc@seZdZddZdS)z"TestCopy.test_copy_cant..CcSs|drt|t||SNZ__reduce startswithAttributeErrorr&__getattribute__rnamerrrrNPs z3TestCopy.test_copy_cant..C.__getattribute__Nr#r$r%rNrrrrr!Osr!)r&r1r r rr!rrrrtest_copy_cantNszTestCopy.test_copy_cantcCsGddd}Gdddt}dd}Gdddtjd }dd td d d dddddd|jdttdtdtddd ||t|t g}|D]}| t ||qdS)Nc@s eZdZdS)z*TestCopy.test_copy_atomic..ClassicNr#r$r%rrrrClassicZsrUc@s eZdZdS)z+TestCopy.test_copy_atomic..NewStyleNrTrrrrNewStyle\srVcSsdSr rrrrrf^sz$TestCopy.test_copy_atomic..fc@s eZdZdS)z0TestCopy.test_copy_atomic..WithMetaclassNrTrrrr WithMetaclass`srX metaclass.rdQ @TF?hellohelloሴsworld r8) r&abcABCMetaNotImplemented__code__bytesrangeslicemaxpropertyr r )rrUrVrWrXtestsrrrrtest_copy_atomicYs zTestCopy.test_copy_atomiccCsTgd}t|}||||||g}t|}||||||dS)Nr8r[r r assertIsNotrrrrtest_copy_listjs     zTestCopy.test_copy_listcCsNd}|t||d}|t||dddgf}|t||dS)Nrnrr8r[ro)r r rrrrrtest_copy_tuplets  zTestCopy.test_copy_tuplecCsVddd}t|}||||||i}t|}||||||dS)Nr8r[rbarrprrrrtest_copy_dict|s      zTestCopy.test_copy_dictcCsVhd}t|}||||||t}t|}||||||dSN>r8r[ro)r rrqsetrrrr test_copy_sets     zTestCopy.test_copy_setcCs:thd}|t||t}|t||dSrx) frozensetr r rsrrrtest_copy_frozensets zTestCopy.test_copy_frozensetcCsVtd}t|}||||||t}t|}||||||dS)Nsabc) bytearrayr rrqrrrrtest_copy_bytearrays     zTestCopy.test_copy_bytearraycCs,Gddd}|d}|t||dS)Nc@seZdZddZddZdS)z*TestCopy.test_copy_inst_vanilla..CcSs ||_dSr rrrrrrsz3TestCopy.test_copy_inst_vanilla..C.__init__cSs |j|jkSr rrotherrrr__eq__sz1TestCopy.test_copy_inst_vanilla..C.__eq__Nr#r$r%rrrrrrr!sr!rrr rRrrrtest_copy_inst_vanillaszTestCopy.test_copy_inst_vanillacs0Gfdddd}|t||dS)Ncs(eZdZddZfddZddZdS)z'TestCopy.test_copy_inst_copy..CcSs ||_dSr rrrrrrsz0TestCopy.test_copy_inst_copy..C.__init__cs |jSr rrr rrr"sz0TestCopy.test_copy_inst_copy..C.__copy__cSs |j|jkSr rrrrrrsz.TestCopy.test_copy_inst_copy..C.__eq__N)r#r$r%rr"rrr rrr!s r!rrrsrr rtest_copy_inst_copyszTestCopy.test_copy_inst_copycCs,Gddd}|d}|t||dS)Nc@s$eZdZddZddZddZdS)z.TestCopy.test_copy_inst_getinitargs..CcSs ||_dSr rrrrrrsz7TestCopy.test_copy_inst_getinitargs..C.__init__cSs|jfSr rrrrr__getinitargs__sz>TestCopy.test_copy_inst_getinitargs..C.__getinitargs__cSs |j|jkSr rrrrrrsz5TestCopy.test_copy_inst_getinitargs..C.__eq__Nr#r$r%rrrrrrrr!sr!rrrRrrrtest_copy_inst_getinitargssz#TestCopy.test_copy_inst_getinitargscCsZGdddt}|d}t|}|||||||||||j|jdS)Nc@s$eZdZddZddZddZdS)z-TestCopy.test_copy_inst_getnewargs..CcSst|}||_|Sr intr*rr,rrrrrr*s z5TestCopy.test_copy_inst_getnewargs..C.__new__cSs|jfSr rrrrr__getnewargs__sz.C.__getnewargs__cSs |j|jkSr rrrrrrsz4TestCopy.test_copy_inst_getnewargs..C.__eq__Nr#r$r%r*rrrrrrr!sr!rrr assertIsInstancerrqrrFrrrtest_copy_inst_getnewargss     z"TestCopy.test_copy_inst_getnewargscCs\Gdddt}|dd}t|}|||||||||||j|jdS)Nc@s$eZdZddZddZddZdS)z0TestCopy.test_copy_inst_getnewargs_ex..CcSst|}||_|Sr rrrrrr*s z8TestCopy.test_copy_inst_getnewargs_ex..C.__new__cSsdd|jifSNrrrrrrr__getnewargs_ex__szBTestCopy.test_copy_inst_getnewargs_ex..C.__getnewargs_ex__cSs |j|jkSr rrrrrrsz7TestCopy.test_copy_inst_getnewargs_ex..C.__eq__Nr#r$r%r*rrrrrrr!sr!rrrrFrrrtest_copy_inst_getnewargs_exs     z%TestCopy.test_copy_inst_getnewargs_excCs,Gddd}|d}|t||dS)Nc@s$eZdZddZddZddZdS)z+TestCopy.test_copy_inst_getstate..CcSs ||_dSr rrrrrrsz4TestCopy.test_copy_inst_getstate..C.__init__cSs d|jiSNrrrrrr __getstate__sz8TestCopy.test_copy_inst_getstate..C.__getstate__cSs |j|jkSr rrrrrrsz2TestCopy.test_copy_inst_getstate..C.__eq__Nr#r$r%rrrrrrrr!sr!rrrRrrrtest_copy_inst_getstatesz TestCopy.test_copy_inst_getstatecCs,Gddd}|d}|t||dS)Nc@s$eZdZddZddZddZdS)z+TestCopy.test_copy_inst_setstate..CcSs ||_dSr rrrrrrsz4TestCopy.test_copy_inst_setstate..C.__init__cSs|d|_dSrrrstaterrr __setstate__sz8TestCopy.test_copy_inst_setstate..C.__setstate__cSs |j|jkSr rrrrrrsz2TestCopy.test_copy_inst_setstate..C.__eq__Nr#r$r%rrrrrrrr!sr!rrrRrrrtest_copy_inst_setstatesz TestCopy.test_copy_inst_setstatecCsFGddd}|d}|t|||d}|t||dS)Nc@s,eZdZddZddZddZddZd S) z4TestCopy.test_copy_inst_getstate_setstate..CcSs ||_dSr rrrrrrsz=TestCopy.test_copy_inst_getstate_setstate..C.__init__cSs|jSr rrrrrrszATestCopy.test_copy_inst_getstate_setstate..C.__getstate__cSs ||_dSr rrrrrrszATestCopy.test_copy_inst_getstate_setstate..C.__setstate__cSs |j|jkSr rrrrrrsz;TestCopy.test_copy_inst_getstate_setstate..C.__eq__Nr#r$r%rrrrrrrrr!sr!rgrrRrrr test_copy_inst_getstate_setstates  z)TestCopy.test_copy_inst_getstate_setstatecCsd}t|}|||dSr)r deepcopyrrrrrtest_deepcopy_basic s zTestCopy.test_deepcopy_basiccCsZg}||g}t|}||||||||d|d||d|ddSNrr8)r rrrqr rrrrtest_deepcopy_memos   zTestCopy.test_deepcopy_memocCs8Gdddt}Gddd|d}|t||dS)Nc@s eZdZdS)z/TestCopy.test_deepcopy_issubclass..MetaNrTrrrrMetasrc@s eZdZdS)z,TestCopy.test_deepcopy_issubclass..CNrTrrrrr! sr!rY)typerr r)rrr!rrrtest_deepcopy_issubclasssz!TestCopy.test_deepcopy_issubclasscsJGfdddtd}t|}||j|j||j|jdS)Ncs"eZdZddZdfdd ZdS)z*TestCopy.test_deepcopy_deepcopy..CcSs ||_dSr rrrrrr&sz3TestCopy.test_deepcopy_deepcopy..C.__init__Ncs |jSr rrmemor rr __deepcopy__(sz7TestCopy.test_deepcopy_deepcopy..C.__deepcopy__)N)r#r$r%rrrr rrr!%sr!r)r&r rrr'rrrr rtest_deepcopy_deepcopy$s  zTestCopy.test_deepcopy_deepcopycsPGdddtfdd}d}|ttj|t|t|}dS)Nc@seZdZddZdS)z*TestCopy.test_deepcopy_registry..CcSst|}||_|Sr r)r+rrrr*1s z2TestCopy.test_deepcopy_registry..C.__new__Nr.rrrrr!0sr!cs |jffSr rr/r rrr05sz1TestCopy.test_deepcopy_registry..pickle_Cr)r&r1r2r rr3r4r5rr rtest_deepcopy_registry/s  zTestCopy.test_deepcopy_registrycsFGfdddt}g|}t|}||||dgdS)Ncs eZdZfddZddZdS)z+TestCopy.test_deepcopy_reduce_ex..CcsddSr7r:r<r>rrr@>s z9TestCopy.test_deepcopy_reduce_ex..C.__reduce_ex__cSs|ddSrArBrrrrrCAsz6TestCopy.test_deepcopy_reduce_ex..C.__reduce__NrDrr>rrr!=s r!r8r&r rr rrFrr>rtest_deepcopy_reduce_ex<s   z TestCopy.test_deepcopy_reduce_excsFGfdddt}g|}t|}||||dgdS)NcseZdZfddZdS)z(TestCopy.test_deepcopy_reduce..CcsddSr7r:rr>rrrCKs z3TestCopy.test_deepcopy_reduce..C.__reduce__NrHrr>rrr!Jsr!r8rrFrr>rtest_deepcopy_reduceIs   zTestCopy.test_deepcopy_reducecCs,Gdddt}|}|tjtj|dS)Nc@seZdZddZdS)z&TestCopy.test_deepcopy_cant..CcSs|drt|t||SrJrKrOrrrrNVs z7TestCopy.test_deepcopy_cant..C.__getattribute__NrQrrrrr!Usr!)r&r1r r rrRrrrtest_deepcopy_cantTszTestCopy.test_deepcopy_cantcCsnGddd}Gdddt}dd}dddd d d d d dd|j||ttg}|D]}|t||qRdS)Nc@s eZdZdS)z.TestCopy.test_deepcopy_atomic..ClassicNrTrrrrrU`srUc@s eZdZdS)z/TestCopy.test_deepcopy_atomic..NewStyleNrTrrrrrVbsrVcSsdSr rrrrrrWdsz(TestCopy.test_deepcopy_atomic..frr[r\r]TFr^r_r`)r&rfrjrkr r r)rrUrVrWrlrrrrtest_deepcopy_atomic_s zTestCopy.test_deepcopy_atomiccCsFddgdg}t|}||||||||d|ddSNr8r[rorr rrrqrrrrtest_deepcopy_listls     zTestCopy.test_deepcopy_listcCsbg}||t|}tD]}|t|||q|||||d||t |ddSr) r;r r comparisonsr1RecursionErrorrqr rlenrrroprrrtest_deepcopy_reflexive_listss   z%TestCopy.test_deepcopy_reflexive_listcCsd}t|}|||dSNrr rr rrrrtest_deepcopy_empty_tuple}s z"TestCopy.test_deepcopy_empty_tuplecCsFddgdf}t|}||||||||d|ddSrrrrrrtest_deepcopy_tuples     zTestCopy.test_deepcopy_tuplecCsd}t|}|||dS)N)r8r[rorrrrr!test_deepcopy_tuple_of_immutabless z*TestCopy.test_deepcopy_tuple_of_immutablescCspgf}|d|t|}tD]}|t|||q"|||||d|d||dd|dSNr)r;r rrr1rrqr rrrrtest_deepcopy_reflexive_tuples  z&TestCopy.test_deepcopy_reflexive_tuplecCsHddgdd}t|}||||||||d|ddS)Nr8r[rorurrrrrrtest_deepcopy_dicts    zTestCopy.test_deepcopy_dictcCszi}||d<t|}tD]}|t|||qtD]}|t|||q4|||||d|| t |ddS)Nrr8) r rorder_comparisonsr1r2equality_comparisonsrrqr rrrrrrtest_deepcopy_reflexive_dicts  z%TestCopy.test_deepcopy_reflexive_dictcCs0i}g}t||}||t|d|dSr)r rr idrrrrrrrtest_deepcopy_keepalives z TestCopy.test_deepcopy_keepalivecCsji}gd}t||}||||t|di}dg}t||}||||t|ddS)N)r8r[ror[r)r rrrrrrr!test_deepcopy_dont_memo_immutables    z*TestCopy.test_deepcopy_dont_memo_immutablecCsBGddd}|dg}t|}|||||j|jdS)Nc@seZdZddZddZdS)z.TestCopy.test_deepcopy_inst_vanilla..CcSs ||_dSr rrrrrrsz7TestCopy.test_deepcopy_inst_vanilla..C.__init__cSs |j|jkSr rrrrrrsz5TestCopy.test_deepcopy_inst_vanilla..C.__eq__Nrrrrrr!sr!rr rrrqrrFrrrtest_deepcopy_inst_vanillas    z#TestCopy.test_deepcopy_inst_vanillacsRGfddddg}t|}||||||||j|jdS)Ncs(eZdZddZfddZddZdS)z/TestCopy.test_deepcopy_inst_deepcopy..CcSs ||_dSr rrrrrrsz8TestCopy.test_deepcopy_inst_deepcopy..C.__init__cst|j|Sr )r rrrr rrrsz.C.__deepcopy__cSs |j|jkSr rrrrrrsz6TestCopy.test_deepcopy_inst_deepcopy..C.__eq__N)r#r$r%rrrrr rrr!s r!rrrrr rtest_deepcopy_inst_deepcopys     z$TestCopy.test_deepcopy_inst_deepcopycCsNGddd}|dg}t|}||||||||j|jdS)Nc@s$eZdZddZddZddZdS)z2TestCopy.test_deepcopy_inst_getinitargs..CcSs ||_dSr rrrrrrsz;TestCopy.test_deepcopy_inst_getinitargs..C.__init__cSs|jfSr rrrrrrszBTestCopy.test_deepcopy_inst_getinitargs..C.__getinitargs__cSs |j|jkSr rrrrrrsz9TestCopy.test_deepcopy_inst_getinitargs..C.__eq__Nrrrrrr!sr!rrrFrrrtest_deepcopy_inst_getinitargss     z'TestCopy.test_deepcopy_inst_getinitargscCslGdddt}|dg}t|}|||||||||||j|j||j|jdS)Nc@s$eZdZddZddZddZdS)z1TestCopy.test_deepcopy_inst_getnewargs..CcSst|}||_|Sr rrrrrr*s z9TestCopy.test_deepcopy_inst_getnewargs..C.__new__cSs|jfSr rrrrrrsz@TestCopy.test_deepcopy_inst_getnewargs..C.__getnewargs__cSs |j|jkSr rrrrrrsz8TestCopy.test_deepcopy_inst_getnewargs..C.__eq__Nrrrrrr!sr!rrr rrrrqrrFrrrtest_deepcopy_inst_getnewargss     z&TestCopy.test_deepcopy_inst_getnewargscCsnGdddt}|dgd}t|}|||||||||||j|j||j|jdS)Nc@s$eZdZddZddZddZdS)z4TestCopy.test_deepcopy_inst_getnewargs_ex..CcSst|}||_|Sr rrrrrr*s z.C.__new__cSsdd|jifSrrrrrrrszFTestCopy.test_deepcopy_inst_getnewargs_ex..C.__getnewargs_ex__cSs |j|jkSr rrrrrrsz;TestCopy.test_deepcopy_inst_getnewargs_ex..C.__eq__Nrrrrrr!sr!rrrrFrrr test_deepcopy_inst_getnewargs_exs     z)TestCopy.test_deepcopy_inst_getnewargs_excCsNGddd}|dg}t|}||||||||j|jdS)Nc@s$eZdZddZddZddZdS)z/TestCopy.test_deepcopy_inst_getstate..CcSs ||_dSr rrrrrr sz8TestCopy.test_deepcopy_inst_getstate..C.__init__cSs d|jiSrrrrrrrsz.C.__getstate__cSs |j|jkSr rrrrrrsz6TestCopy.test_deepcopy_inst_getstate..C.__eq__Nrrrrrr! sr!rrrFrrrtest_deepcopy_inst_getstate s     z$TestCopy.test_deepcopy_inst_getstatecCsNGddd}|dg}t|}||||||||j|jdS)Nc@s$eZdZddZddZddZdS)z/TestCopy.test_deepcopy_inst_setstate..CcSs ||_dSr rrrrrrsz8TestCopy.test_deepcopy_inst_setstate..C.__init__cSs|d|_dSrrrrrrrsz.C.__setstate__cSs |j|jkSr rrrrrrsz6TestCopy.test_deepcopy_inst_setstate..C.__eq__Nrrrrrr!sr!rrrFrrrtest_deepcopy_inst_setstates     z$TestCopy.test_deepcopy_inst_setstatecCsGddd}|dg}t|}||||||||j|j|g}t|}||||||||j|jdS)Nc@s,eZdZddZddZddZddZd S) z8TestCopy.test_deepcopy_inst_getstate_setstate..CcSs ||_dSr rrrrrr)szATestCopy.test_deepcopy_inst_getstate_setstate..C.__init__cSs|jSr rrrrrr+szETestCopy.test_deepcopy_inst_getstate_setstate..C.__getstate__cSs ||_dSr rrrrrr-szETestCopy.test_deepcopy_inst_getstate_setstate..C.__setstate__cSs |j|jkSr rrrrrr/sz?TestCopy.test_deepcopy_inst_getstate_setstate..C.__eq__Nrrrrrr!(sr!rrrFrrr$test_deepcopy_inst_getstate_setstate's       z-TestCopy.test_deepcopy_inst_getstate_setstatecCsBGddd}|}||_t|}|||||j|dS)Nc@s eZdZdS)z0TestCopy.test_deepcopy_reflexive_inst..CNrTrrrrr!>sr!)rr rrqr rFrrrtest_deepcopy_reflexive_inst=s   z%TestCopy.test_deepcopy_reflexive_instcCspGdddt}t|d}t|}||||||||j|j||j|j||j|dS)Nc@s eZdZdS)z'TestCopy.test_deepcopy_range..INrTrrrrIGsrrb)rrhr rrqrstopr)rrrrrrrtest_deepcopy_rangeFs    zTestCopy.test_deepcopy_rangecCsFGdddt}|}t|}|||t|}|||dS)Nc@seZdZddZdS)z+TestCopy.test_reconstruct_string..CcSsdS)Nr9rrrrrrCUsz6TestCopy.test_reconstruct_string..C.__reduce__NrHrrrrr!Tsr!)r&r r rrFrrrtest_reconstruct_stringSs    z TestCopy.test_reconstruct_stringcsXGfdddt}d|_t|}||j|jt|}||j|jdS)NcseZdZfddZdS)z,TestCopy.test_reconstruct_nostate..CcsdfSrrrr rrrC_sz7TestCopy.test_reconstruct_nostate..C.__reduce__NrHrr rrr!^sr!r)r&rr r r'rrrr rtest_reconstruct_nostate]s  z!TestCopy.test_reconstruct_nostatecsbGfdddt}dg|_t|}|||t|}|||||j|jdS)Ncs eZdZfddZddZdS)z*TestCopy.test_reconstruct_state..Ccs d|jfSr__dict__rr rrrCjsz5TestCopy.test_reconstruct_state..C.__reduce__cSs |j|jkSr rrrrrrlsz1TestCopy.test_reconstruct_state..C.__eq__Nr#r$r%rCrrr rrr!is r!rr&rr rrrqrrr rtest_reconstruct_statehs    zTestCopy.test_reconstruct_statecsbGfdddt}dg|_t|}|||t|}|||||j|jdS)Ncs(eZdZfddZddZddZdS)z3TestCopy.test_reconstruct_state_setstate..Ccs d|jfSrrrr rrrCxsz>TestCopy.test_reconstruct_state_setstate..C.__reduce__cSs|j|dSr )rupdaterrrrrzsz@TestCopy.test_reconstruct_state_setstate..C.__setstate__cSs |j|jkSr rrrrrr|sz:TestCopy.test_reconstruct_state_setstate..C.__eq__N)r#r$r%rCrrrr rrr!ws r!rrrrr rtest_reconstruct_state_setstatevs    z(TestCopy.test_reconstruct_state_setstatecCsDGdddt}|}||_t|}|||||j|dS)Nc@s eZdZdS)z.TestCopy.test_reconstruct_reflexive..CNrTrrrrr!sr!)r&rr rrqr rFrrrtest_reconstruct_reflexives   z#TestCopy.test_reconstruct_reflexivecsGfdddtddgdg}t|}||||||||d|dt|}||||||||d|ddS)Ncs eZdZfddZddZdS)z&TestCopy.test_reduce_4tuple..Ccsd|jt|fSr)riterrr rrrCsz1TestCopy.test_reduce_4tuple..C.__reduce__cSst|t|ko|j|jkSr )listrrrrrrs z-TestCopy.test_reduce_4tuple..C.__eq__Nrrr rrr!s r!r8r[ror)rr rrqr rrrr rtest_reduce_4tuples      zTestCopy.test_reduce_4tuplecsGfdddtdddgfdg}t|}||||||||d|dt|}||||||||d|ddS)Ncs eZdZfddZddZdS)z&TestCopy.test_reduce_5tuple..Ccsd|jd|fSr)ritemsrr rrrCsz1TestCopy.test_reduce_5tuple..C.__reduce__cSst|t|ko|j|jkSr )dictrrrrrrs z-TestCopy.test_reduce_5tuple..C.__eq__Nrrr rrr!s r!rr8r[)rvro)rr rrqr rrrr rtest_reduce_5tuples      zTestCopy.test_reduce_5tuplecCs<Gdddt}|}dg|_t|}||j|jdS)Nc@seZdZdgZdS)z#TestCopy.test_copy_slots..CrNr#r$r% __slots__rrrrr!sr!r)r&rr r rFrrrtest_copy_slotss  zTestCopy.test_copy_slotscCsLGdddt}|}dg|_t|}||j|j||j|jdS)Nc@seZdZdgZdS)z'TestCopy.test_deepcopy_slots..CrNrrrrrr!sr!r)r&rr rrrqrFrrrtest_deepcopy_slotss  zTestCopy.test_deepcopy_slotscCsxGdddt}|ddid}t|}|||||j|j|||d|d<|||||j|jdS)Ncs*eZdZdfdd ZfddZZS)z/TestCopy.test_deepcopy_dict_subclass..CNcs&|si}t||_t|dSr )rkeys_keyssuperr)rdr'rrrsz8TestCopy.test_deepcopy_dict_subclass..C.__init__cs(t||||jvr$|j|dSr )r __setitem__rr;)rkeyitemrrrrs z;TestCopy.test_deepcopy_dict_subclass..C.__setitem__)N)r#r$r%rr __classcell__rrrrr!sr!rr)rr8rv)rr rrrrqassertNotEqualrFrrrtest_deepcopy_dict_subclasss     z$TestCopy.test_deepcopy_dict_subclasscCsGdddt}|ddgdg}ddg|_t|}|t|t|||j|j||d|d||j|jdS) Nc@s eZdZdS)z+TestCopy.test_copy_list_subclass..CNrTrrrrr!sr!r8r[rorr)rrr rr rFrrrtest_copy_list_subclasss  z TestCopy.test_copy_list_subclasscCsGdddt}|ddgdg}ddg|_t|}|t|t|||j|j||d|d||j|jdS) Nc@s eZdZdS)z/TestCopy.test_deepcopy_list_subclass..CNrTrrrrr!sr!r8r[rorrr)rrr rrrqrFrrrtest_deepcopy_list_subclasss  z$TestCopy.test_deepcopy_list_subclasscCsJGdddt}|gd}|t|dt|}|t|ddS)Nc@s eZdZdS)z,TestCopy.test_copy_tuple_subclass..CNrTrrrrr!sr!rn)tuplerr rFrrrtest_copy_tuple_subclasss   z!TestCopy.test_copy_tuple_subclasscCs~Gdddt}|ddgdg}|t|ddgdft|}|t|ddgdf|||||d|ddS)Nc@s eZdZdS)z0TestCopy.test_deepcopy_tuple_subclass..CNrTrrrrr!sr!r8r[ror)rrr rrqrFrrrtest_deepcopy_tuple_subclasss  z%TestCopy.test_deepcopy_tuple_subclasscCs&Gdddt}|ttj|dS)Nc@seZdZddZdS)z-TestCopy.test_getstate_exc..EvilStatecSs tddS)Nzain't got no stickin' state) ValueErrorrrrrrsz:TestCopy.test_getstate_exc..EvilState.__getstate__N)r#r$r%rrrrr EvilStatesr)r&r1rr )rrrrrtest_getstate_excszTestCopy.test_getstate_exccCsJ|tttdd}|t||dd}|t||dS)NcSs||Sr rrrrrrrz(TestCopy.test_copy_function..foocSsdSr rrrrr rz-TestCopy.test_copy_function..)rr global_foorrrvrrrtest_copy_functions zTestCopy.test_copy_functioncCsJ|tttdd}|t||dd}|t||dS)NcSs||Sr rrrrrrrz,TestCopy.test_deepcopy_function..foocSsdSr rrrrrrrz1TestCopy.test_deepcopy_function..)rr rrrrrrtest_deepcopy_function s zTestCopy.test_deepcopy_functioncCsNGdddt}|}t|}||}|||~||}|||dS)Nc@s eZdZdS)z"TestCopy._check_weakref..CNrTrrrrr!sr!)r&weakrefrefr )rZ_copyr!r-rrrrr_check_weakrefs  zTestCopy._check_weakrefcCs|tjdSr )r r rrrrtest_copy_weakrefszTestCopy.test_copy_weakrefcCs|tjdSr )r r rrrrrtest_deepcopy_weakref"szTestCopy.test_deepcopy_weakrefc sGdddtfddtdD\}}}}|}|||<|||<t|}|||||||||||||||t|d~~|t|d}} | ||<|||dS)Nc@s eZdZdS)z(TestCopy._check_copy_weakdict..CNrTrrrrr!&sr!csg|] }qSrr.0ir rr (rz1TestCopy._check_copy_weakdict..rr[r8)r&rhr rqrrZ assertNotIn) rZ _dicttypeabr?ruvrrrr r_check_copy_weakdict%s    zTestCopy._check_copy_weakdictcCs|tjdSr )rrWeakKeyDictionaryrrrrtest_copy_weakkeydict9szTestCopy.test_copy_weakkeydictcCs|tjdSr )rrWeakValueDictionaryrrrrtest_copy_weakvaluedict<sz TestCopy.test_copy_weakvaluedictcsGdddtfddtdD\}}}}t}|||<|||<t|}||||t|d| |||| ||||||j |j |||j |j ~|t|ddS)Nc@seZdZddZdS)z-TestCopy.test_deepcopy_weakkeydict..CcSs ||_dSr rrrrrrrAsz6TestCopy.test_deepcopy_weakkeydict..C.__init__Nr#r$r%rrrrrr!@sr!csg|] }|qSrrr r rrrCrz6TestCopy.test_deepcopy_weakkeydict..rr[r8) r&rhrrr rrrrrqr)rrrr?rrrrr rtest_deepcopy_weakkeydict?s  z"TestCopy.test_deepcopy_weakkeydictc sGdddtfddtdD\}}}}t}|||<|||<t|}||||t|dt | ddd \\}}\} } | ||||j |j | ||| | ||| j |j | | |~~~ ~ ~|t|d dS) Nc@seZdZddZdS)z/TestCopy.test_deepcopy_weakvaluedict..CcSs ||_dSr rrrrrrTsz8TestCopy.test_deepcopy_weakvaluedict..C.__init__Nrrrrrr!Ssr!csg|] }|qSrrr r rrrVrz8TestCopy.test_deepcopy_weakvaluedict..rr[cSs |djSrr)Zpairrrrr^rz6TestCopy.test_deepcopy_weakvaluedict..)rr8)r&rhrrr rrrrsortedrrqrr ) rrrr?rrrrrztrr rtest_deepcopy_weakvaluedictRs$       z$TestCopy.test_deepcopy_weakvaluedictcCsTGdddt}|}|j|_t|}||j|j||jj||dS)Nc@seZdZddZdS)z0TestCopy.test_deepcopy_bound_method..FoocSsdSr rrrrrmksz2TestCopy.test_deepcopy_bound_method..Foo.mN)r#r$r%r"rrrrFoojsr#)r&r"rr rrr __self__)rr#rWgrrrtest_deepcopy_bound_methodis z#TestCopy.test_deepcopy_bound_methodN)Pr#r$r%rrr(r6rGrIrSrmrrrtrwrzr|r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r rrrrr!r&rrrrrs                                    rcCs||Sr rrrrrrurr__main__)__doc__r r3rrcoperatorrrrrrrZunittestrrrZTestCaserrr#mainrrrrs&  l