a zeg@sdZddlZddlZddlZddlZddlmZmZmZm Z m Z m Z ddl Z ddl mZeeee fZe e fZeeZGddde jZddZed kre dS) zUnit tests for the copy module.N)leltgegteqne)supportc@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 ExceptionselfrB/opt/bitninja-python-dojo/embedded/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__r r#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_C0sz-TestCopy.test_copy_registry..pickle_Cr)r' assertRaises TypeErrorr copyregpicklerr1rrrr!rtest_copy_registry*s  zTestCopy.test_copy_registrycsFGfdddt}g|}t|}||||dgdS)Ncs eZdZfddZddZdS)z'TestCopy.test_copy_reduce_ex..CcsddSNappendrprotocrr __reduce_ex__9s z5TestCopy.test_copy_reduce_ex..C.__reduce_ex__cSs|ddSNzshouldn't call thisZfailrrrr __reduce__<sz2TestCopy.test_copy_reduce_ex..C.__reduce__Nr$r%r&rArDrr?rrr"8s r"r9r'r r rrr"rrrr?rtest_copy_reduce_ex7s   zTestCopy.test_copy_reduce_excsFGfdddt}g|}t|}||||dgdS)NcseZdZfddZdS)z$TestCopy.test_copy_reduce..CcsddSr8r;rr?rrrDFs z/TestCopy.test_copy_reduce..C.__reduce__Nr$r%r&rDrr?rrr"Esr"r9rFrGrr?rtest_copy_reduceDs   zTestCopy.test_copy_reducecCs,Gdddt}|}|tjtj|dS)Nc@seZdZddZdS)z"TestCopy.test_copy_cant..CcSs|drt|t||SNZ__reduce startswithAttributeErrorr'__getattribute__rnamerrrrOQs z3TestCopy.test_copy_cant..C.__getattribute__Nr$r%r&rOrrrrr"Psr")r'r2r r rr"rrrrtest_copy_cantOszTestCopy.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&rrrrClassic[srVc@s eZdZdS)z+TestCopy.test_copy_atomic..NewStyleNrUrrrrNewStyle]srWcSsdSr rrrrrf_sz$TestCopy.test_copy_atomic..fc@s eZdZdS)z0TestCopy.test_copy_atomic..WithMetaclassNrUrrrr WithMetaclassasrY metaclass.rdQ @TF?hellohelloሴsworld r9) r'abcABCMetaNotImplemented__code__bytesrangeslicemaxpropertyr r )rrVrWrXrYtestsrrrrtest_copy_atomicZs zTestCopy.test_copy_atomiccCsTgd}t|}||||||g}t|}||||||dS)Nr9r\r r assertIsNotrrrrtest_copy_listks     zTestCopy.test_copy_listcCsNd}|t||d}|t||dddgf}|t||dS)Nrorr9r\rp)r r rrrrrtest_copy_tupleus  zTestCopy.test_copy_tuplecCsVddd}t|}||||||i}t|}||||||dS)Nr9r\rbarrqrrrrtest_copy_dict}s      zTestCopy.test_copy_dictcCsVhd}t|}||||||t}t|}||||||dSN>r9r\rp)r rrrsetrrrr test_copy_sets     zTestCopy.test_copy_setcCs:thd}|t||t}|t||dSry) frozensetr r rtrrrtest_copy_frozensets zTestCopy.test_copy_frozensetcCsVtd}t|}||||||t}t|}||||||dS)Nsabc) bytearrayr rrrrrrrtest_copy_bytearrays     zTestCopy.test_copy_bytearraycCs,Gddd}|d}|t||dS)Nc@seZdZddZddZdS)z*TestCopy.test_copy_inst_vanilla..CcSs ||_dSr rrrrrr sz3TestCopy.test_copy_inst_vanilla..C.__init__cSs |j|jkSr rrotherrrr__eq__sz1TestCopy.test_copy_inst_vanilla..C.__eq__Nr$r%r&r rrrrrr"sr"rrr rSrrrtest_copy_inst_vanillaszTestCopy.test_copy_inst_vanillacs0Gfdddd}|t||dS)Ncs(eZdZddZfddZddZdS)z'TestCopy.test_copy_inst_copy..CcSs ||_dSr rrrrrr sz0TestCopy.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&r r#rrr!rrr"s r"rrrtrr!rtest_copy_inst_copyszTestCopy.test_copy_inst_copycCs,Gddd}|d}|t||dS)Nc@s$eZdZddZddZddZdS)z.TestCopy.test_copy_inst_getinitargs..CcSs ||_dSr rrrrrr sz7TestCopy.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&r rrrrrrr"sr"rrrSrrrtest_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 assertIsInstancerrrrrGrrrtest_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"rrrrGrrrtest_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 rrrrrr sz4TestCopy.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&r rrrrrrr"sr"rrrSrrrtest_copy_inst_getstatesz TestCopy.test_copy_inst_getstatecCs,Gddd}|d}|t||dS)Nc@s$eZdZddZddZddZdS)z+TestCopy.test_copy_inst_setstate..CcSs ||_dSr rrrrrr sz4TestCopy.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&r rrrrrrr"sr"rrrSrrrtest_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 rrrrrr sz=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&r rrrrrrrr"sr"rgrrSrrr 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|ddSNrr9)r rrrrr rrrrtest_deepcopy_memos   zTestCopy.test_deepcopy_memocCs8Gdddt}Gddd|d}|t||dS)Nc@s eZdZdS)z/TestCopy.test_deepcopy_issubclass..MetaNrUrrrrMetasrc@s eZdZdS)z,TestCopy.test_deepcopy_issubclass..CNrUrrrrr"!sr"rZ)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&r rrr!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+2s z2TestCopy.test_deepcopy_registry..C.__new__Nr/rrrrr"1sr"cs |jffSr rr0r!rrr16sz1TestCopy.test_deepcopy_registry..pickle_Cr)r'r2r3r rr4r5r6rr!rtest_deepcopy_registry0s  zTestCopy.test_deepcopy_registrycsFGfdddt}g|}t|}||||dgdS)Ncs eZdZfddZddZdS)z+TestCopy.test_deepcopy_reduce_ex..CcsddSr8r;r=r?rrrA?s z9TestCopy.test_deepcopy_reduce_ex..C.__reduce_ex__cSs|ddSrBrCrrrrrDBsz6TestCopy.test_deepcopy_reduce_ex..C.__reduce__NrErr?rrr">s r"r9r'r rr rrGrr?rtest_deepcopy_reduce_ex=s   z TestCopy.test_deepcopy_reduce_excsFGfdddt}g|}t|}||||dgdS)NcseZdZfddZdS)z(TestCopy.test_deepcopy_reduce..CcsddSr8r;rr?rrrDLs z3TestCopy.test_deepcopy_reduce..C.__reduce__NrIrr?rrr"Ksr"r9rrGrr?rtest_deepcopy_reduceJs   zTestCopy.test_deepcopy_reducecCs,Gdddt}|}|tjtj|dS)Nc@seZdZddZdS)z&TestCopy.test_deepcopy_cant..CcSs|drt|t||SrKrLrPrrrrOWs z7TestCopy.test_deepcopy_cant..C.__getattribute__NrRrrrrr"Vsr")r'r2r r rrSrrrtest_deepcopy_cantUszTestCopy.test_deepcopy_cantcCsnGddd}Gdddt}dd}dddd d d d d dd|j||ttg}|D]}|t||qRdS)Nc@s eZdZdS)z.TestCopy.test_deepcopy_atomic..ClassicNrUrrrrrVasrVc@s eZdZdS)z/TestCopy.test_deepcopy_atomic..NewStyleNrUrrrrrWcsrWcSsdSr rrrrrrXesz(TestCopy.test_deepcopy_atomic..frr\r]r^TFr_r`ra)r'rgrkrlr r r)rrVrWrXrmrrrrtest_deepcopy_atomic`s zTestCopy.test_deepcopy_atomiccCsFddgdg}t|}||||||||d|ddSNr9r\rprr rrrrrrrrtest_deepcopy_listms     zTestCopy.test_deepcopy_listcCsbg}||t|}tD]}|t|||q|||||d||t |ddSr) r<r r comparisonsr2RecursionErrorrrr rlenrrroprrrtest_deepcopy_reflexive_listts   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)r9r\rprrrrr!test_deepcopy_tuple_of_immutabless z*TestCopy.test_deepcopy_tuple_of_immutablescCspgf}|d|t|}tD]}|t|||q"|||||d|d||dd|dSNr)r<r rrr2rrrr rrrrtest_deepcopy_reflexive_tuples  z&TestCopy.test_deepcopy_reflexive_tuplecCsHddgdd}t|}||||||||d|ddS)Nr9r\rprvrrrrrrtest_deepcopy_dicts    zTestCopy.test_deepcopy_dictcCszi}||d<t|}tD]}|t|||qtD]}|t|||q4|||||d|| t |ddS)Nrr9) r rorder_comparisonsr2r3equality_comparisonsrrrr 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)r9r\rpr\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 rrrrrr sz7TestCopy.test_deepcopy_inst_vanilla..C.__init__cSs |j|jkSr rrrrrrsz5TestCopy.test_deepcopy_inst_vanilla..C.__eq__Nrrrrrr"sr"rr rrrrrrGrrrtest_deepcopy_inst_vanillas    z#TestCopy.test_deepcopy_inst_vanillacsRGfddddg}t|}||||||||j|jdS)Ncs(eZdZddZfddZddZdS)z/TestCopy.test_deepcopy_inst_deepcopy..CcSs ||_dSr rrrrrr sz8TestCopy.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&r rrrr!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 rrrrrr sz;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"rrrGrrrtest_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 rrrrrrrGrrrtest_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"rrrrGrrr 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"rrrGrrrtest_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 rrrrrr sz8TestCopy.test_deepcopy_inst_setstate..C.__init__cSs|d|_dSrrrrrrrsz.C.__setstate__cSs |j|jkSr rrrrrr sz6TestCopy.test_deepcopy_inst_setstate..C.__eq__Nrrrrrr"sr"rrrGrrrtest_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 rrrrrr0sz?TestCopy.test_deepcopy_inst_getstate_setstate..C.__eq__Nrrrrrr")sr"rrrGrrr$test_deepcopy_inst_getstate_setstate(s       z-TestCopy.test_deepcopy_inst_getstate_setstatecCsBGddd}|}||_t|}|||||j|dS)Nc@s eZdZdS)z0TestCopy.test_deepcopy_reflexive_inst..CNrUrrrrr"?sr")rr rrrr rGrrrtest_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..INrUrrrrIHsrrc)rrir rrrrstopr)rrrrrrrtest_deepcopy_rangeGs    zTestCopy.test_deepcopy_rangecCsFGdddt}|}t|}|||t|}|||dS)Nc@seZdZddZdS)z+TestCopy.test_reconstruct_string..CcSsdS)Nr:rrrrrrDVsz6TestCopy.test_reconstruct_string..C.__reduce__NrIrrrrr"Usr")r'r r rrGrrrtest_reconstruct_stringTs    z TestCopy.test_reconstruct_stringcsXGfdddt}d|_t|}||j|jt|}||j|jdS)NcseZdZfddZdS)z,TestCopy.test_reconstruct_nostate..CcsdfSrrrr!rrrD`sz7TestCopy.test_reconstruct_nostate..C.__reduce__NrIrr!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!rrrDksz5TestCopy.test_reconstruct_state..C.__reduce__cSs |j|jkSr rrrrrrmsz1TestCopy.test_reconstruct_state..C.__eq__Nr$r%r&rDrrr!rrr"js r"rr'rr rrrrrrr!rtest_reconstruct_stateis    zTestCopy.test_reconstruct_statecsbGfdddt}dg|_t|}|||t|}|||||j|jdS)Ncs(eZdZfddZddZddZdS)z3TestCopy.test_reconstruct_state_setstate..Ccs d|jfSrrrr!rrrDysz>TestCopy.test_reconstruct_state_setstate..C.__reduce__cSs|j|dSr )rupdaterrrrr{sz@TestCopy.test_reconstruct_state_setstate..C.__setstate__cSs |j|jkSr rrrrrr}sz:TestCopy.test_reconstruct_state_setstate..C.__eq__N)r$r%r&rDrrrr!rrr"xs r"rrrrr!rtest_reconstruct_state_setstatews    z(TestCopy.test_reconstruct_state_setstatecCsDGdddt}|}||_t|}|||||j|dS)Nc@s eZdZdS)z.TestCopy.test_reconstruct_reflexive..CNrUrrrrr"sr")r'rr rrrr rGrrrtest_reconstruct_reflexives   z#TestCopy.test_reconstruct_reflexivecsGfdddtddgdg}t|}||||||||d|dt|}||||||||d|ddS)Ncs eZdZfddZddZdS)z&TestCopy.test_reduce_4tuple..Ccsd|jt|fSr)riterrr!rrrDsz1TestCopy.test_reduce_4tuple..C.__reduce__cSst|t|ko|j|jkSr )listrrrrrrs z-TestCopy.test_reduce_4tuple..C.__eq__Nrrr!rrr"s r"r9r\rpr)rr rrrr rrrr!rtest_reduce_4tuples      zTestCopy.test_reduce_4tuplecsGfdddtdddgfdg}t|}||||||||d|dt|}||||||||d|ddS)Ncs eZdZfddZddZdS)z&TestCopy.test_reduce_5tuple..Ccsd|jd|fSr)ritemsrr!rrrDsz1TestCopy.test_reduce_5tuple..C.__reduce__cSst|t|ko|j|jkSr )dictrrrrrrs z-TestCopy.test_reduce_5tuple..C.__eq__Nrrr!rrr"s r"rr9r\)rwrp)rr rrrr 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 rGrrrtest_copy_slotss  zTestCopy.test_copy_slotscCsLGdddt}|}dg|_t|}||j|j||j|jdS)Nc@seZdZdgZdS)z'TestCopy.test_deepcopy_slots..CrNrrrrrr"sr"r)r'rr rrrrrGrrrtest_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(rrr sz8TestCopy.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&r r __classcell__rrrrr"sr"rr)rr9rw)rr rrrrrassertNotEqualrGrrrtest_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..CNrUrrrrr"sr"r9r\rprr)rrr rr rGrrrtest_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..CNrUrrrrr"sr"r9r\rprrr)rrr rrrrrGrrrtest_deepcopy_list_subclasss  z$TestCopy.test_deepcopy_list_subclasscCsJGdddt}|gd}|t|dt|}|t|ddS)Nc@s eZdZdS)z,TestCopy.test_copy_tuple_subclass..CNrUrrrrr"sr"ro)tuplerr rGrrrtest_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..CNrUrrrrr"sr"r9r\rpr)rrr rrrrGrrrtest_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'r2rr )rrrrrtest_getstate_excszTestCopy.test_getstate_exccCsJ|tttdd}|t||dd}|t||dS)NcSs||Sr rrrrrrr z(TestCopy.test_copy_function..foocSsdSr rrrrr rz-TestCopy.test_copy_function..)rr global_foorrrwrrrtest_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_functions zTestCopy.test_deepcopy_functioncCsNGdddt}|}t|}||}|||~||}|||dS)Nc@s eZdZdS)z"TestCopy._check_weakref..CNrUrrrrr"sr")r'weakrefrefr )rZ_copyr"r.rrrrr_check_weakrefs  zTestCopy._check_weakrefcCs|tjdSr )r r rrrrtest_copy_weakref szTestCopy.test_copy_weakrefcCs|tjdSr )r r rrrrrtest_deepcopy_weakref#szTestCopy.test_deepcopy_weakrefc sGdddtfddtdD\}}}}|}|||<|||<t|}|||||||||||||||t|d~~t|t|d}} | ||<|||dS)Nc@s eZdZdS)z(TestCopy._check_copy_weakdict..CNrUrrrrr"'sr"csg|] }qSrr.0ir!rr )rz1TestCopy._check_copy_weakdict..rr\r9) r'rir rrrrr gc_collectZ assertNotIn) rZ _dicttypeabr@ruvrrrr!r_check_copy_weakdict&s"   zTestCopy._check_copy_weakdictcCs|tjdSr )rr WeakKeyDictionaryrrrrtest_copy_weakkeydict;szTestCopy.test_copy_weakkeydictcCs|tjdSr )rr WeakValueDictionaryrrrrtest_copy_weakvaluedict>sz TestCopy.test_copy_weakvaluedictcsGdddtfddtdD\}}}}t}|||<|||<t|}||||t|d| |||| ||||||j |j |||j |j ~t |t|ddS)Nc@seZdZddZdS)z-TestCopy.test_deepcopy_weakkeydict..CcSs ||_dSr rrrrrrr Csz6TestCopy.test_deepcopy_weakkeydict..C.__init__Nr$r%r&r rrrrr"Bsr"csg|] }|qSrrrr!rrrErz6TestCopy.test_deepcopy_weakkeydict..rr\r9) r'rir rr rrrrrrrrr)rrrr@rrrrr!rtest_deepcopy_weakkeydictAs  z"TestCopy.test_deepcopy_weakkeydictc sGdddtfddtdD\}}}}t}|||<|||<t|}||||t|dt | ddd \\}}\} } | ||||j |j | ||| | ||| j |j | | |~~~ ~ ~t|t|d dS) Nc@seZdZddZdS)z/TestCopy.test_deepcopy_weakvaluedict..CcSs ||_dSr rrrrrr Wsz8TestCopy.test_deepcopy_weakvaluedict..C.__init__Nrrrrrr"Vsr"csg|] }|qSrrrr!rrrYrz8TestCopy.test_deepcopy_weakvaluedict..rr\cSs |djSrr)Zpairrrrrarz6TestCopy.test_deepcopy_weakvaluedict..)rr9)r'rir rr rrrrsortedrrrrr rr) rrrr@rrrrrztrr!rtest_deepcopy_weakvaluedictUs&       z$TestCopy.test_deepcopy_weakvaluedictcCsTGdddt}|}|j|_t|}||j|j||jj||dS)Nc@seZdZddZdS)z0TestCopy.test_deepcopy_bound_method..FoocSsdSr rrrrrmosz2TestCopy.test_deepcopy_bound_method..Foo.mN)r$r%r&r$rrrrFoonsr%)r'r$rr rrr __self__)rr%rXgrrrtest_deepcopy_bound_methodms z#TestCopy.test_deepcopy_bound_methodN)Pr$r%r&rrr)r7rHrJrTrnrsrurxr{r}rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r r rrrrr#r(rrrrr s                                    r cCs||Sr rrrrrryrr__main__)__doc__r r4r rdoperatorrrrrrrZunittesttestrrrrZTestCaser rr$mainrrrrs(   o