a ze9@sZddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl mZddlmZz ddlZWneydZYn0Gddde jZGddde jZGdd d e jZGd d d e jZGd d d e jZGddde jZGddde jZGdddeZGddde jZedkrVe dS)N)deepcopy)supportc@seZdZddZd0ddZd1d d Zd2d dZd3ddZd4ddZd5ddZ ddZ ddZ gfddZ d d!Z d"d#Zd$d%Zd&d'Zed(d)d*Zed(d+d,Zd-d.Zd/S)6 OperatorsTestcOstjj|g|Ri|ddddddddd d d d d dddddddd|_t|jD],\}}|rr|d}nd|}||j|<qXddddddd|_t|jD],\}}|r|d}nd|}||j|<qdS)N+-*@/z//divmodz**z<>&^|cmp<<===!=>>=)addsubmulmatmultruedivfloordivr powlshiftrshiftandxororrltleeqnegtgez(a, b)za %s babs~intfloat)posnegr'invertr)r*z(a)z%s a)unittestTestCase__init__binopslistitemsislowerunops)selfargskwargsnameexprr;C/opt/bitninja-python-dojo/embedded/lib/python3.9/test/test_descr.pyr0sN    zOperatorsTest.__init__len(a)__len__c Csd|i}|t|||t|}t||}||jvrB|jd}q,|t|d||j|||||t||}|||dS)Narim_func assertEqualevaltypegetattr__dict__ __bases__) r6r?resr:methdtmbmr;r;r< unop_testJs    zOperatorsTest.unop_testa+b__add__c Cs||d}|t|||t|}t||}||jvrD|jd}q.|t|d||j||||||t||} || ||dS)Nr?brr@rA) r6r?rRrHr:rIrJrKrLrMr;r;r< binop_testZs     zOperatorsTest.binop_testa[b:c] __getitem__c Cs|||d}|t|||t|}t||} ||jvrF|jd}q0|t| d| |j||| |t|||t||} || t|||dS)Nr?rRcrr@)rBrCrDrErFrGslice) r6r?rRrWrHr:rIrJrKrLrMr;r;r< sliceop_testis     zOperatorsTest.sliceop_testa+=b__iadd__c Cst||d}t||||d|t|}t||}||jvrP|jd}q:|t|d||j|t||d<||d|||d|t||d<t|d|} | |||d|dS)NrQr?rr@rexecrBrDrErFrG) r6r?rRrHstmtrIrJrKrLrMr;r;r< setop_testws      zOperatorsTest.setop_testa[b]=c __setitem__c Cst|||d}t||||d|t|}t||} ||jvrR|jd}q<|t| d| |j|t||d<| |d||||d|t||d<t|d|} | ||||d|dS)NrVr?rr@r\) r6r?rRrWrHr^rIrJrKrLrMr;r;r< set2op_tests       zOperatorsTest.set2op_testa[b:c]=dc Cst||||d}t||||d|t|} || jvrJ| jd} q4t| |} |t| d| | j|t||d<| |dt|||||d|t||d<t|d|} | t|||||d|dS)N)r?rRrWrJr?rr@)rr]rBrDrFrGrErX) r6r?rRrWrJrHr^rIZ dictionaryrKrLrMr;r;r<setsliceop_tests      zOperatorsTest.setsliceop_testc Cs6|dgdgddgdd|gddddd|gddd dd|gdddd d |gdd dddgd d |dgdgddgd d|ddgdgddd|gdddd|ddgdgddd|ddgdgddd|ddgddddgdd|gdddddggddddS) NrOrPrerfb in a __contains__ra[b]rUrTrZr[rhrerfrerfrerfa*=b__imul__r=r>a*b__mul__b*a__rmul__r`rarerfrhrkrerurvrkrc)rSrYr_rNrbrdr6r;r;r< test_listsszOperatorsTest.test_listsc CsX|ddddddd|ddddddd|ddddddd ddd}g}t|D]}||qbg}t|D]}||q~|||g}|D]}||q|||g}t|D]}||q|||ddd}||dd d |t t |i||t | i|| ddddd dd dd dddS)NrfrkrerhrerirjrrlrUr=r>rhrgr`ra) rSr2keysappenditerrB__iter__dictrNrCrepr__repr__rb)r6rJl1ilr;r;r< test_dictss4           zOperatorsTest.test_dictscCs||d}|jD]>\}}||vrd|}t||rt||}||||||qt|jD]<\}}||vrbd|}t||rbt||}|||||qbdS)NrQz__%s__)r1r3hasattrrCrSr2r5rN)r6r?rRskiprr9r:rHr;r;r<number_operatorss     zOperatorsTest.number_operatorscCs||dd|dd|ddGdddt}||ddz|dWntylYn 0|d dS) Ndrhrerc@seZdZddZdS)z"OperatorsTest.test_ints..CcSstSNNotImplementedr6otherr;r;r<rPsz*OperatorsTest.test_ints..C.__add__N)__name__ __module__ __qualname__rPr;r;r;r<Csrruz+NotImplemented should have caused TypeError)rrB__bool__r) TypeErrorfailr6rr;r;r< test_intss  zOperatorsTest.test_intscCs|dddS)NgY@@)rrxr;r;r< test_floatsszOperatorsTest.test_floatscCs|jddgddGdddt}|ddd }|t|d ||jd||d d }|t|d ||jd |d }|t|d||jddS)NyY@@) r!r"r%r&r)r*rr mod)rc@s&eZdZdgZddZddZeZdS)z,OperatorsTest.test_complexes..Numberprecc_s$tj|g|R}|dd|_|S)Nr )complex__new__getr)clsr7kwdsresultr;r;r<rsz4OperatorsTest.test_complexes..Number.__new__cSsJ|j}|jdkrd||jfS|jdkr6d||jfSd||j||jfS)N%.*gz%.*gjz (%.*g+%.*gj))rimagreal)r6rr;r;r<rs   z5OperatorsTest.test_complexes..Number.__repr__N)rrr __slots__rr__str__r;r;r;r<Number srgQ @rvrz3.14rfz3.1gPm@z234.5r)rrrBrr)r6rr?r;r;r<test_complexess  zOperatorsTest.test_complexescCs2|tddtdd|tddddS)Nrg@rreg)rBr__radd__r*__rsub__rxr;r;r<test_explicit_reverse_methods'sz+OperatorsTest.test_explicit_reverse_methods"the module 'xxsubtype' is internalc Cs.ddl}ddl}d&dd}||j|j<||dg|dg|ddgdd||gdddd d ||gdd dd d ||gdddd d ||gddd|ddgdd ||dg|dg|ddgdd||ddgd|gddd||gdddd||ddgd|gddd||ddgd|gddd||ddgdd|ddgdd| |gddd|ddg|gd d!dGd"d#d#|j}|}| |g| | d| d$| |d$g| | d|d%| | d%dS)'NrcSsddl}||SNr) xxsubtypespamlist)rmemospamr;r;r<r1sz/OperatorsTest.test_spam_lists..spamlistrerfrOrPrgrirjrkrlrUrTrZr[rhrmrnror=r>rprqrrrsr`rartrurvrwrcc@seZdZddZdS)z(OperatorsTest.test_spam_lists..CcSsdSNrer;rxr;r;r<fooNz,OperatorsTest.test_spam_lists..C.fooNrrrrr;r;r;r<rMsrr*)N)copyr_deepcopy_dispatchrrSrYr_rNrbrdrBrr|getstatesetstate)r6rrrrr?r;r;r<test_spam_lists,sP       zOperatorsTest.test_spam_listsc Csddl}ddl}ddd}||j|j<||ddddddd ||ddddddd ||dddddd d |ddd}g}t|D]}||qg}t|D]}||q| ||g}| D]}||q| ||g}t |i |D]}||q| ||ddd}||} | | dd d | | t |dd||ddddd|ddddddGddd|j} | } | t| g| | dd| d<| t| dg| | d| d| | ddS)NrcSs2ddl}|}t|D]\}}|||<q|Sr)rspamdictr2r3)rJrrsdkvr;r;r<r\s  z/OperatorsTest.test_spam_dicts..spamdictrfrkrzrerirjrlrUr=r>zrepr(a)rrhrgr`rac@seZdZddZdS)z(OperatorsTest.test_spam_dicts..CcSsdSrr;rxr;r;r<rrz,OperatorsTest.test_spam_dicts..C.fooNrr;r;r;r<rsrbarrrrr)N)rrrrrSr2r{r|r}rBr~rDrNrrbr3rrr) r6rrrrJrrrZ straightdZspamdrr?r;r;r<test_spam_dictsXsL           " zOperatorsTest.test_spam_dictscCs|ttjtjdSr)rBrangesysmaxsizer>rxr;r;r<test_wrap_lenfunc_bad_castsz(OperatorsTest.test_wrap_lenfunc_bad_castN)r=r>)rOrP)rTrU)rZr[)r`ra)rcra)rrrr0rNrSrYr_rbrdryrrrrrrr impl_detailrrrr;r;r;r<rs&0       ! + 1rcs.eZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zfd)d*Zejd+d,Zed-d.d/Zd0d1Zejd2d3Zed-d4d5Zd6d7Z d8d9Z!d:d;Z"e#j$dd?Z&e#j$d@dAZ'dBdCZ(dDdEZ)dFdGZ*edHdIdJZ+dKdLZ,dMdNZ-dOdPZ.dQdRZ/e#0e1j2j3dSkdTdUdVZ4ej5dWdXZ6dYdZZ7d[d\Z8d]d^Z9fd_d`Z:dadbZ;dcddZdidjZ?dkdlZ@dmdnZAdodpZBdqdrZCdsdtZDdudvZEdwdxZFdydzZGd{d|ZHd}d~ZIddZJddZKddZLddZMddZNddZOddZPddZQddZRddZSddZTddZUddZVddZWddZXddZYddZZddZ[ddZ\ddZ]ddZ^ddZ_edddZ`ddZaddZbddZcddZdddZeddZfddZgddZhddZiddZjddÄZkddńZlddDŽZmddɄZndd˄Zodd̈́ZpddτZqddфZrddӄZsddՄZtddׄZuddلZvddۄZwdd݄Zxdd߄ZyddZzddZ{ddZ|ddZ}ddZ~ddZfddZe#0edudddZZS)ClassPropertiesAndMethodscCs|t||d||fdS)Nz%r has no attribute %r) assertTruerr6objr9r;r;r< assertHasAttrs  z'ClassPropertiesAndMethods.assertHasAttrcCs|t||d||fdS)Nz%r has unexpected attribute %r) assertFalserrr;r;r<assertNotHasAttrs  z*ClassPropertiesAndMethods.assertNotHasAttrc stttitt}|i|jt|tGfdddt}t|t|d}|jd|ddd}|ddko|dd|}|jd |d | d |jd |d | d |jd |d |d d d |d <|d d d}t |D]0}|||<t |D]}|||||<qhqRt |D].}t |D]}|||||qqdS)Ncs@eZdZdZfddZddZfddZdd Zd d Zd S) z6ClassPropertiesAndMethods.test_python_dicts..CcsD|rt|d|d|_|r@t|D]\}}|||<q.dSNrer)rBlenstater2r3) self_localr?kwrrrxr;r<r0s  z?ClassPropertiesAndMethods.test_python_dicts..C.__init__cSs ||dSr)rr6keyr;r;r<rUszBClassPropertiesAndMethods.test_python_dicts..C.__getitem__cs"|tdt|||dSr)assertIsInstancerDrra)rrvaluerxr;r<raszBClassPropertiesAndMethods.test_python_dicts..C.__setitem__cSs ||_dSrrr6rr;r;r<rsz?ClassPropertiesAndMethods.test_python_dicts..C.setstatecSs|jSrrrxr;r;r<rsz?ClassPropertiesAndMethods.test_python_dicts..C.getstateN) rrrrr0rUrarrr;rxr;r<rs   rrrerfrrrrr r2) r issubclassrrrBassertIs __class__rrrr) r6rJra1a2r?Nrjr;rxr<test_python_dictss@           z+ClassPropertiesAndMethods.test_python_dictscCslGdddt}|}|gd||dd||dd||dd ||dd d dS) Nc@seZdZddZdS)z6ClassPropertiesAndMethods.test_python_lists..CcSs&t|tr|j|jfSt||dSNr) isinstancerXstartstopr2rUr6rr;r;r<rUs  zBClassPropertiesAndMethods.test_python_lists..C.__getitem__NrrrrUr;r;r;r<rsrrrerfrrreerff)rr)r2extendrBr6rr?r;r;r<test_python_listssz+ClassPropertiesAndMethods.test_python_listscsGdddtd}|}||d|d||dGdddt}Gdd d |d}||||}||j|Gd d d t}Gd dd|d}||jd |}||jd GdddtGfdddt}Gddd|d}||jd||j d| d|j |}|| dGfdddtGdddd} Gddd| } Gddd| }Gdd d || }|| dGdd d | |} || d!Gfd"d#d#tGd$ddd} | }||d%d&|_||jd&||jd'Gd(d)d)} Gd*dd| d} Gd+dd| } Gd,dd| }Gd-d d || }||jdGfd.d/d/tGd0ddd}|jd |}|t|||jd Gd1ddt}|}z |WntyYn 0|d2Gd3ddt} Gd4ddt} Gd5ddt| d}Gd6d d | |}|| t|gGfd7d8d8t} Gfd9d:d:| }Gd;dd| d} |d8gGd|jGd?d@d@| | }|d:d8g| d>|jGdAd d |td}|d:d8g| d>|jGdBd d || d} |d:d8g| d>| jtfdCdD}GdEdFdF|d}GdGdHdHt|d}GdIdJdJ||d}||||||gGfdKdLdL}GfdMdNdN|}GdOdd|d} ||t| |dLg|dLgGdPdd|d} ||t| |dNdLg|dNdLgGdQdd| | }||t||dNdLg|dNdLgGdRd@d@| | }||t||dNdLg|dNdLg|t$GdSd d |td}Wdn1s0YGdTd d ||d} ||t| |dNdLg|dNdLgGdUdVdVt|}||t||dNdLg|dNdLgGdWdXdX|t}||t||dNdLg|dNdLg|t$GdYdFdF|t}Wdn1s40Y|t$GdZdFdFt|}Wdn1st0YdS)[Nc@s$eZdZddZddZddZdS)3ClassPropertiesAndMethods.test_metaclass..CcSs d|_dSrZ _C__staterxr;r;r<r0sz.C.__init__cSs|jSrrrxr;r;r<rsz.C.getstatecSs ||_dSrrrr;r;r<rsz.C.setstateNrrrr0rrr;r;r;r<rsr metaclassrrc@seZdZddZdS)z._metaclasscSs|Srr;rr;r;r<myselfrzCClassPropertiesAndMethods.test_metaclass.._metaclass.myselfN)rrrrr;r;r;r< _metaclasssrc@s eZdZdS3ClassPropertiesAndMethods.test_metaclass..DNrrrr;r;r;r<Dsrc@seZdZddZdS)z4ClassPropertiesAndMethods.test_metaclass..M1cSsd|d<t||||S)Nre__spam__rDr)rr9basesrr;r;r<rsz.M1.__new__Nrrrrr;r;r;r<M1src@s eZdZdSrNrr;r;r;r<rsrec@s eZdZdS)z;ClassPropertiesAndMethods.test_metaclass.._instanceNrr;r;r;r< _instancesr cs$eZdZeddZfddZdS)z4ClassPropertiesAndMethods.test_metaclass..M2cSs t|}||_||_||_|Sr)objectrr9rr)rr9rrr6r;r;r<rs  z.M2.__new__cs<}|jD]*}|drq t|||j|||q |S)N__)r startswithsetattr__get__)r6itrr r;r<__call__s   z=ClassPropertiesAndMethods.test_metaclass..M2.__call__N)rrr staticmethodrrr;rr;r<M2s rc@seZdZddZdS)rcSsdSNrr;rxr;r;r<r sz8ClassPropertiesAndMethods.test_metaclass..C.spamNrrrrr;r;r;r<r sr;rrcseZdZfddZZS)z;ClassPropertiesAndMethods.test_metaclass..autosupercsZt|||||}|dddkr4|dd}q|rBd|}nd}t||t||S)Nre_z _%s__superZ__super)superrr)rr9rrr)r autosuperr;r<rs  zCClassPropertiesAndMethods.test_metaclass..autosuper.__new__rrrr __classcell__r;)rrr<rsrc@seZdZddZdS)3ClassPropertiesAndMethods.test_metaclass..AcSsdSNAr;rxr;r;r<rI%sz8ClassPropertiesAndMethods.test_metaclass..A.methNrrrrIr;r;r;r<r$src@seZdZddZdS)3ClassPropertiesAndMethods.test_metaclass..BcSsd|jSNB _B__superrIrxr;r;r<rI(sz8ClassPropertiesAndMethods.test_metaclass..B.methNr r;r;r;r<r#'sr#c@seZdZddZdS)rcSsd|jSNr _C__superrIrxr;r;r<rI+sz8ClassPropertiesAndMethods.test_metaclass..C.methNr r;r;r;r<r*sc@seZdZddZdS)rcSsd|jSNr) _D__superrIrxr;r;r<rI.sz8ClassPropertiesAndMethods.test_metaclass..D.methNr r;r;r;r<r-sZDCBAc@seZdZddZdS)3ClassPropertiesAndMethods.test_metaclass..EcSsd|jS)NE)Z _E__superrIrxr;r;r<rI2sz8ClassPropertiesAndMethods.test_metaclass..E.methNr r;r;r;r<r,1sr,ZEBCAcseZdZfddZZS)z>ClassPropertiesAndMethods.test_metaclass..autopropertyc si}|D]v\}}|drL|dd}||d\}}|}||f||<q |dr |dd}||d\}}|}||f||<q |D]\}\}}t||||<qt|||||S)NZ_get_ru)NNZ_set_)r3r rpropertyrr) rr9rrhitsrvalrset)r autopropertyr;r<r9s"     zFClassPropertiesAndMethods.test_metaclass..autoproperty.__new__rr;)r1rr<r16sr1c@seZdZddZddZdS)rcSs|j Sr_A__xrxr;r;r<_get_xKs:ClassPropertiesAndMethods.test_metaclass..A._get_xcSs | |_dSrr2r6xr;r;r<_set_xMsz:ClassPropertiesAndMethods.test_metaclass..A._set_xN)rrrr4r8r;r;r;r<rJsr7ric@s eZdZdS)z@ClassPropertiesAndMethods.test_metaclass..multimetaclassNrr;r;r;r<multimetaclassUsr9c@seZdZddZdS)rcSsdSrr;rxr;r;r<r4Ysr5Nrrrr4r;r;r;r<rXsc@seZdZddZdS)r!cSsd|jSr")r%r4rxr;r;r<r4\sz:ClassPropertiesAndMethods.test_metaclass..B._get_xNr:r;r;r;r<r#[sc@seZdZddZdS)rcSsd|jSr&)r(r4rxr;r;r<r4_sz:ClassPropertiesAndMethods.test_metaclass..C._get_xNr:r;r;r;r<r^sc@seZdZddZdS)rcSsd|jSr))r*r4rxr;r;r<r4bsz:ClassPropertiesAndMethods.test_metaclass..D._get_xNr:r;r;r;r<rascseZdZdZfddZdS)z3ClassPropertiesAndMethods.test_metaclass..Trcsjd7_dSrcounterr6r7Tr;r<r0isz.T.__init__N)rrrr<r0r;r>r;r<r?gsr?c@s eZdZdSr rr;r;r;r<rksc@s eZdZdSr rr;r;r;r<rrrz5calling object w/o call method should raise TypeErrorc@seZdZddZdS)rc_stj|i|Srrr7r8r;r;r<r{sz;ClassPropertiesAndMethods.test_metaclass..A.__new__Nrr;r;r;r<rzsc@s eZdZdSr!Nrr;r;r;r<r#~sc@s eZdZdSr rr;r;r;r<rsc@s eZdZdSrrr;r;r;r<rscs.eZdZefddZeddZZS)z7ClassPropertiesAndMethods.test_metaclass..AMetacsdt||||S)NAMetar|rrmclsr9rnsr new_callsr;r<rs z?ClassPropertiesAndMethods.test_metaclass..AMeta.__new__cSsiSrr;rEr9rr;r;r< __prepare__szCClassPropertiesAndMethods.test_metaclass..AMeta.__prepare__rrrrr classmethodrJrr;rHrr<rBsrBcs2eZdZefddZefddZZS)z7ClassPropertiesAndMethods.test_metaclass..BMetacsdt||||S)NBMetarCrDrGr;r<rs z?ClassPropertiesAndMethods.test_metaclass..BMeta.__new__cst||}d|d<|S)NTBMeta_was_here)rrJrDrr;r<rJszCClassPropertiesAndMethods.test_metaclass..BMeta.__prepare__rKr;rMrr<rNsrNc@s eZdZdSrNrr;r;r;r<rsc@s eZdZdSrArr;r;r;r<r#sc@s eZdZdSr rr;r;r;r<rsrOc@s eZdZdSz4ClassPropertiesAndMethods.test_metaclass..C2Nrr;r;r;r<C2srRc@s eZdZdSrrr;r;r;r<rsc@s eZdZdSr+Nrr;r;r;r<r,scsSrr;r@)markerr;r<funcsz6ClassPropertiesAndMethods.test_metaclass..funcc@s eZdZdSz3ClassPropertiesAndMethods.test_metaclass..XNrr;r;r;r<XsrWc@s eZdZdS)z3ClassPropertiesAndMethods.test_metaclass..YNrr;r;r;r<YsrXc@s eZdZdS)z3ClassPropertiesAndMethods.test_metaclass..ZNrr;r;r;r<ZsrYcs.eZdZfddZefddZZS)z:ClassPropertiesAndMethods.test_metaclass..ANotMetacsdt|SNANotMetarCrEr7r8rGr;r<rs zBClassPropertiesAndMethods.test_metaclass..ANotMeta.__new__csdiSrZr|rI) prepare_callsr;r<rJs zFClassPropertiesAndMethods.test_metaclass..ANotMeta.__prepare__rrrrrLrJrr;rHr^rr<r[sr[cs0eZdZfddZefddZZS)z:ClassPropertiesAndMethods.test_metaclass..BNotMetacsdt|SNBNotMetarCr\rGr;r<rs zBClassPropertiesAndMethods.test_metaclass..BNotMeta.__new__csdt||Sra)r|rrJrI)rr^r;r<rJs zFClassPropertiesAndMethods.test_metaclass..BNotMeta.__prepare__r_r;r`rr<rbsrbc@s eZdZdSrPrr;r;r;r<rsc@s eZdZdSrArr;r;r;r<r#sc@s eZdZdSr rr;r;r;r<rsc@s eZdZdSrQrr;r;r;r<rRsc@s eZdZdSrrr;r;r;r<r sc@s eZdZdSrSrr;r;r;r<r,sc@s eZdZdS)z3ClassPropertiesAndMethods.test_metaclass..FNrr;r;r;r<Fsrcc@s eZdZdS)z4ClassPropertiesAndMethods.test_metaclass..F2Nrr;r;r;r<F2srdc@s eZdZdSrVrr;r;r;r<rW*sc@s eZdZdSrVrr;r;r;r<rW-s)rDrBrrrrrr r9rassertInrrrIrr7r3r<rrrclearrF assertRaisesr))r6rr?rrrJrrWrrr#r,r9rBrNrRrUrWrXrYr[rbrcrdr;)r?r r1rrTrHr^r<test_metaclasss             4 4 z(ClassPropertiesAndMethods.test_metaclasscsgttGfddd}|d}d|_|j}|`|gdzGdddtjt}WntytYn 0|dd d Gd d d fd dt dD}| |dS)NcsBeZdZfddZfddZfddZfddZd S) z.MMcs||dSr)r0r6r9)MTr;r<r05szEClassPropertiesAndMethods.test_module_subclasses..MM.__init__csd|f||S)NrE)r|__getattribute__rirjlogr;r<rk7szMClassPropertiesAndMethods.test_module_subclasses..MM.__getattribute__cs"d||f|||dS)Nr)r| __setattr__r6r9rrlr;r<rn:szHClassPropertiesAndMethods.test_module_subclasses..MM.__setattr__csd|f||dS)Ndelattr)r| __delattr__rirlr;r<rq=szHClassPropertiesAndMethods.test_module_subclasses..MM.__delattr__N)rrrr0rkrnrqr;rlr;r<MM4s rrr?r))rrrrEr)rprc@s eZdZdS)z@ClassPropertiesAndMethods.test_module_subclasses..ModuleNrr;r;r;r<ModuleJsrtz?inheriting from ModuleType and str at the same time should failcSsdtjtjddS)Nrr)r)joinrandomchoicesstring ascii_lettersr;r;r;r< random_nameSszEClassPropertiesAndMethods.test_module_subclasses..random_namec@s eZdZdS)z;ClassPropertiesAndMethods.test_module_subclasses..ANrr;r;r;r<rUsrcsg|]}tfiqSr;rD.0r)rrzr;r< WrzDClassPropertiesAndMethods.test_module_subclasses..r) rDrrrBtypes ModuleTypestrrrr__subclasses__)r6rrr?r7rtZ subclassesr;)rrjrmrzr<test_module_subclasses0s"   z0ClassPropertiesAndMethods.test_module_subclassescsLGdddt}||d|d||dGfdddt}|}|t|gd|d<|t|d g||dd||d|d||d||j|ttfGd d d t}Gd d d |t}|| d|t |d|| d|t |ddS)Nc@s$eZdZddZddZddZdS)z>ClassPropertiesAndMethods.test_multiple_inheritance..CcSs d|_dSrrrxr;r;r<r0]szGClassPropertiesAndMethods.test_multiple_inheritance..C.__init__cSs|jSrrrxr;r;r<r_szGClassPropertiesAndMethods.test_multiple_inheritance..C.getstatecSs ||_dSrrrr;r;r<raszGClassPropertiesAndMethods.test_multiple_inheritance..C.setstateNrr;r;r;r<r\srrrcseZdZfddZdS)z>ClassPropertiesAndMethods.test_multiple_inheritance..Dcsti||dSr)rDr0rxrr;r<r0hszGClassPropertiesAndMethods.test_multiple_inheritance..D.__init__Nrrrr0r;rr;r<rgsrworldhello)rrc@seZdZddZddZdS)zAClassPropertiesAndMethods.test_multiple_inheritance..NodecSs t|Sr)r)rrxr;r;r<__int__wszIClassPropertiesAndMethods.test_multiple_inheritance..Node.__int__cSsdS)NZ23r;rxr;r;r<ryszEClassPropertiesAndMethods.test_multiple_inheritance..Node.fooN)rrrrrr;r;r;r<Nodevsrc@seZdZddZdS)zAClassPropertiesAndMethods.test_multiple_inheritance..FragcSsdS)NZ42r;rxr;r;r<r|szEClassPropertiesAndMethods.test_multiple_inheritance..Frag.fooNrr;r;r;r<Frag{srr) r rBrrrr2r{r3__mro__rr))r6r?rrJrrr;rr<test_multiple_inheritanceZs*  z3ClassPropertiesAndMethods.test_multiple_inheritancecCsGdddt}||dGddd|}||d||dGddd|}||d||dGddd||}||d||d||j||||tfGd d d ||}||d||d||j||||tfzGd d d ||}WntyPYn 0|d zGddd||}WntyYn 0|ddS)Nc@seZdZddZdS)z=ClassPropertiesAndMethods.test_diamond_inheritance..AcSsdSrr;rxr;r;r<rrzBClassPropertiesAndMethods.test_diamond_inheritance..A.spamNrr;r;r;r<rsrc@seZdZddZddZdS)z=ClassPropertiesAndMethods.test_diamond_inheritance..BcSsdSr"r;rxr;r;r<boorzAClassPropertiesAndMethods.test_diamond_inheritance..B.boocSsdSr"r;rxr;r;r<rrzBClassPropertiesAndMethods.test_diamond_inheritance..B.spamN)rrrrrr;r;r;r<r#sr#c@seZdZddZdS)z=ClassPropertiesAndMethods.test_diamond_inheritance..CcSsdSr&r;rxr;r;r<rrzAClassPropertiesAndMethods.test_diamond_inheritance..C.booN)rrrrr;r;r;r<rsrc@s eZdZdS)z=ClassPropertiesAndMethods.test_diamond_inheritance..DNrr;r;r;r<rrrc@s eZdZdS)z=ClassPropertiesAndMethods.test_diamond_inheritance..ENrr;r;r;r<r,rr,c@s eZdZdS)z=ClassPropertiesAndMethods.test_diamond_inheritance..FNrr;r;r;r<rcrrcz#expected MRO order disagreement (F)c@s eZdZdS)z=ClassPropertiesAndMethods.test_diamond_inheritance..GNrr;r;r;r<Grrz#expected MRO order disagreement (G))r rBrrrrr)r6rr#rrr,rcrr;r;r<test_diamond_inheritances4 z2ClassPropertiesAndMethods.test_diamond_inheritancec CsGdddt}Gdddt}Gdddt}Gddd|}Gd d d |}Gd d d ||||}||j||||||tfdS) Nc@s eZdZdS)z.ANrr;r;r;r<rrrc@s eZdZdS)z.BNrr;r;r;r<r#rr#c@s eZdZdS)z.CNrr;r;r;r<rrrc@s eZdZdS)z.XNrr;r;r;r<rWrrWc@s eZdZdS)z.YNrr;r;r;r<rXrrXc@s eZdZdS)z.ZNrr;r;r;r<rYrrYr rBr)r6rr#rrWrXrYr;r;r<test_ex5_from_c3_switchsz1ClassPropertiesAndMethods.test_ex5_from_c3_switchc CsGdddt}Gddd|}Gddd|}Gddd|}Gd d d |}Gd d d ||}Gd dd|}Gddd||}||j|||||tf||j||||tf||j||||||||tf dS)Nc@s eZdZdS)z9ClassPropertiesAndMethods.test_monotonicity..BoatNrr;r;r;r<Boatrrc@s eZdZdS)z.DayBoatNrr;r;r;r<DayBoatrrc@s eZdZdS)z>ClassPropertiesAndMethods.test_monotonicity..WheelBoatNrr;r;r;r< WheelBoatrrc@s eZdZdS)z?ClassPropertiesAndMethods.test_monotonicity..EngineLessNrr;r;r;r< EngineLessrrc@s eZdZdS)zCClassPropertiesAndMethods.test_monotonicity..SmallMultihullNrr;r;r;r<SmallMultihullrrc@s eZdZdS)zCClassPropertiesAndMethods.test_monotonicity..PedalWheelBoatNrr;r;r;r<PedalWheelBoatrrc@s eZdZdS)zCClassPropertiesAndMethods.test_monotonicity..SmallCatamaranNrr;r;r;r<SmallCatamaranrrc@s eZdZdS)z;ClassPropertiesAndMethods.test_monotonicity..PedaloNrr;r;r;r<Pedalorrr) r6rrrrrrrrr;r;r<test_monotonicitys&  z+ClassPropertiesAndMethods.test_monotonicityc CsGdddt}Gdddt}Gdddt}Gddd||}Gd d d ||}Gd d d ||}||j||||||tfdS) Nc@s eZdZdS)zAClassPropertiesAndMethods.test_consistency_with_epg..PaneNrr;r;r;r<Panerrc@s eZdZdS)zKClassPropertiesAndMethods.test_consistency_with_epg..ScrollingMixinNrr;r;r;r<ScrollingMixinrrc@s eZdZdS)zIClassPropertiesAndMethods.test_consistency_with_epg..EditingMixinNrr;r;r;r< EditingMixinrrc@s eZdZdS)zKClassPropertiesAndMethods.test_consistency_with_epg..ScrollablePaneNrr;r;r;r<ScrollablePanerrc@s eZdZdS)zIClassPropertiesAndMethods.test_consistency_with_epg..EditablePaneNrr;r;r;r< EditablePanerrc@s eZdZdS)zSClassPropertiesAndMethods.test_consistency_with_epg..EditableScrollablePaneNrr;r;r;r<EditableScrollablePanerrr)r6rrrrrrr;r;r<test_consistency_with_epgsz3ClassPropertiesAndMethods.test_consistency_with_epgc sd}fdd}Gdddt}Gddd|}Gdd d t}|td td ||fi|t|td ||fi|t|td |||fiGd d d t}Gddd|}Gddd|}Gddd||} Gddd||} |t|td| | fidS)NzCCannot create a consistent method resolution order (MRO) for bases c spz ||WnP|y\}z8trHt||sHdt||fWYd}~nd}~00d|dS)NzMessage %r, expected %rz Expected %s)rcheck_impl_detailrr r)excexpectedcallabler7msgrxr;r<raisess  z?ClassPropertiesAndMethods.test_mro_disagreement..raisesc@s eZdZdS)z:ClassPropertiesAndMethods.test_mro_disagreement..ANrr;r;r;r<rrrc@s eZdZdS)z:ClassPropertiesAndMethods.test_mro_disagreement..BNrr;r;r;r<r#rr#c@s eZdZdS)z:ClassPropertiesAndMethods.test_mro_disagreement..CNrr;r;r;r<rrrzduplicate base class ArWc@s eZdZdS)zCClassPropertiesAndMethods.test_mro_disagreement..GridLayoutNrr;r;r;r< GridLayoutrrc@s eZdZdS)zGClassPropertiesAndMethods.test_mro_disagreement..HorizontalGridNrr;r;r;r<HorizontalGridrrc@s eZdZdS)zEClassPropertiesAndMethods.test_mro_disagreement..VerticalGridNrr;r;r;r< VerticalGridrrc@s eZdZdS)z?ClassPropertiesAndMethods.test_mro_disagreement..HVGridNrr;r;r;r<HVGridrrc@s eZdZdS)z?ClassPropertiesAndMethods.test_mro_disagreement..VHGridNrr;r;r;r<VHGridrrZ ConfusedGrid)r rrD) r6Z mro_err_msgrrr#rrrrrrr;rxr<test_mro_disagreements,    z/ClassPropertiesAndMethods.test_mro_disagreementc Cst}||jt|t|tt}|||||dz d|_WnttfybYn 0| d|tdGdddt}|}||j id|_||jd||j ddidS)Nrrz1object() should not allow setting a foo attributerFc@s eZdZdS)z:ClassPropertiesAndMethods.test_object_class..CdictNrr;r;r;r<Cdict srre) r rBrrDassertNotEqualrrAttributeErrorrrrF)r6r?rRrr7r;r;r<test_object_classs$    z+ClassPropertiesAndMethods.test_object_classc Cs`Gdddtj}td}||jtju|t|d||_||j|u|t|dtj|_||jtju|t|dGdddt}|t|d_Wdn1s0YGdd d t }|t|d _Wdn1s0YGd d d t }|t|d _Wdn1sH0YGdddt }|t|d_Wdn1s0YGdddt }|t|d_Wdn1s0YGdddt }|t|d_Wdn1s0YGdddt} |t| t_Wdn1sR0YdS)Nc@seZdZdZdS)zjClassPropertiesAndMethods.test_object_class_assignment_between_heaptypes_and_nonheaptypes..SubTypereNrrrr?r;r;r;r<SubTypesrrLr?c@seZdZdZdS)zhClassPropertiesAndMethods.test_object_class_assignment_between_heaptypes_and_nonheaptypes..MyIntr;Nrrrrr;r;r;r<MyInt-srrec@seZdZdZdS)zjClassPropertiesAndMethods.test_object_class_assignment_between_heaptypes_and_nonheaptypes..MyFloatr;Nrr;r;r;r<MyFloat2sr?c@seZdZdZdS)zlClassPropertiesAndMethods.test_object_class_assignment_between_heaptypes_and_nonheaptypes..MyComplexr;Nrr;r;r;r< MyComplex7sry?@c@seZdZdZdS)zhClassPropertiesAndMethods.test_object_class_assignment_between_heaptypes_and_nonheaptypes..MyStrr;Nrr;r;r;r<MyStr<src@seZdZdZdS)zjClassPropertiesAndMethods.test_object_class_assignment_between_heaptypes_and_nonheaptypes..MyBytesr;Nrr;r;r;r<MyBytesAsrac@seZdZdZdS)zjClassPropertiesAndMethods.test_object_class_assignment_between_heaptypes_and_nonheaptypes..MyTupler;Nrr;r;r;r<MyTupleFsrr;c@seZdZdZdS)znClassPropertiesAndMethods.test_object_class_assignment_between_heaptypes_and_nonheaptypes..MyFrozenSetr;Nrr;r;r;r< MyFrozenSetKsr)rrrrrrr)rgrr*rrbytestuple frozenset) r6rrLrrrrrrrr;r;r<?test_object_class_assignment_between_heaptypes_and_nonheaptypess>   $ & & & & & zYClassPropertiesAndMethods.test_object_class_assignment_between_heaptypes_and_nonheaptypesc sGdddt}|}|d|dGdddt}|}|d|dd|_|jdd|_|jd|`|dGd d d t}|}|d|d|d |d d|_d |_d|_|jd|jd |jdGdddt}|d}|d|d|dz d|_WntytYn 0 dzGdddt}Wnt yYn 0 dzGdddt}Wnt yYn 0 dzGdddt}Wnt yYn 0 dzGdddt}Wnt yDYn 0 dzGdddt}Wnt yxYn 0 dGd ddt}Gd!ddt}|}d|_ |j dGd"ddt}|}d|_ |j dd#Gfd$ddt}|}d|_ |j d td%tzGd&ddt}Wnt tfyZYn 0 d'Gfd(d)d)tGd*ddt}|}|_|_|_jd~tjd%Gd+d,d,|}|}|_|_jd ~tjd%Gd-d.d.|} | }|_|_|_jd~tjd%Gd/d0d0t} | } | g| _jdd} tjd%ttd1rGd2d3d3t} | } tt}td4D]}| | kqtt}||Gfd5d6d6t}td7} |}~Wdn1sT0Y| d8Gd9d:d:t}t|`Wdn1s0YdS);Nc@seZdZgZdS)z0ClassPropertiesAndMethods.test_slots..C0Nrr;r;r;r<C0RsrrFrc@seZdZdgZdS)z0ClassPropertiesAndMethods.test_slots..C1r?Nrr;r;r;r<C1Xsrr?rec@seZdZgdZdS)z0ClassPropertiesAndMethods.test_slots..C3rVNrr;r;r;r<C3dsrrRrWrfrhc@s&eZdZdZdgZddZddZdS)z0ClassPropertiesAndMethods.test_slots..C4zValidate name mangling__acSs ||_dSrZ_C4__ar6rr;r;r<r0usz9ClassPropertiesAndMethods.test_slots..C4.__init__cSs|jSrrrxr;r;r<rwsz4ClassPropertiesAndMethods.test_slots..C4.getN)rrr__doc__rr0rr;r;r;r<C4rsrrurrvz$Double underscored names not mangledc@seZdZdgZdS/ClassPropertiesAndMethods.test_slots..CNrr;r;r;r<rsrz[None] slots not caughtc@seZdZdgZdS)rzfoo barNrr;r;r;r<rsz['foo bar'] slots not caughtc@seZdZdgZdS)rzfoobarNrr;r;r;r<rsz['foo\0bar'] slots not caughtc@seZdZdgZdS)r1Nrr;r;r;r<rsz['1'] slots not caughtc@seZdZdgZdS)rrNrr;r;r;r<rsz[''] slots not caughtc@seZdZgdZdS)r)r?Za_bZ_aZ A0123456789ZNrr;r;r;r<rsc@seZdZdZdSrabcNrr;r;r;r<rsc@seZdZdZdSrrr;r;r;r<rsrcseZdZZdSrrr;)slotsr;r<rsrc@seZdZedgZdS)rN)rrrchrrr;r;r;r<rszhr(128)] slots not caughtcs(eZdZdZfddZfddZdS)z5ClassPropertiesAndMethods.test_slots..Countedrcsjd7_dSrr;rxCountedr;r<r0sz>ClassPropertiesAndMethods.test_slots..Counted.__init__csjd8_dSrr;rxrr;r<__del__sz=ClassPropertiesAndMethods.test_slots..Counted.__del__N)rrrr<r0rr;rr;r<rs rc@seZdZgdZdS)rrVNrr;r;r;r<rsc@s eZdZdS)z/ClassPropertiesAndMethods.test_slots..DNrr;r;r;r<rsrc@seZdZdgZdS)z/ClassPropertiesAndMethods.test_slots..EeNrr;r;r;r<r,sr,c@seZdZddgZdS)z/ClassPropertiesAndMethods.test_slots..Fr?rRNrr;r;r;r<rcsrc get_objectsc@seZdZddZdS)z/ClassPropertiesAndMethods.test_slots..GcSsdS)NFr;rr;r;r<__eq__sz6ClassPropertiesAndMethods.test_slots..G.__eq__Nrrrrr;r;r;r<rsrrcs(eZdZddgZddZfddZdS)z/ClassPropertiesAndMethods.test_slots..Hr?rRcSsd|_d|_dSNrerfrQrxr;r;r<r0 sz8ClassPropertiesAndMethods.test_slots..H.__init__cs |jd|jddSr)rBr?rR)self_rxr;r<r sz7ClassPropertiesAndMethods.test_slots..H.__del__N)rrrrr0rr;rxr;r<Hsrstderrrc@seZdZdZdS)z/ClassPropertiesAndMethods.test_slots..Xr?Nrr;r;r;r<rWsrW)r rr?rBrRrWrZ_ClassPropertiesAndMethods__arrrrrrrDrUnicodeEncodeErrorr<r gc_collectzrrgcrrrZcaptured_outputgetvaluerg)r6rr7rrrrrWrr,rcsrgZ orig_objectsrZ new_objectsrhrWr;)rr6rr< test_slotsPs                           " z$ClassPropertiesAndMethods.test_slotscCs0Gdddt}|}||d||dd|_||jddiGdddt}|}||d||dz d|_WntyYn 0|d Gd d d ||}|}||d||dd|_||jddiGd d d ||}|}||d||dd|_||jddidS)Nc@seZdZdgZdS)z7ClassPropertiesAndMethods.test_slots_special..DrFNrr;r;r;r<rsrrF __weakref__rrc@seZdZdgZdS)z7ClassPropertiesAndMethods.test_slots_special..WrNrr;r;r;r<W$srz!shouldn't be allowed to set a.fooc@seZdZgZdS)z8ClassPropertiesAndMethods.test_slots_special..C1Nrr;r;r;r<r0src@seZdZgZdS)z8ClassPropertiesAndMethods.test_slots_special..C2Nrr;r;r;r<rR8srR)r rrrrBrFrr)r6rr?rrrRr;r;r<test_slots_specials6           z,ClassPropertiesAndMethods.test_slots_specialc s`Gfdddt}Gddd}Gddd||dd}|jdtj|}|jd |dd |_|jd  t Gd d d }Wdn1s0YGd d d |dd}|j |j ddd |jdtj|}|dd|_ |j d t Gddd}Wdn1sR0YdS)NcseZdZfddZZS)z;ClassPropertiesAndMethods.test_slots_special2..Metacs||t||||Sr)rerr)rr9r namespaceattrrr6r;r<rCs zCClassPropertiesAndMethods.test_slots_special2..Meta.__new__rr;rxrr<MetaBsrc@seZdZddZdS)z9ClassPropertiesAndMethods.test_slots_special2..C1cSs d|_dSr)rRrxr;r;r<r0HszBClassPropertiesAndMethods.test_slots_special2..C1.__init__Nrr;r;r;r<rGsrcs"eZdZdgZfddZZS)z9ClassPropertiesAndMethods.test_slots_special2..C2rcstdSrrr0rxrr;r<r0LszBClassPropertiesAndMethods.test_slots_special2..C2.__init__)rrrrr0rr;r;rr<rRJsrRr)rrrc@seZdZdZdgZdS)z9ClassPropertiesAndMethods.test_slots_special2..C3rrN)rrrrrr;r;r;r<rVsrc@seZdZdgZdS)z9ClassPropertiesAndMethods.test_slots_special2..Q1rNrr;r;r;r<Q1Zsrrqc@seZdZeZdgZdS)z9ClassPropertiesAndMethods.test_slots_special2..Q2rN)rrrr rr;r;r;r<Q2dsr) rDrrFrMemberDescriptorTyperBrRrrrgrr) r6rrrRrWrrrrr;rxr<test_slots_special2@s0   ,   z-ClassPropertiesAndMethods.test_slots_special2cCs`ddl}Gddd|jd}Gdddt}|||}||||t|jj|ddS)Nrc@seZdZdZdS)z>ClassPropertiesAndMethods.test_slots_descriptor..MyABCr?Nrr;r;r;r<MyABClsrrc@s eZdZdS)zBClassPropertiesAndMethods.test_slots_descriptor..UnrelatedNrr;r;r;r< Unrelatedosrrh) rABCMetar registerrrgrr?__set__)r6rrrur;r;r<test_slots_descriptorhs  z/ClassPropertiesAndMethods.test_slots_descriptorc CsHGdddt}Gddd|}Gddd|}d|_||jd||jd||jdGdd d t}|}||d d |_||jd d d |_||ddd |_|t|ddd |_|t |d||jd ||ddd}||_ ||j dd|_ ||j ddd}||_ z d|_ WntyZYn 0|d||j dGddd|}|}d|_||jdGdddt } |d| d d|| d dd|d | d d!|| d d d!|| d | d d!Gd"d#d#t} Gd$d%d%| d&} || tdS)'Nc@s eZdZdSz2ClassPropertiesAndMethods.test_dynamics..DNrr;r;r;r<r{src@s eZdZdS)z2ClassPropertiesAndMethods.test_dynamics..ENrr;r;r;r<r,}sr,c@s eZdZdS)z2ClassPropertiesAndMethods.test_dynamics..FNrr;r;r;r<rcsrcrec@s eZdZdS)z2ClassPropertiesAndMethods.test_dynamics..CNrr;r;r;r<rsrfoobarrfcSsdSrr;rxr;r;r<rz9ClassPropertiesAndMethods.test_dynamics..rcSsdS)NC()r;rxr;r;r<rrrcSsdSrr;rxr;r;r<rrrrcSs|dkr dStdSNrrrir;r;r< mygetattrsz:ClassPropertiesAndMethods.test_dynamics..mygetattrrcSs|dkr tt|||Sr)rr rnror;r;r< mysetattrsz:ClassPropertiesAndMethods.test_dynamics..mysetattrznot spamzexpected AttributeErrorc@s eZdZdSrrr;r;r;r<rsc@s eZdZdS)z2ClassPropertiesAndMethods.test_dynamics..INrr;r;r;r<Isrr?Zaarhrvc@s eZdZdS)zAClassPropertiesAndMethods.test_dynamics..dynamicmetaclassNrr;r;r;r<dynamicmetaclasssrc@s eZdZdS)z:ClassPropertiesAndMethods.test_dynamics..someclassNrr;r;r;r< someclasssrr)r rrBrrmethodrrrr) __getattr__rnewrnrrrDr) r6rr,rcrr?rrrJrrrr;r;r< test_dynamicsys\       z'ClassPropertiesAndMethods.test_dynamicscCszGdddtt}Wnty(Yn 0|dzGdddtd}Wnty\Yn 0|dGddd}zGdddtt}WntyYn 0|d zGd ddt}WntyYn 0|d zGd ddt}WntyYn 0|d Gdddt}Gdddt}Gdddt|d}Gdddt|d}zGddd||}WntyYn 0|ddS)Nc@s eZdZdS0ClassPropertiesAndMethods.test_errors..CNrr;r;r;r<rsrz5inheritance from both list and dict should be illegalc@s eZdZdSr rr;r;r;r<rsz+inheritance from non-type should be illegalc@s eZdZdS)z6ClassPropertiesAndMethods.test_errors..ClassicNrr;r;r;r<Classicsr c@s eZdZdSr rr;r;r;r<rsz,inheritance from CFunction should be illegalc@seZdZdZdSr reNrr;r;r;r<rsz__slots__ = 1 should be illegalc@seZdZdgZdSrrr;r;r;r<rsz!__slots__ = [1] should be illegalc@s eZdZdS)z1ClassPropertiesAndMethods.test_errors..M1Nrr;r;r;r<rsrc@s eZdZdS)z1ClassPropertiesAndMethods.test_errors..M2Nrr;r;r;r<rsrc@s eZdZdS)z1ClassPropertiesAndMethods.test_errors..A1Nrr;r;r;r<A1srrc@s eZdZdS)z1ClassPropertiesAndMethods.test_errors..A2Nrr;r;r;r<A2src@s eZdZdS)z0ClassPropertiesAndMethods.test_errors..BNrr;r;r;r<r#sr#z5finding the most derived metaclass should have failed)r2rrrr rDr)r6rr rrrrr#r;r;r< test_errorssF         z%ClassPropertiesAndMethods.test_errorsc s$Gdddt}|}||d|df||d|df||d|dfGddd|}|}||d|df||d|df||d|df|||d|dfdd}t|}||dtd td f||dd td f||jj|||jj||t||jj||t||jj||t|||f|t|||ftdd}| t |zt|dd Wnt yYn 0| d t|}||j id |_ ||j d ||j d d i|` ||d dS) Nc@seZdZddZeeZdS)z6ClassPropertiesAndMethods.test_classmethods..CcWs|Srr;r?r;r;r<rrz:ClassPropertiesAndMethods.test_classmethods..C.fooNrrrrrLgoor;r;r;r<rsrrec@s eZdZdS)z6ClassPropertiesAndMethods.test_classmethods..DNrr;r;r;r<rsrcSs||fSrr;rargr;r;r<f rz6ClassPropertiesAndMethods.test_classmethods..frrrz)classmethod shouldn't accept keyword argsr7)r rBrrrLrr)__self__rrgrrrFr7r) r6rrWrrJrZffrIcmrr;r<test_classmethodssF  z+ClassPropertiesAndMethods.test_classmethodscCsLttd}td}|}tdD]}|dq"|j||ddddSNgettotalrefcountrrr)Zdelta)r get_attributerrLrr0assertAlmostEqual)r6rr refs_beforerr;r;r<%test_refleaks_in_classmethod___init__-s    z?ClassPropertiesAndMethods.test_refleaks_in_classmethod___init__rcCsZddl}d}ddi}|jj|i|\}}}|||j|||||||j|i|\}}}|||j|||||||jjd}||jg|Ri|\}} } |||j|| ||| |Gddd|j} || g|Ri|\}} } ||| || ||| ||t} |Wdn1s\0Y|t| jd|t} ||Wdn1s0Y|t| jd |t} |t Wdn1s0Yd } |t| j| |t} | dt Wdn1s:0Y|t| j| dS) Nrrgr{ classmethc@s eZdZdS)zAClassPropertiesAndMethods.test_classmethods_in_c..SubSpamNrr;r;r;r<SubSpamIrr$zGdescriptor 'classmeth' of 'xxsubtype.spamlist' object needs an argumentzfdescriptor 'classmeth' for type 'xxsubtype.spamlist' needs a type, not a 'xxsubtype.spamlist' as arg 2zUdescriptor 'classmeth' requires a subtype of 'xxsubtype.spamlist' but received 'list') rrr#rBrFrgrr exceptionr2r)r6rr?rJr7rd1Zspam_cmZx2rd2r$rexpected_errmsgr;r;r<test_classmethods_in_c6sR           & , ( ,z0ClassPropertiesAndMethods.test_classmethods_in_ccCsGdddt}|}||dd||dd||d|dfGddd|}|}||dd||dd||d|df|||d|dftd}||jid|_||jd||jddi|`||ddS) Nc@seZdZddZeeZdS)z7ClassPropertiesAndMethods.test_staticmethods..CcWs|Srr;rr;r;r<rkrz;ClassPropertiesAndMethods.test_staticmethods..C.fooN)rrrrrrr;r;r;r<rjsrrerec@s eZdZdS)z7ClassPropertiesAndMethods.test_staticmethods..DNrr;r;r;r<rqsrrr7)r rBrrrrFr7r)r6rrWrrJsmr;r;r<test_staticmethodshs$z,ClassPropertiesAndMethods.test_staticmethodscCsLttd}td}|}tdD]}|dq"|j||ddddSr)rrrrrr0r)r6rr+r rr;r;r<&test_refleaks_in_staticmethod___init__s    z@ClassPropertiesAndMethods.test_refleaks_in_staticmethod___init__cCsddl}d}ddi}|jj|i|\}}}||d|||||||j|i|\}}}||d||||||dS)Nrrgrr")rrZ staticmethrB)r6rr?rJr7rr&r'r;r;r<test_staticmethods_in_cs     z1ClassPropertiesAndMethods.test_staticmethods_in_ccsGddd}|ddf||ddf||d|dfGddd}|}||d|df||d|df||d|df|||d|dfGfddd}||jjj|tjddS) Nc@seZdZddZeeZdS)z1ClassPropertiesAndMethods.test_classic..CcWs|Srr;rr;r;r<rrz5ClassPropertiesAndMethods.test_classic..C.fooNrr;r;r;r<rsrrec@s eZdZdS)z1ClassPropertiesAndMethods.test_classic..DNrr;r;r;r<rsrcseZdZjZdS)z1ClassPropertiesAndMethods.test_classic..ENrr;rr;r<r,sr,.Cc@s0eZdZd ddZd ddZddZdd ZdS) zEClassPropertiesAndMethods.test_compattr..C.computed_attributeNcSs||_||_||_dSr)_computed_attribute__get_computed_attribute__set_computed_attribute__delete)r6rr0deleter;r;r<r0szNClassPropertiesAndMethods.test_compattr..C.computed_attribute.__init__cSs ||Sr)r2)r6rrDr;r;r<rszMClassPropertiesAndMethods.test_compattr..C.computed_attribute.__get__cSs |||Sr)r3r6rrr;r;r<rszMClassPropertiesAndMethods.test_compattr..C.computed_attribute.__set__cSs ||Sr)r4r6rr;r;r< __delete__szPClassPropertiesAndMethods.test_compattr..C.computed_attribute.__delete__)NN)N)rrrr0rrr8r;r;r;r<computed_attributes  r9cSs d|_dSr_C__xrxr;r;r<r0sz;ClassPropertiesAndMethods.test_compattr..C.__init__cSs|j}|d|_|Srr:r6r;r;r<Z__get_xs z:ClassPropertiesAndMethods.test_compattr..C.__get_xcSs ||_dSrr:r6r;r;r<Z__set_xsz:ClassPropertiesAndMethods.test_compattr..C.__set_xcSs|`dSrr:rxr;r;r<Z __delete_xsz=ClassPropertiesAndMethods.test_compattr..C.__delete_xN) rrrr r9r0Z _C__get_xZ _C__set_xZ _C__delete_xr7r;r;r;r<rs  rrrer r7)r rBr7rrr;r;r< test_compattrsz'ClassPropertiesAndMethods.test_compattrcCshGdddt}|}||jd||j|Gddd|}|}||jd||j|dS)Nc@seZdZddZddZdS)z2ClassPropertiesAndMethods.test_newslots..CcSst|}d|_|Sr)r2rr)rr6r;r;r<rs z:ClassPropertiesAndMethods.test_newslots..C.__new__cSs|jd|_dS)Nrfrrxr;r;r<r0sz;ClassPropertiesAndMethods.test_newslots..C.__init__Nrrrrr0r;r;r;r<rsrrhc@s eZdZdS)z2ClassPropertiesAndMethods.test_newslots..DNrr;r;r;r<rsr)r2rBrr)r6rr?rrRr;r;r< test_newslotssz'ClassPropertiesAndMethods.test_newslotscCsz|ttj|ttjd|ttjt|ttjtGdddt}|t|Gdddt}|t|dS)Nrc@seZdZejZdSz1ClassPropertiesAndMethods.test_bad_new..CN)rrrr2rr;r;r;r<rsrc@seZdZejZdSrA)rrrr rr;r;r;r<rs)rgrr rr2rr;r;r< test_bad_news z&ClassPropertiesAndMethods.test_bad_newcCs4Gdddt}t||ttj|dt||ttj|dGdddt}t|t|dt|d|ttj|ddGdddt}t||ttj|dt|dt|ddGdddt}t||ttj|dt|d|ttj|dddS)Nc@s eZdZdS)4ClassPropertiesAndMethods.test_object_new..ANrr;r;r;r<rsrruc@seZdZddZdS)rCcSs ||_dSrr>r6rr;r;r<r0s=ClassPropertiesAndMethods.test_object_new..A.__init__Nrr;r;r;r<rsrhc@seZdZddZdS)rCcSs t|Srr rrrr;r;r<rs.A.__new__Nrr;r;r;r<rsc@seZdZddZddZdS)rCcSs t|SrrFrGr;r;r<rsrHcSs ||_dSrr>rDr;r;r<r0 srENr?r;r;r;r<rs)r rrgrr0r6rr;r;r<test_object_news(      z)ClassPropertiesAndMethods.test_object_newcCsGdddt}|t|Gddd|}t$tdt|d}Wdn1s^0Y||jd||j ||` |t||` t$tdt|d}Wdn1s0Y||jd||j |dS)Nc@seZdZddZdS)z=ClassPropertiesAndMethods.test_restored_object_new..Ac_stdSrAssertionError)rr7r8r;r;r<rszEClassPropertiesAndMethods.test_restored_object_new..A.__new__Nrr;r;r;r<rsrc@seZdZejZddZdS)z=ClassPropertiesAndMethods.test_restored_object_new..BcSs ||_dSrr>rDr;r;r<r0szFClassPropertiesAndMethods.test_restored_object_new..B.__init__N)rrrr rr0r;r;r;r<r#sr#errorrh) r rgrLwarningscatch_warnings simplefilterDeprecationWarningrBrrr)r6rr#rRr;r;r<test_restored_object_news    &   &z2ClassPropertiesAndMethods.test_restored_object_newc CsDGdddt}Gddd|}Gddd|}Gddd||}|||tg||j|tf||||tg||j||tf||||tg||j||tf||||||tg||j||||tf||dGd d d t}Gd d d |||||d }||jt|||||f||dz:Gdddt}Gdd d t|d }t|}d|d<WntyYn 0|dz(Gdddt}Gdd d t|d }WntyYn 0|dz(Gdddt}Gdd d t|d }Wnty4Yn 0|ddS)Nc@seZdZddZdS)z0ClassPropertiesAndMethods.test_altmro..AcSsdSrr;rxr;r;r<r+rz2ClassPropertiesAndMethods.test_altmro..A.fNrrrrr;r;r;r<r*src@s eZdZdS)z0ClassPropertiesAndMethods.test_altmro..BNrr;r;r;r<r#,sr#c@seZdZddZdS)z0ClassPropertiesAndMethods.test_altmro..CcSsdSr&r;rxr;r;r<r/rz2ClassPropertiesAndMethods.test_altmro..C.fNrSr;r;r;r<r.src@s eZdZdS)z0ClassPropertiesAndMethods.test_altmro..DNrr;r;r;r<r0src@seZdZddZdS)z?ClassPropertiesAndMethods.test_altmro..PerverseMetaTypecSst|}||Sr)rDmroreverse)rLr;r;r<rT=s zCClassPropertiesAndMethods.test_altmro..PerverseMetaType.mroNrrrrTr;r;r;r<PerverseMetaType<srXc@s eZdZdSz0ClassPropertiesAndMethods.test_altmro..XNrr;r;r;r<rWAsrWrc@seZdZddZdS)9ClassPropertiesAndMethods.test_altmro.._metaclasscSs |ttgSr)rr rxr;r;r<rTHs=ClassPropertiesAndMethods.test_altmro.._metaclass.mroNrWr;r;r;r<rGsrc@s eZdZdSrYrr;r;r;r<rWJsrvruzdevious mro() return not caughtc@seZdZddZdS)rZcSsdgSrr;rxr;r;r<rT[sr[NrWr;r;r;r<rZsc@s eZdZdSrYrr;r;r;r<rW]sz!non-class mro() return not caughtc@seZdZddZdS)rZcSsdSrr;rxr;r;r<rTfsr[NrWr;r;r;r<resc@s eZdZdSrYrr;r;r;r<rWhsz$non-sequence mro() return not caught) r rBrTrrrDrrr) r6rr#rrrXrWrr7r;r;r< test_altmro(sJ    z%ClassPropertiesAndMethods.test_altmrocsGdddtGfddd}|}||jdd|_||jd|`||jd||dd d |d<||jd |d=||jd||d d dtd d fd|d d <||jtd d df|d d =||jtd d dS)Nc@seZdZdZdS)z5ClassPropertiesAndMethods.test_overloading..Bz.CcSs|dkrd|fStdS)NrrErrir;r;r<rvszAClassPropertiesAndMethods.test_overloading..C.__getattr__cs&|dkr||f|_n|||SdSNr)rrnror#r;r<rn{s zAClassPropertiesAndMethods.test_overloading..C.__setattr__cs |dkr||_n ||SdSr^)rprqrir_r;r<rqszAClassPropertiesAndMethods.test_overloading..C.__delattr__cSsd|fS)Ngetitemr;rr;r;r<rUszAClassPropertiesAndMethods.test_overloading..C.__getitem__cSs||f|_dSr)setitem)r6rrr;r;r<raszAClassPropertiesAndMethods.test_overloading..C.__setitem__cSs ||_dSr)delitemrr;r;r< __delitem__szAClassPropertiesAndMethods.test_overloading..C.__delitem__N) rrrrrnrqrUrarcr;r_r;r<rus   rrsr)rrr)r`r)rrdrrr`)r rBrrrprarbrXrr;r_r<test_overloadingos$  z*ClassPropertiesAndMethods.test_overloadingcsGdddtd|dGfddd}|d}||d||d||dGfdddt}||jjj|tjd d dS) Nc@seZdZddZddZdS)z1ClassPropertiesAndMethods.test_methods..CcSs ||_dSrr7r6r;r;r<r0sz:ClassPropertiesAndMethods.test_methods..C.__init__cSs|jSrrfrxr;r;r<rsz5ClassPropertiesAndMethods.test_methods..C.fooN)rrrr0rr;r;r;r<rsrrecseZdZjZjZdS)z1ClassPropertiesAndMethods.test_methods..DN)rrrrrrr;rc1r;r<rsrrfcseZdZjZdS)z1ClassPropertiesAndMethods.test_methods..ENrr;rr;r<r,sr,r/) r rBrrrr0rrrr )r6rr'r,r;rgr< test_methodssz&ClassPropertiesAndMethods.test_methodsz)testing error message from implementationcCstj}d}|t}|Wdn1s00Y||jjd|d}|t}|dWdn1sz0Y||jjd||t}|dWdn1s0Y||jjd|dS)Nz*unbound method set.add() needs an argumentrzBdescriptor 'add' for 'set' objects doesn't apply to a 'int' object)r0rrgrrBr%r7r)r6Zset_addr(rr;r;r<test_methods_in_cs $ & (z+ClassPropertiesAndMethods.test_methods_in_ccsdd}dd}dd}dd}d d }d d }d d}d=dd}dd} dd} fdd} fdd} dd} dd}dt|tifdt|tifdt|t||d fd!tj|tifd"| |tifd#| | td$ifd%| |td&ifd'||td(| ifd(|| td'|ifd)t|tifd*t|tifd+tj |tifd,tj |tifd,t |tifd-tj |tifd.t |tifd/t|tifg}Gfd0d1d1t}Gfd2d3d3t}Gd4d5d5tGfd6d7d7t}|D]\}}}}Gd8d9d9|}|D]\}}t|||qt|||||gGd:d9d9|}|D]\}}t|||qJt||||||d;g|GdNcSs(|Wdn1s0YdSrr;)managerr;r;r< run_contextszIClassPropertiesAndMethods.test_special_method_lookup..run_contextcSs|Srr;rxr;r;r<idenszBClassPropertiesAndMethods.test_special_method_lookup..idencSsdS)Nshellor;rxr;r;r<rszCClassPropertiesAndMethods.test_special_method_lookup..hellocSsgSrr;rxr;r;r< empty_seqszGClassPropertiesAndMethods.test_special_method_lookup..empty_seqcSsdSrr;rxr;r;r<zeroszBClassPropertiesAndMethods.test_special_method_lookup..zerocSsdS)N?r;rxr;r;r< complex_numszIClassPropertiesAndMethods.test_special_method_lookup..complex_numcSstdSr) StopIterationrxr;r;r<rszBClassPropertiesAndMethods.test_special_method_lookup..stopcSsdS)NTr;)r6thingr;r;r< return_trueszIClassPropertiesAndMethods.test_special_method_lookup..return_truecSs tt|Sr)rr)rr;r;r< do_isinstanceszKClassPropertiesAndMethods.test_special_method_lookup..do_isinstancecSs tt|Sr)rr)rur;r;r< do_issubclassszKClassPropertiesAndMethods.test_special_method_lookup..do_issubclasscs*Gddd|jt}|dddS)Nc@s eZdZdS)z^ClassPropertiesAndMethods.test_special_method_lookup..do_dict_missing..DictSubNrr;r;r;r<DictSubsrxhirk)rrrB)Zcheckerrxrxr;r<do_dict_missingszMClassPropertiesAndMethods.test_special_method_lookup..do_dict_missingcs|ddS)Nryrk)rB)rrrxr;r< some_numbers zIClassPropertiesAndMethods.test_special_method_lookup..some_numbercWsdSrr;r7r;r;r<swallowrzEClassPropertiesAndMethods.test_special_method_lookup..swallowcSsdSNrr;)r6specr;r;r< format_implszIClassPropertiesAndMethods.test_special_method_lookup..format_impl __bytes__ __reversed____length_hint__)r~__next__ __sizeof____instancecheck__ __missing__r__subclasscheck__rG __enter____exit__ __complex__ __format__ __floor__ __trunc____ceil____dir__ __round__cs(eZdZfddZffdd ZdS)zEClassPropertiesAndMethods.test_special_method_lookup..CheckercSs|d|dS)Nz__getattr__ called with {0})rformatr6rtestr;r;r<r szQClassPropertiesAndMethods.test_special_method_lookup..Checker.__getattr__cs$|vr|d|t||S)Nz __getattribute__ called with {0})rrr rkr)okr;r<rk szVClassPropertiesAndMethods.test_special_method_lookup..Checker.__getattribute__Nrrrrrkr;)rr6r;r<Checker s rcs eZdZddZfddZdS)zJClassPropertiesAndMethods.test_special_method_lookup..SpecialDescrcSs ||_dSr)impl)r6rr;r;r<r0szSClassPropertiesAndMethods.test_special_method_lookup..SpecialDescr.__init__csd|j||Sr)r|rrr6rownerrecordr;r<rs zRClassPropertiesAndMethods.test_special_method_lookup..SpecialDescr.__get__N)rrrr0rr;rr;r< SpecialDescrsrc@s eZdZdS)zIClassPropertiesAndMethods.test_special_method_lookup..MyExceptionNrr;r;r;r< MyExceptionsrcseZdZfddZdS)zFClassPropertiesAndMethods.test_special_method_lookup..ErrDescrcsdSrr;rrr;r<rszNClassPropertiesAndMethods.test_special_method_lookup..ErrDescr.__get__Nrrrrr;rr;r<ErrDescrsrc@s eZdZdSz?ClassPropertiesAndMethods.test_special_method_lookup..XNrr;r;r;r<rWsrWc@s eZdZdSrrr;r;r;r<rW&srec@s eZdZdSrrr;r;r;r<rW.s)N)rr0reversedr2r getsizeofrrmathfloortruncr)ceildirroundr  Exceptionr3rrBrg)r6rlrmrrnrorqrrtrvrwrzr{r}rZspecialsrrrr9ZrunnerZ meth_implenvrWrrr;)rrrr6r<test_special_method_lookupsx       z4ClassPropertiesAndMethods.test_special_method_lookupc CsGdddt}|}|}|| |t|t|t|t|||||||k|||k|||k|t| dd|t|t || d|t dD]}| ||q| d|Gdddt}|}|}|| |t|t|t|t||||||||||k|||k|t| d d|t|t || d|t dD]}| ||q| d|Gd d d t}|d} |d } |d} || || |t| td|| | || | || | k|| | || | k|| | k|| | k|| | k|t| d |t | d|t d} | d| t dD]}| || q| d| dS)Nc@seZdZddZdS)z2ClassPropertiesAndMethods.test_specials..CcSs$d|krdkrnn|StdSNrr IndexErrorrr;r;r<rU;sz>ClassPropertiesAndMethods.test_specials..C.__getitem__Nrr;r;r;r<r:srz C object at rrrc@seZdZddZdS)z2ClassPropertiesAndMethods.test_specials..DcSs$d|krdkrnn|StdSrrrr;r;r<rURsz>ClassPropertiesAndMethods.test_specials..D.__getitem__Nrr;r;r;r<rQsrz D object at c@sleZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZdS)z6ClassPropertiesAndMethods.test_specials..ProxycSs ||_dSrrfr6r;r;r<r0isz?ClassPropertiesAndMethods.test_specials..Proxy.__init__cSs |j Srrfrxr;r;r<rksz?ClassPropertiesAndMethods.test_specials..Proxy.__bool__cSs t|jSr)hashr7rxr;r;r<__hash__msz?ClassPropertiesAndMethods.test_specials..Proxy.__hash__cSs |j|kSrrfrr;r;r<rosz=ClassPropertiesAndMethods.test_specials..Proxy.__eq__cSs |j|kSrrfrr;r;r<__ne__qsz=ClassPropertiesAndMethods.test_specials..Proxy.__ne__cSs |j|kSrrfrr;r;r<__ge__ssz=ClassPropertiesAndMethods.test_specials..Proxy.__ge__cSs |j|kSrrfrr;r;r<__gt__usz=ClassPropertiesAndMethods.test_specials..Proxy.__gt__cSs |j|kSrrfrr;r;r<__le__wsz=ClassPropertiesAndMethods.test_specials..Proxy.__le__cSs |j|kSrrfrr;r;r<__lt__ysz=ClassPropertiesAndMethods.test_specials..Proxy.__lt__cSs d|jS)NzProxy:%srfrxr;r;r<r{sz>ClassPropertiesAndMethods.test_specials..Proxy.__str__cSs d|jS)Nz Proxy(%r)rfrxr;r;r<r}sz?ClassPropertiesAndMethods.test_specials..Proxy.__repr__cSs ||jvSrrfrr;r;r<rjszCClassPropertiesAndMethods.test_specials..Proxy.__contains__N)rrrr0rrrrrrrrrrrjr;r;r;r<ProxyhsrrezProxy:0zProxy(0))r rridrrBrZassertGreaterEqualrfindr assertNotInrre) r6rrhc2rrr&r'rZp0Zp1Zp_1Zp10r;r;r< test_specials5sp                  z'ClassPropertiesAndMethods.test_specialsc Csddl}Gdddt}|}||}|||~t||d~Gdddt}|}z||Wn4ty}z|dt|WYd}~nd}~00| dGdd d t}|} || }||| ~ t||d~dS) Nrc@s eZdZdS)z2ClassPropertiesAndMethods.test_weakrefs..CNrr;r;r;r<rsrc@seZdZdgZdS)z7ClassPropertiesAndMethods.test_weakrefs..NoWeakrNrr;r;r;r<NoWeaksrzweak referencez!weakref.ref(no) should be illegalc@seZdZddgZdS)z5ClassPropertiesAndMethods.test_weakrefs..WeakrrNrr;r;r;r<Weaksr) weakrefr refrBrrrrerr) r6rrrWrrnorrZyesr;r;r< test_weakrefss0 &  z'ClassPropertiesAndMethods.test_weakrefsc CsGdddt}|}||dd|_||jd||jd|`||d||d|j|d||j|d|j|||d|jd}| |t t |}| d|| d|| d || d |||j d ||j|jd ||j|jd ||j|jddD]v}zt||dWnPty}z6t|ddkr|d|t|fWYd}~nd}~00|d|q6d|_ ||j dGdddt}|}z|D]} t| qWntyYn 0|ddS)Nc@s4eZdZddZddZddZeeeeddZd S) z4ClassPropertiesAndMethods.test_properties..CcSs|jSrr:rxr;r;r<getxsz9ClassPropertiesAndMethods.test_properties..C.getxcSs ||_dSrr:rr;r;r<setxsz9ClassPropertiesAndMethods.test_properties..C.setxcSs|`dSrr:rxr;r;r<delxsz9ClassPropertiesAndMethods.test_properties..C.delxI'm the x property.docN)rrrrrrr-r7r;r;r;r<rsrr7rr;rrfgetfsetfdelrrrr)rrrreadonlyrzQwhen setting readonly attr %r on a property, got unexpected AttributeError msg %rzIexpected AttributeError from trying to set readonly %r attr on a propertyc@seZdZeddZdS)z4ClassPropertiesAndMethods.test_properties..DcSsddSrr;)rr;r;r<rrz=ClassPropertiesAndMethods.test_properties..D.N)rrrr-rUr;r;r;r<rsrz,expected ZeroDivisionError from bad property)r rr7rBr;rrr8rFrr-rrerrrrrrrrrrZeroDivisionError) r6rr?rawattrsrrrrJrr;r;r<test_propertiessZ             z)ClassPropertiesAndMethods.test_propertiesrfz)Docstrings are omitted with -O2 and abovecsGfdddt}dS)NcsJeZdZddZddZeeZejdeedZ e jddS)z?ClassPropertiesAndMethods.test_properties_doc_attrib..EcSsdS) getter methodrr;rxr;r;r<getterszFClassPropertiesAndMethods.test_properties_doc_attrib..E.gettercSsdS)z setter methodNr;)rrr;r;r<setterszFClassPropertiesAndMethods.test_properties_doc_attrib..E.setterr)rN) rrrrrr-ZproprBrZprop2r;rxr;r<r,s  r,r )r6r,r;rxr<test_properties_doc_attribsz4ClassPropertiesAndMethods.test_properties_doc_attribcs8z ddlWntyYn0Gfdddt}dS)NrcseZdZejZdS)z>ClassPropertiesAndMethods.test_testcapi_no_segfault..XN)rrrr-Ztest_with_docstringpr; _testcapir;r<rW srW)r ImportErrorr r6rWr;rr<test_testcapi_no_segfault s   z3ClassPropertiesAndMethods.test_testcapi_no_segfaultcsGdddt}|jjd||dd|_||d||jd||jd|`||d||dGfdd d }|}d |_||jd |`|`Gd d d t}d|_||jd|`Gfd dd}|}d|_||jd|`dS)Nc@s@eZdZeddZejddZejddZejddZdS)z9ClassPropertiesAndMethods.test_properties_plus..CrrcSs|jSr_foorxr;r;r<r sz=ClassPropertiesAndMethods.test_properties_plus..C.foocSst||_dSrr'rrr;r;r<r scSs|`dSrrrxr;r;r<r sN)rrrr-rrrdeleterr;r;r;r<r s   rrrirrcseZdZjjddZdS)z9ClassPropertiesAndMethods.test_properties_plus..DcSs z|`WntyYn0dSr)rrrxr;r;r<r' s z=ClassPropertiesAndMethods.test_properties_plus..D.fooN)rrrrrr;rr;r<r& srrc@sDeZdZeddZejddZejddZejdddZdS)z9ClassPropertiesAndMethods.test_properties_plus..EcSs|jSrrrxr;r;r<r4 sz=ClassPropertiesAndMethods.test_properties_plus..E.foocSstdSr) RuntimeErrorrr;r;r<r7 scSst||_dSrrrr;r;r<r: sNcSs|`dSrrrr;r;r<r= s)N)rrrr-rrrr;r;r;r<r,3 s   r,cs*eZdZjjddZejddZdS)z9ClassPropertiesAndMethods.test_properties_plus..FcSs|`dSrrrxr;r;r<rG sz=ClassPropertiesAndMethods.test_properties_plus..F.foocSstd||_dSr)maxrrr;r;r<rJ sN)rrrrrrr;)r,r;r<rcF s rcr)r rBrrrrr)r6rWrrJrrcrr;)rr,r<test_properties_plus s6     z.ClassPropertiesAndMethods.test_properties_plusc Cst}||iti}||itddd}||ddd||tt|||tt|tddd}||tddd||tfi|||tddidd||tdgdd ||td d gfi|||tfi|d d d dd gdfD]b}z t|Wn@tyDYn<typ|dkr^n|d|Yn0|d|q ztiiWntyYn 0|dGddd}zt|WntyYn 0|ddd|_dd|_ t|}|||jGddd}t|dd|dd|dd|ddg}||dddtt t dt dd }||td!d"t dDd#gd$gfD]6}z t|WntyYn0|d%|qdS)&NrfrR)rer?re)onetwor)r)rrf)r)rr)rrry0rzno TypeError from dict(%r)zno TypeError from dict({}, {})c@seZdZddddZdS)zAClassPropertiesAndMethods.test_dict_constructors..Mappingrfrkrp)rerhr?N)rrrrr;r;r;r<Mapping{ srz*no TypeError from dict(incomplete mapping)cSst|jSr)r2rr{rxr;r;r<r rzBClassPropertiesAndMethods.test_dict_constructors..cSs |j|Sr)rrr;r;r<r rc@seZdZddZddZdS)zJClassPropertiesAndMethods.test_dict_constructors..AddressBookEntrycSs||_||_dSr)firstlast)r6rrr;r;r<r0 szSClassPropertiesAndMethods.test_dict_constructors..AddressBookEntry.__init__cSst|j|jgSr)r}rrrxr;r;r<r~ szSClassPropertiesAndMethods.test_dict_constructors..AddressBookEntry.__iter__N)rrrr0r~r;r;r;r<AddressBookEntry srTimZWarsawBarryZPeters)rrrkrucSsg|]}||dfqSr*r;r|r;r;r<r~ rzDClassPropertiesAndMethods.test_dict_constructors..)Ztooshort)Ztoolongzby 1zno ValueError from dict(%r)) rrBr2r3r}r ValueErrorrr{rUzipr)r6rJZbadargrrZbadr;r;r<test_dict_constructorsR sn           z0ClassPropertiesAndMethods.test_dict_constructorsc s.d}|tddg~dddddgddd ddit|jf D] }t|q:d d }Gd d d t}ddg}||t|||}||t||d|_dd|_||t||ddgGddd|}ddg|}||t|||} ||t| |d| _dd| _||t| |ddgGdddtt } | d} d| _ d| _ gd fd!d"t| D} || d#d$gGd%d&d&| } | d'}d|_ d|_ ||j d(z t|Wnt yYn0|ttttGfd)d*d*tGfd+d d t}t|dS),Nrjunkr6rfy@g@22rfcSsdd|DS)NcSsg|]}|ds|qS)r)r )r}rr;r;r<r~ rzKClassPropertiesAndMethods.test_dir..interesting..r;)stringsr;r;r< interesting sz7ClassPropertiesAndMethods.test_dir..interestingc@seZdZdZddZdS)-ClassPropertiesAndMethods.test_dir..CrecSsdSrr;rxr;r;r<Cmethod rz5ClassPropertiesAndMethods.test_dir..C.CmethodN)rrrCdatarr;r;r;r<r srrrcSsdSrr;rxr;r;r<r rz4ClassPropertiesAndMethods.test_dir..cdatacmethodc@seZdZdZddZdS)z-ClassPropertiesAndMethods.test_dir..ArecSsdSrr;rxr;r;r<Amethod rz5ClassPropertiesAndMethods.test_dir..A.AmethodN)rrrAdatarr;r;r;r<r srrrrcSsdS)Nrhr;rxr;r;r<r radataamethodc@s eZdZdS)z-ClassPropertiesAndMethods.test_dir..MNrr;r;r;r<M srrLre)rr __package__ __loader____spec__csg|]}|vr|qSr;r;r}r7)default_attributesr;r<r~ rz6ClassPropertiesAndMethods.test_dir..r?rRc@seZdZddZeeZdS)z.ClassPropertiesAndMethods.test_dir..M2cSsdS)N Not a dict!r;rxr;r;r<getdict sz6ClassPropertiesAndMethods.test_dir..M2.getdictN)rrrr r-rFr;r;r;r<r srZm2r cs<eZdZddZddZfddZddZfd d Zd S) z3ClassPropertiesAndMethods.test_dir..WrappercSs ||_dSr _Wrapper__objr7r;r;r<r0 sz.Wrapper.__init__cSsdt|jS)Nz Wrapper(%s))rr rxr;r;r<r sz.Wrapper.__repr__cs|j|Srr rWrapperr;r<rU sz?ClassPropertiesAndMethods.test_dir..Wrapper.__getitem__cSs t|jSr)rr rxr;r;r<r> sz;ClassPropertiesAndMethods.test_dir..Wrapper.__len__cst|j|Sr)rEr rirr;r<r sz?ClassPropertiesAndMethods.test_dir..Wrapper.__getattr__N)rrrr0rrUr>rr;rr;r<r s  rcs eZdZfddZeeZdS)rcs t|Srr{rxrr;r<Z __getclass sz8ClassPropertiesAndMethods.test_dir..C.__getclassN)rrrZ _C__getclassr-rr;rr;r<r s )rBrrDtest_dirr rrrrrrRr?rFrEllipsis)r6rrrrZcstuffrWrZastuffr?rZ minstancenamesrZ m2instancer;)rr r<r sT&      z"ClassPropertiesAndMethods.test_dircsGdddt}||ddGfddd||ddGd d d |}t||_||d d Gfd dd||ddGfdddtGfddd|ddGddd}||_||ddztdWnty2Yn 0|dzt|WntybYn 0|dztdWntyYn 0|dzt|WntyYn 0|d Gd!d"d"t}Gd#d$d$|}|}||j d%|t||j dGd&d'd't}Gfd(d)d)|| |j | tt|dd*Wdn1s0YdS)+Nc@seZdZddZdS)z0ClassPropertiesAndMethods.test_supers..AcSsd|S)NzA(%r)r;r6r?r;r;r<rI sz5ClassPropertiesAndMethods.test_supers..A.methNr r;r;r;r<r srrezA(1)cs&eZdZfddZddZZS)z0ClassPropertiesAndMethods.test_supers..Bcst||_dSr)rr%rx)r#rr;r<r0 sz9ClassPropertiesAndMethods.test_supers..B.__init__cSsd||j|S)NzB(%r)r$rr;r;r<rI sz5ClassPropertiesAndMethods.test_supers..B.meth)rrrr0rIrr;r_rr<r# sr#rfzB(2)A(2)c@seZdZddZdS)z0ClassPropertiesAndMethods.test_supers..CcSsd||j|S)NzC(%r)r'rr;r;r<rI sz5ClassPropertiesAndMethods.test_supers..C.methNr r;r;r;r<r srrhzC(3)A(3)cseZdZfddZZS)z0ClassPropertiesAndMethods.test_supers..Dcsd|t||S)NzD(%r))rrIr)rrr;r<rI sz5ClassPropertiesAndMethods.test_supers..D.meth)rrrrIrr;rrr<r srrkzD(4)C(4)B(4)A(4)cseZdZfddZZS)z6ClassPropertiesAndMethods.test_supers..mysupercst|j|Srrr=)rmysuperr;r<r0$ sz?ClassPropertiesAndMethods.test_supers..mysuper.__init__)rrrr0rr;)rrr<r# srcseZdZfddZdS)z0ClassPropertiesAndMethods.test_supers..Ecsd|||S)NzE(%r))rIrr,rr;r<rI( sz5ClassPropertiesAndMethods.test_supers..E.methNr r;rr;r<r,' sr,ruzE(5)D(5)C(5)B(5)A(5)c@seZdZddZdS)z0ClassPropertiesAndMethods.test_supers..FcSs |j}d||jjf||S)Nz F(%r)[%s]) _F__superrrrI)r6r?rr;r;r<rI. sz5ClassPropertiesAndMethods.test_supers..F.methNr r;r;r;r<rc- srcrvz!F(6)[mysuper]E(6)D(6)C(6)B(6)A(6)rzshouldn't allow super(D, 42)zshouldn't allow super(D, C())rz$shouldn't allow super(D).__get__(12)z%shouldn't allow super(D).__get__(C())c@seZdZddZeeZdS)z5ClassPropertiesAndMethods.test_supers..DDbasecSsdSrr;rxr;r;r<rW rz:ClassPropertiesAndMethods.test_supers..DDbase.getxNrrrrr-r7r;r;r;r<DDbaseV src@seZdZddZeeZdS)z4ClassPropertiesAndMethods.test_supers..DDsubcSsdSr~r;rxr;r;r<r[ rz9ClassPropertiesAndMethods.test_supers..DDsub.getxNrr;r;r;r<DDsubZ srrc@seZdZeddZdS)z3ClassPropertiesAndMethods.test_supers..BasecSsdSr^r;rxr;r;r<rf rz.Base.N)rrrr-aPropr;r;r;r<Basee srcs"eZdZefddZZS)z2ClassPropertiesAndMethods.test_supers..Subcs t|jSr)rr)klass)Subrr;r<ri sz7ClassPropertiesAndMethods.test_supers..Sub.test)rrrrLrrr;)rrr<rh srr) r rBrIrr(rrrrr7rrrg)r6rrrcrrddrr)r#rr,rrr< test_supers sZ       z%ClassPropertiesAndMethods.test_superscsGfdddt|tddd|tdddd}||d|t|d|t|jt|t|td|| jt||d ?jt||d >jt|d d >jt|d d ?jtGfd d d t|td dd|tdddd}||d|t|d|t|td|t|jt|| jt|| jt|d  jt||d ?jt||d >jt||d jt||djt||djt||djt|d|jt||d Bjt||d Ajt||d@jt|d d >jt|d d ?jt|td jtGdddt}|d}||d jt|d |jt|d}||ji|t|dGdddt }|t|dd|d}||d|t |d|t |jt |t|td|| jt Gdddt }|dd}|t|dt dd}||jt ||||t |||t |jt ||}|t|d||||t |||t |jt |t|t||| jt ||d jt ||d |||d jt ||d |||djt ||d|||djt ||d|Gd d!d!t }|d"}||d"|| |d#|| |d"t d$D].}|t |}| } | } || |q@|d%}|t |d%|t |jt |t|td%||ddjt ||djt ||d jt ||d&jt |d&}|t |d&|t |jt |||jt ||d jt ||djt ||d'jt ||ddjt Gd(d)d)t} | d*} || d*|| | d+|| | d*t d,D]:}| d-ttt |} | }| } || | q| d.} |t| d.|t| jtd/}| |} || ||t| ||t| jt|t| t||| di|d||di| d|| d-jt|| d-||d-| jt|d-| ||| d jt|| d d-|| djt|| d||| d'jt|| d'|||| ddjt|| dd||| d d jt|| d d d-|| jt|| ||| jt|| ||| jt|| |i} || | jt|| | ||| d0d0jt|| d0d0||| t| jt|| t| ||| t| jt|| t| ||| t| jt|| t| ||| jt|| |Gd1d2d2t}|d3} || d3|| |d4|| |d3d.}||} |t| ||t| jt|t| t||| di|d||di| d|| jt|| ||| jt|| ||| jt|| ||| d0d0jt|| d0d0||| d5d5jt|| d5d5||| t| jt|| t| ||| t| jt|| t| ||| t| jt|| t| ||| jt|| ||| jt|| ||| jt|| ||| jt|| ||| d-jt|| d-||d-| jt|d-| ||| d jt|| d d-|| djt|| d||| d'jt|| d'|||| ddjt|| dd||| d d jt|| d d d-Gd6d7d7t}|t d}||tt d|d8||tt dd8gd|d<||tt d9| t d9d:||tt d:g|d;d<||tt d<|d=d<=|t|d=||tt d=|t|tt d=||d d ||dd||d>d ||dd||ddtt ddS)?Ncs eZdZddZfddZdS)z@ClassPropertiesAndMethods.test_basic_inheritance..hexintcSst|Sr)hexrxr;r;r<rw szIClassPropertiesAndMethods.test_basic_inheritance..hexint.__repr__cst||Sr)r)rPrhexintr;r<rPy szHClassPropertiesAndMethods.test_basic_inheritance..hexint.__add__N)rrrrrPr;r"r;r<r#v sr# Z0x10iZ0x3efi90rrcs.eZdZgZddZfddZeZZS)zAClassPropertiesAndMethods.test_basic_inheritance..octlongcSst|Sr)octrxr;r;r<r szIClassPropertiesAndMethods.test_basic_inheritance..octlong.__str__cs|t||Sr)rrrPr)roctlongr;r<rP szIClassPropertiesAndMethods.test_basic_inheritance..octlong.__add__)rrrrrrPrrr;)r'rr<r' sr'rhruZ0o10i Z0o5675rerc@s eZdZdS)zCClassPropertiesAndMethods.test_basic_inheritance..longcloneNrr;r;r;r< longclone sr(c@s$eZdZdgZd ddZddZdS) zCClassPropertiesAndMethods.test_basic_inheritance..precfloatrrrcSst||_dSr)r)r)r6rrr;r;r<r0 szLClassPropertiesAndMethods.test_basic_inheritance..precfloat.__init__cSsd|j|fS)Nrrrxr;r;r<r szLClassPropertiesAndMethods.test_basic_inheritance..precfloat.__repr__N)rr)rrrrr0rr;r;r;r< precfloat s r)g?z1.1g@c@seZdZddZdS)zDClassPropertiesAndMethods.test_basic_inheritance..madcomplexcSsd|j|jfS)Nz %.17gj%+.17grrrxr;r;r<r szMClassPropertiesAndMethods.test_basic_inheritance..madcomplex.__repr__N)rrrrr;r;r;r< madcomplex sr+rkz4j-3c@seZdZdZddZdS)zBClassPropertiesAndMethods.test_basic_inheritance..madtupleNcSs2|jdur|jSt|}||||_|jSr)_revr2rUrr6rVr;r;r<rev s   zFClassPropertiesAndMethods.test_basic_inheritance..madtuple.revrrrr-r/r;r;r;r<madtuple sr1) rerfrhrkrurvr$r%r) rr%r2r$rvrurkrhrfrei)rerfrhrkrur;rfc@seZdZdZddZdS)zCClassPropertiesAndMethods.test_basic_inheritance..madstringNcSs8|jdur|jSt|}||d||_|jSNrr-r2rUrrur.r;r;r<r/ s  zGClassPropertiesAndMethods.test_basic_inheritance..madstring.revr0r;r;r;r< madstring sr5abcdefghijklmnopqrstuvwxyzZzyxwvutsrqponmlkjihgfedcbarZ12345zr7c@seZdZdZddZdS)zDClassPropertiesAndMethods.test_basic_inheritance..madunicodeNcSs8|jdur|jSt|}||d||_|jSr3r4r.r;r;r<r/E s  zHClassPropertiesAndMethods.test_basic_inheritance..madunicode.revr0r;r;r;r< madunicodeC sr8ZABCDEFZFEDCBAZxyc@s eZdZdS)zAClassPropertiesAndMethods.test_basic_inheritance..sublistNrr;r;r;r<sublist~ sr9rrvrr)!r)rBrrrrrr'rFr*rrr/rrumaprstriplstriprstrip translatereplaceljustrrjustcenterlowerupper capitalizetitler2r|r)r6r?r(r)r+baser1rrKrrr5rZ identitytabr8r9r;)r#r'r<test_basic_inheritances s                     z0ClassPropertiesAndMethods.test_basic_inheritancec Cs|tdtddWdn1s,0Y|tdtddWdn1sb0Y|tdtddWdn1s0Y|tdddtdd|tdd d |td d d d|tdtt ddWdn1s0Y|tdt ddWdn1sL0Ytttttttt fD]8}z|ddWntyYn0| d|qjdS)Nzkeyword argumentrerfrfrir*ir500abcstrict)r errorsrrh)Zsequencer)Zbogus_keyword_argz4expected TypeError from bogus keyword argument to %r) ZassertRaisesRegexrr)r*boolrBrrrrr2r)r6 constructorr;r;r< test_keywords s.(((.* z'ClassPropertiesAndMethods.test_keywordscsGfdddt|dd|dd|tdddddd d d i}||dd||d d ||d d |d|||dd dS)Ncs,eZdZdZddZfddZddZdS) zFClassPropertiesAndMethods.test_str_subclass_as_dict_key..cistrzSubclass of str that computes __eq__ case-insensitively. Also computes a hash code of the string in canonical form. cSs||_t|j|_dSr)rF canonicalrhashcoderr;r;r<r0 s zOClassPropertiesAndMethods.test_str_subclass_as_dict_key..cistr.__init__cst|s|}|j|jkSr)rrSrcistrr;r<r s zMClassPropertiesAndMethods.test_str_subclass_as_dict_key..cistr.__eq__cSs|jSr)rTrxr;r;r<r szOClassPropertiesAndMethods.test_str_subclass_as_dict_key..cistr.__hash__N)rrrrr0rrr;rUr;r<rV s rVABCrZaBcrrerrfZtHreerhZtWoZTHrEEZONeZthrEE)rrBrer)r6rJr;rUr<test_str_subclass_as_dict_key sz7ClassPropertiesAndMethods.test_str_subclass_as_dict_keyc sGddd}|ttfD]}Gfddd|d}d}d}||d|||d}dD]}dD]}d D]v} |td | td | d ||f|td | td | d ||f|td| td | d ||fqtqlqdqdS)Nc@s eZdZdS)zCClassPropertiesAndMethods.test_classic_comparisons..classicNrr;r;r;r<classic srYcs\eZdZddZfddZfddZfddZfd d Zfd d Zfd dZ dS)z=ClassPropertiesAndMethods.test_classic_comparisons..CcSst||_dSrr)rrr;r;r<r0 szFClassPropertiesAndMethods.test_classic_comparisons..C.__init__cs8t|r|j|jkSt|ts*t|tr4|j|kStSrrrr)rrrr;r<r s    zDClassPropertiesAndMethods.test_classic_comparisons..C.__eq__cs8t|r|j|jkSt|ts*t|tr4|j|kStSrr[rrr;r<r s    zDClassPropertiesAndMethods.test_classic_comparisons..C.__ne__cs8t|r|j|jkSt|ts*t|tr4|j|kStSrr[rrr;r<r s    zDClassPropertiesAndMethods.test_classic_comparisons..C.__lt__cs8t|r|j|jkSt|ts*t|tr4|j|kStSrr[rrr;r<r s    zDClassPropertiesAndMethods.test_classic_comparisons..C.__le__cs8t|r|j|jkSt|ts*t|tr4|j|kStSrr[rrr;r<r s    zDClassPropertiesAndMethods.test_classic_comparisons..C.__gt__cs8t|r|j|jkSt|ts*t|tr4|j|kStSrr[rrr;r<r! s    zDClassPropertiesAndMethods.test_classic_comparisons..C.__ge__N) rrrr0rrrrrrr;rr;r<r s     rrerfrhrgrrrrrr c[x] %s c[y]x %s y x=%d, y=%d c[x] %s y x %s c[y])r)r rBrC) r6rYrJrhrc3rWr7yopr;rr<test_classic_comparisons s.(        z2ClassPropertiesAndMethods.test_classic_comparisonsc sZGdddt}|d}|dd|Gdddt}|d}|dd|Gdd d }|tttfD]}Gfd d d |d}d }d } |d||| d} dD]} dD]} dD]v} td| td| d| | ftd| td| d| | ftd| td| d| | fqqqqzdS)Nc@s eZdZdS)z:ClassPropertiesAndMethods.test_rich_comparisons..ZNrr;r;r;r<rY< srYrey?c@seZdZddZdS)z;ClassPropertiesAndMethods.test_rich_comparisons..ZZcSs(zt||dkWStYS0dS)Ngư>)r'rrr;r;r<rB szBClassPropertiesAndMethods.test_rich_comparisons..ZZ.__eq__Nrr;r;r;r<ZZA srfgׇP?c@s eZdZdS)z@ClassPropertiesAndMethods.test_rich_comparisons..classicNrr;r;r;r<rYK srYcsheZdZddZfddZfddZfddZfd d Zfd d Zfd dZ fddZ dS)z:ClassPropertiesAndMethods.test_rich_comparisons..CcSst||_dSrrZrr;r;r<r0O szCClassPropertiesAndMethods.test_rich_comparisons..C.__init__csddS)Nzshouldn't call __cmp__)r)rrrxr;r<__cmp__Q szBClassPropertiesAndMethods.test_rich_comparisons..C.__cmp__cs8t|r|j|jkSt|ts*t|tr4|j|kStSrr[rrr;r<rS s    zAClassPropertiesAndMethods.test_rich_comparisons..C.__eq__cs8t|r|j|jkSt|ts*t|tr4|j|kStSrr[rrr;r<rY s    zAClassPropertiesAndMethods.test_rich_comparisons..C.__ne__cs8t|r|j|jkSt|ts*t|tr4|j|kStSrr[rrr;r<r_ s    zAClassPropertiesAndMethods.test_rich_comparisons..C.__lt__cs8t|r|j|jkSt|ts*t|tr4|j|kStSrr[rrr;r<re s    zAClassPropertiesAndMethods.test_rich_comparisons..C.__le__cs8t|r|j|jkSt|ts*t|tr4|j|kStSrr[rrr;r<rk s    zAClassPropertiesAndMethods.test_rich_comparisons..C.__gt__cs8t|r|j|jkSt|ts*t|tr4|j|kStSrr[rrr;r<rq s    zAClassPropertiesAndMethods.test_rich_comparisons..C.__ge__N) rrrr0rgrrrrrrr;rr6r;r<rN s      rrfrhrgr\r]r^r_r`ra)rrBr)r r2rC)r6rYrrfzzrYrJrhrrbrWr7rcrdr;rhr<test_rich_comparisons: s>    )        z/ClassPropertiesAndMethods.test_rich_comparisonscs4ddlm}fdd}||jd|tjddS)Nr)FileIOcs|j|dSr)rBr)descrZwhatrxr;r<check sz6ClassPropertiesAndMethods.test_descrdoc..checkzTrue if the file is closedz!the real part of a complex number)_iorkclosedrr)r6rkrmr;rxr< test_descrdoc s   z'ClassPropertiesAndMethods.test_descrdoccsvGdddtGfddd}Gfdddt}||jd||jd||jd ||jd dS) Nc@seZdZddZdS)z?ClassPropertiesAndMethods.test_doc_descriptor..DocDescrcSs&|r|jjd}|r|j}d||fS)Nz instancezobject=%s; type=%s)rr)r6r Zotyper;r;r<r s  zGClassPropertiesAndMethods.test_doc_descriptor..DocDescr.__get__Nrr;r;r;r<DocDescr srqcseZdZZdS)z?ClassPropertiesAndMethods.test_doc_descriptor..OldClassNr]r;rqr;r<OldClass srscseZdZZdS)z?ClassPropertiesAndMethods.test_doc_descriptor..NewClassNr]r;rrr;r<NewClass srtzobject=None; type=OldClassz'object=OldClass instance; type=OldClasszobject=None; type=NewClassz'object=NewClass instance; type=NewClass)r rBr)r6rsrtr;rrr<test_doc_descriptor sz-ClassPropertiesAndMethods.test_doc_descriptorc s Gdddt}Gdddt}Gdddt}Gddd||}||||fD]D}||||fD]2}|}||_|j|||_|j|q^qNfd d }||t|t|||d ||t|tt|ttGd d d t} |dt|dtt} || td || td~ Gdddt} Gdddt} Gdddt} Gdddt}Gdddt}Gddd| }Gddd| }Gddd|}Gd d!d!|}Gd"d#d#|}Gd$d%d%|}| | f| | f| | f||f||ffD]n\}}|}d |_||_|j|d&||f|jd ||_|j|d&||f|jd q| |||||||t| f D]@}| |||||||t| f D] }||urq|||qqGd'd(d(tGfd)d*d*tfd+d,t d-D}~dS).Nc@s eZdZdS)z3ClassPropertiesAndMethods.test_set_class..CNrr;r;r;r<r rrc@s eZdZdS)z3ClassPropertiesAndMethods.test_set_class..DNrr;r;r;r<r rrc@s eZdZdS)z3ClassPropertiesAndMethods.test_set_class..ENrr;r;r;r<r, rr,c@s eZdZdS)z3ClassPropertiesAndMethods.test_set_class..FNrr;r;r;r<rc rrcc shz ||_WntyYn0d||fzt|dWnttfyTYn0d|dS)Nz!shouldn't allow %r.__class__ = %rrz shouldn't allow del %r.__class__)rrrrpr)r7rrxr;r<cant s  z6ClassPropertiesAndMethods.test_set_class..cantrec@seZdZgZdS)z5ClassPropertiesAndMethods.test_set_class..IntNrr;r;r;r<Int rrwTrfc@seZdZddgZdS)z3ClassPropertiesAndMethods.test_set_class..Gr?rRNrr;r;r;r<r src@seZdZddgZdS)z3ClassPropertiesAndMethods.test_set_class..HrRr?Nrr;r;r;r<r src@seZdZddgZdS)z3ClassPropertiesAndMethods.test_set_class..Ir?rRNrr;r;r;r<r src@seZdZddgZdS)z3ClassPropertiesAndMethods.test_set_class..JrWrRNrr;r;r;r<J srxc@seZdZgdZdS)z3ClassPropertiesAndMethods.test_set_class..K)r?rRrJNrr;r;r;r<K sryc@seZdZdgZdS)z3ClassPropertiesAndMethods.test_set_class..LrNrr;r;r;r<rV srVc@seZdZdgZdS)z3ClassPropertiesAndMethods.test_set_class..MrNrr;r;r;r<r src@seZdZdgZdS)z3ClassPropertiesAndMethods.test_set_class..NrNrr;r;r;r<r src@seZdZdgZdS)z3ClassPropertiesAndMethods.test_set_class..PrFNrr;r;r;r<P srzc@s eZdZdS)z3ClassPropertiesAndMethods.test_set_class..QNrr;r;r;r<Q sr{c@seZdZddgZdS)z3ClassPropertiesAndMethods.test_set_class..RrFrNrr;r;r;r<R sr|z0assigning %r as __class__ for %r silently failedc@s eZdZdS)z3ClassPropertiesAndMethods.test_set_class..ONrr;r;r;r<O sr}cseZdZfddZdS)z3ClassPropertiesAndMethods.test_set_class..Acs |_dSrrrxr}r;r<r sz;ClassPropertiesAndMethods.test_set_class..A.__del__Nrrrrr;r~r;r<r srcsg|] }qSr;r;r)rr;r<r~ rz.r) r rrr2r)rPrDr?rBr)r6rrr,rcrZcls2r7rvrworrrrxryrVrrrzr{r|rr;)rr}r6r<test_set_class st        *     z(ClassPropertiesAndMethods.test_set_classc sGdddt}|}ddi|_|jdfdd|d|g|d|`Gdddtfd d }Gd d d t}Gd ddt}Gdddt|d}Gdddt|d}|||fD]B}|||j} z d| d<WntyYq0d|qGdddtj} Gdddtj} | | fD] } | d} || d| jd<qFdd}Gdddt }Gdd d t }t ||fD]:}|}d!di|_|j d|||t qdS)"Nc@s eZdZdS)z2ClassPropertiesAndMethods.test_set_dict..CNrr;r;r;r<r rrrRrec s8z ||_Wnttfy Yn0d||fdS)Nz shouldn't allow %r.__dict__ = %r)rFrrr)r7rrxr;r<rv s  z5ClassPropertiesAndMethods.test_set_dict..cantc@s eZdZdS)z5ClassPropertiesAndMethods.test_set_dict..BaseNrr;r;r;r<r src s||iz|`Wnttfy(Yn0d|jd}z||iWnttfyhYn0d|dS)zR x has to be an instance of a class inheriting from Base. zshouldn't allow del %r.__dict__rFz&dict_descr allowed access to %r's dictN)rFrrrr)r7Z dict_descrrrvr6r;r<verify_dict_readonly s  zEClassPropertiesAndMethods.test_set_dict..verify_dict_readonlyc@s eZdZdS)z6ClassPropertiesAndMethods.test_set_dict..Meta1Nrr;r;r;r<Meta1% src@s eZdZdS)z6ClassPropertiesAndMethods.test_set_dict..Meta2Nrr;r;r;r<Meta2' src@s eZdZdS)z2ClassPropertiesAndMethods.test_set_dict..DNrr;r;r;r<r) srrc@s eZdZdS)z2ClassPropertiesAndMethods.test_set_dict..ENrr;r;r;r<r,+ sr,Zeggsrz%r's __dict__ can be modifiedc@s eZdZdS)z8ClassPropertiesAndMethods.test_set_dict..Module1Nrr;r;r;r<Module18 src@s eZdZdS)z8ClassPropertiesAndMethods.test_set_dict..Module2Nrr;r;r;r<Module2: src Ss*z|`Wnttfy YdS0dSdS)NFT)rFrr)rr;r;r<can_delete_dictE s z@ClassPropertiesAndMethods.test_set_dict..can_delete_dictc@s eZdZdS)z;ClassPropertiesAndMethods.test_set_dict..Exception1Nrr;r;r;r< Exception1L src@s eZdZdS)z;ClassPropertiesAndMethods.test_set_dict..Exception2Nrr;r;r;r< Exception2N srr?) r rFrBrRrDrrrrrr?r)r6rr?rrrrr,rZ class_dictrrrrrrrZ ExceptionTyperr;rr< test_set_dict sJ        z'ClassPropertiesAndMethods.test_set_dictcsGfdddt|tddd|tddd|tddd|tddd|tddd|tddd|ttddddGd d d t}dS) Ncs@eZdZddZfddZeZd fdd Zd fdd ZdS) zBClassPropertiesAndMethods.test_binary_operator_override..IcSs dt|S)NzI(%r)r)rxr;r;r<rY szKClassPropertiesAndMethods.test_binary_operator_override..I.__repr__cst|t|Srrrrr;r<rP[ szJClassPropertiesAndMethods.test_binary_operator_override..I.__add__Ncs>|durtt|t|Stt|t|t|SdSrrr)r6rrrr;r<__pow__^ szJClassPropertiesAndMethods.test_binary_operator_override..I.__pow__cs@|dur tt|t||Stt|t|t|SdSrrrrr;r<__rpow__c szKClassPropertiesAndMethods.test_binary_operator_override..I.__rpow__)N)N)rrrrrPrrrr;rr;r<rX s  rrerfzI(3)rhzI(8)ruc@seZdZddZdS)zBClassPropertiesAndMethods.test_binary_operator_override..ScSs||kSr)rFrr;r;r<rq szIClassPropertiesAndMethods.test_binary_operator_override..S.__eq__Nrr;r;r;r<Sp sr)r)rBrrr)r6rr;rr<test_binary_operator_overrideV s$z7ClassPropertiesAndMethods.test_binary_operator_overridec CszGdddt}Gddd|}Gddd|}Gddd||}|}t|}d d |_|t|d d d |_|t|d dd |_|t|ddd |_|t|dd|_|tt||`|t|dd|_|tt||`|t|d d|_|tt||`|t|d d|_|tt||`|t||d |_d |_||jd ||jd dd}||_||jd||jd dd}||_ ||j d||jd||jd |`||jd |`||jd||jd |` z |jWnt y6Yn 0| dGdddt}Gddd|}~t dd |_dS)Nc@s eZdZdSz>ClassPropertiesAndMethods.test_subclass_propagation..ANrr;r;r;r<rv src@s eZdZdSz>ClassPropertiesAndMethods.test_subclass_propagation..BNrr;r;r;r<r#x sr#c@s eZdZdS)z>ClassPropertiesAndMethods.test_subclass_propagation..CNrr;r;r;r<rz src@s eZdZdS)z>ClassPropertiesAndMethods.test_subclass_propagation..DNrr;r;r;r<r| srcSsdSrr;rxr;r;r<r rzEClassPropertiesAndMethods.test_subclass_propagation..rcSsdS)N:r;rxr;r;r<r rrcSsdS)Nr;rxr;r;r<r rrcSsdSrr;rxr;r;r<r rrcSs|dkr dSt||S)Nrr)r rkrir;r;r<rk szMClassPropertiesAndMethods.test_subclass_propagation..__getattribute__rcSs|dvr dSt|dS)N)rrrrrrir;r;r<r szHClassPropertiesAndMethods.test_subclass_propagation..__getattr__rzd.foo should be undefined nowc@s eZdZdSrrr;r;r;r<r sc@s eZdZdSrrr;r;r;r<r# scWsdSrr;rr;r;r<r r)r rrrBrgrrrrkrrrrrrra) r6rr#rrrJZ orig_hashrkrr;r;r<test_subclass_propagationt sv      z3ClassPropertiesAndMethods.test_subclass_propagationcCsddl}Gdddt}d}||}|||||Gdddt}|d}z|||dWnty~Yn0dS) Nrc@s eZdZdS)zBClassPropertiesAndMethods.test_buffer_inheritance..MyBytesNrr;r;r;r<r srrMc@s eZdZdS)z@ClassPropertiesAndMethods.test_buffer_inheritance..MyIntNrr;r;r;r<r srrz2subclass of int should not have a buffer interface)binasciirrBb2a_hexr)rr)r6rrrJrLrr;r;r<test_buffer_inheritance s  z1ClassPropertiesAndMethods.test_buffer_inheritancecsddlddl}Gfdddt}|d}|t|||tt|t|tt|t|t|d|t|d|t|d||d||d| }t ||dt t||d|| d | dS) Nrcs eZdZfddZddZdS)zGClassPropertiesAndMethods.test_str_of_str_subclass..octetstringcs|ddS)Nascii)rencodedecoderxrr;r<r szOClassPropertiesAndMethods.test_str_of_str_subclass..octetstring.__str__cSs|dS)Nz reprr;rxr;r;r<r szPClassPropertiesAndMethods.test_str_of_str_subclass..octetstring.__repr__N)rrrrrr;rr;r< octetstring s rrAZ41zA repr)filez41 41 ) riorrBrDrordrrStringIOprintrclose)r6rrrcapturer;rr<test_str_of_str_subclass s" z2ClassPropertiesAndMethods.test_str_of_str_subclasscCsDdd}||jdddt}tj|dddd||d dS) NcSs|Srr;rr;r;r<r rz;ClassPropertiesAndMethods.test_keyword_arguments..frruabc½€latin1rB)encodingrOsabc?)rBr bytearrayr0)r6rZbar;r;r<test_keyword_arguments sz0ClassPropertiesAndMethods.test_keyword_argumentscCsFGdddt}||_z |Wnty6Yn 0|ddS)Nc@s eZdZdS)z8ClassPropertiesAndMethods.test_recursive_call..ANrr;r;r;r<r srz7Recursion limit should have been reached for __call__())r rRecursionErrorrrIr;r;r<test_recursive_call s  z-ClassPropertiesAndMethods.test_recursive_callcsgGfdddt}|}|g~t|dgGdddt}|}z |d=WntytYn 0|ddS)NcseZdZfddZdS)z5ClassPropertiesAndMethods.test_delete_hook..CcsddSrr]rxrmr;r<rsz=ClassPropertiesAndMethods.test_delete_hook..C.__del__Nrr;rr;r<r srrec@s eZdZdS)z5ClassPropertiesAndMethods.test_delete_hook..DNrr;r;r;r<rrrrz$invalid del() didn't raise TypeError)r rBrrrr)r6rrWrrJr;rr<test_delete_hook s  z*ClassPropertiesAndMethods.test_delete_hookcCsGdddt}|}z t|Wnty4Yn 0|dGdddt}|}z t|WntytYn 0|ddS)Nc@s eZdZdS)z?ClassPropertiesAndMethods.test_hash_inheritance..mydictNrr;r;r;r<mydictsrz#hash() of dict subclass should failc@s eZdZdS)z?ClassPropertiesAndMethods.test_hash_inheritance..mylistNrr;r;r;r<mylist)srz#hash() of list subclass should fail)rrrrr2)r6rrJrr;r;r<test_hash_inheritances     z/ClassPropertiesAndMethods.test_hash_inheritancecCsz ddWntyYn 0|dzddWntyJYn 0|dzddgWntyxYn 0|dzddWntyYn 0|d z d dWntyYn 0|d z d iWntyYn 0|d z ddWnty$Yn 0|dz ddWntyPYn 0|dz ddWnty|Yn 0|dz ddWntyYn 0|d|dd|dd|ddd|ddddS)Nr?ruz'' + 5 doesn't raise TypeErrorrz%''.split('') doesn't raise ValueErrorrz$''.join([0]) doesn't raise TypeError5z'''.rindex('5') doesn't raise ValueErrorz%(n)sz&'%(n)s' % None doesn't raise TypeErrorz%(nz&'%(n' % {} '' doesn't raise ValueErrorz%*srz''%*s' % ('abc') doesn't raise TypeErrorz%*.*s)rruz,'%*.*s' % ('abc', 5) doesn't raise TypeErrorz%srerfz%'%s' % (1, 2) doesn't raise TypeError%z#'%' % None doesn't raise ValueErrorZ534253reZ534253xz%c)rrsplitrrurindexrBisdigitrxr;r;r<test_str_operations3sD          z-ClassPropertiesAndMethods.test_str_operationscCs2Gddd}|}|}||_||_t|}dS)Nc@s eZdZdS)z?ClassPropertiesAndMethods.test_deepcopy_recursive..NodeNrr;r;r;r<rcsr)rRr?r)r6rr?rRrr;r;r<test_deepcopy_recursiveas z1ClassPropertiesAndMethods.test_deepcopy_recursivecCsjddlm}||}t|||d||d||d||jd|_||jddidS)Nr)rr__file__rre) rrrrrrrFrrB)r6rrLr;r;r<test_uninitialized_modulesks      z4ClassPropertiesAndMethods.test_uninitialized_modulescsNGfdddt}Gddd|||dgd|dgdd}||jd|d}||||jdd}||||jdGdddt}||dd |dd fGd dd||dd dd fGd ddt}||dd ||dd fGd dd||dd dd fdS) NcseZdZfddZdS)3ClassPropertiesAndMethods.test_funny_new..Ccs4t|trgdSt|tr&tSt|SdS)Nrg)rrr)r rrrr;r<rzs;ClassPropertiesAndMethods.test_funny_new..C.__new__Nrr;rr;r<rysrc@seZdZddZdS)3ClassPropertiesAndMethods.test_funny_new..DcSs ||_dSrr>r6rr;r;r<r0sz.D.__init__Nrr;r;r;r<r~srrrgrec@seZdZeddZdS)rcWs|Srr;r|r;r;r<rsrN)rrrrrr;r;r;r<rsrfc@s eZdZdSrNrr;r;r;r<rsc@seZdZeddZdS)rcWs|Srr;r|r;r;r<rsrN)rrrrLrr;r;r;r<rsc@s eZdZdSrrr;r;r;r<rs)r rBrr)r6rrJr;rr<test_funny_newws(  z(ClassPropertiesAndMethods.test_funny_newcCsGdddt}|}|}|d9}|||df|}|d9}|||df|}|d9}|||df|}|d9}|||df|}|d9}|||df|}|d9}|||dfdS)Nc@seZdZddZdS)z2ClassPropertiesAndMethods.test_imul_bug..CcSs||fSrr;rr;r;r<rosz;ClassPropertiesAndMethods.test_imul_bug..C.__imul__N)rrrror;r;r;r<rsrrrfrhlrr rB)r6rr7rcr;r;r< test_imul_bugs(z'ClassPropertiesAndMethods.test_imul_bugcsddl}Gfdddt}|d}|d|jd|d||}|jd|d||}|jd|ddS)Nrcs<eZdZd ddZd ddZddZdd Zfd d ZdS)z7ClassPropertiesAndMethods.test_copy_setstate..CNcSs||_||_dSr)r_C__foorDr;r;r<r0sz@ClassPropertiesAndMethods.test_copy_setstate..C.__init__cSs ||_dSrr>rDr;r;r<setfoosz>ClassPropertiesAndMethods.test_copy_setstate..C.setfoocSs|jSr)rrxr;r;r<getfoosz>ClassPropertiesAndMethods.test_copy_setstate..C.getfoocSs|jgSrr>rxr;r;r< __getstate__szDClassPropertiesAndMethods.test_copy_setstate..C.__getstate__cs$t|d|d|_|_dSr)rBrrr)rlstrxr;r< __setstate__szDClassPropertiesAndMethods.test_copy_setstate..C.__setstate__)N)N)rrrr0rrrrr;rxr;r<rs   rrr)rr rrBrrr)r6rrr?rRr;rxr<test_copy_setstates    z,ClassPropertiesAndMethods.test_copy_setstatecCs|dddd|dtdd|tdtddGdddt}||dddd||dtdd||dtdd|dddd|dtdd|tdtddGd d d t}||dddd||dtdd||dtdd|gdddd dg|gdtdd dg|tgdtdd dgGd d d t}||gdddd dg||gdtdd dg||gdtdd dg|gd}ddg|td d<||gddd g|tddd <||gd|td ddd g||gd|tddd ddg||gddS)NrrkZhellc@seZdZddZdS)z0ClassPropertiesAndMethods.test_slices..ScSs t||Sr)rrUr6r;r;r<rUsz.S.__getitem__Nrr;r;r;r<rsrrgrfrc@seZdZddZdS)z0ClassPropertiesAndMethods.test_slices..TcSs t||Sr)rrUr6r;r;r<rUsz.T.__getitem__Nrr;r;r;r<r?sr?rec@seZdZddZdS)z0ClassPropertiesAndMethods.test_slices..LcSs t||Sr)r2rUr6r;r;r<rUsz.L.__getitem__Nrr;r;r;r<rVsrVrh)rerhrfr)rhrerf)rhrfre)rfrhre)rBrXrrUrr2ra)r6rr?rVr?r;r;r< test_slicess<   " z%ClassPropertiesAndMethods.test_slicescsDGfdddt}d|_~t|tjd`dS)NcseZdZgZfddZdS)z>ClassPropertiesAndMethods.test_subtype_resurrection..Ccsj|dSr) containerr|rxrr;r<rszFClassPropertiesAndMethods.test_subtype_resurrection..C.__del__N)rrrrrr;rr;r<rsrrre)r rrrrBrrr)r6rWr;rr<test_subtype_resurrectionsz3ClassPropertiesAndMethods.test_subtype_resurrectioncCs0Gdddt}d}tdD] }||}q~dS)Nc@seZdZdgZddZdS)z9ClassPropertiesAndMethods.test_slots_trash..trashr7cSs ||_dSrrfr6r;r;r<r0szBClassPropertiesAndMethods.test_slots_trash..trash.__init__N)rrrrr0r;r;r;r<trashsriP)r r)r6rrrr;r;r<test_slots_trashs   z*ClassPropertiesAndMethods.test_slots_trashcCsnGdddt}Gdddt}Gddd||}trJ||j|j||d||dd |_dS) Nc@seZdZdZdS)zDClassPropertiesAndMethods.test_slots_multiple_inheritance..Ar;Nrr;r;r;r<r&src@s eZdZdS)zDClassPropertiesAndMethods.test_slots_multiple_inheritance..BNrr;r;r;r<r#(sr#c@seZdZdZdS)zDClassPropertiesAndMethods.test_slots_multiple_inheritance..Cr;Nrr;r;r;r<r*srrFrrf)r rrrB __basicsize__rr7)r6rr#rr;r;r<test_slots_multiple_inheritance$s  z9ClassPropertiesAndMethods.test_slots_multiple_inheritancecCsZGdddt}|}||dd||dd|d|d|d|ddS)Nc@seZdZddZddZdS)z.ClassPropertiesAndMethods.test_rmul..CcSsdS)Nrr;rr;r;r<rq6sz6ClassPropertiesAndMethods.test_rmul..C.__mul__cSsdS)Nrmulr;rr;r;r<rs8sz7ClassPropertiesAndMethods.test_rmul..C.__rmul__N)rrrrqrsr;r;r;r<r5srrfrg@rrrr;r;r< test_rmul2s z#ClassPropertiesAndMethods.test_rmulcCs"Gdddt}|}|dC}dS)Nc@seZdZddZdS)z.ClassPropertiesAndMethods.test_ipow..CcSsdSrr;rr;r;r<__ipow__Dsz7ClassPropertiesAndMethods.test_ipow..C.__ipow__N)rrrrr;r;r;r<rCsrrfrrr;r;r< test_ipow@sz#ClassPropertiesAndMethods.test_ipowc sGdddt}GfdddtGddd|}Gddd|}|}|}|f|_f|_||d ||d ||jd ||jd ||gz|`WnttfyYn 0|d z d |_Wn>ty }z$t |d kr |dWYd}~nd}~00|dz |f|_WntyLYn 0|dz||f|_WntyzYn 0|dz |f|_WntyYn 0|ddS)Nc@s eZdZdS)z7ClassPropertiesAndMethods.test_mutable_bases..CNrr;r;r;r<rMsrcs&eZdZfddZddZZS)z8ClassPropertiesAndMethods.test_mutable_bases..C2cs |dkr dSt||SdS)Nr?rf)rrkr6r)rRrr;r<rkPszIClassPropertiesAndMethods.test_mutable_bases..C2.__getattribute__cSsdSrr;rxr;r;r<rIUsz=ClassPropertiesAndMethods.test_mutable_bases..C2.meth)rrrrkrIrr;rRrr<rROsrRc@s eZdZdS)z7ClassPropertiesAndMethods.test_mutable_bases..DNrr;r;r;r<rWsrc@s eZdZdS)z7ClassPropertiesAndMethods.test_mutable_bases..ENrr;r;r;r<r,Ysr,rerfz&shouldn't be able to delete .__bases__r;z/a new-style class can't have only classic basesz'wrong error message for .__bases__ = ()z)shouldn't be able to set .__bases__ to ()z.shouldn't be able to create inheritance cyclesz#didn't detect repeated base classes) r rGrBrIr?rrrrr)r6rrr,rJrrr;rr<test_mutable_basesIsN        z,ClassPropertiesAndMethods.test_mutable_basescCsddtjD}|D],}t|d|tur|t|jd|qGdddt}Gdddt}Gd d d |}z t f|_Wnt yYn 0| d z t ft_Wnt yYn 0| d z|tf|_Wnt yYn0d sJddS)NcSsg|]}t|tr|qSr;)rrD)r}tpr;r;r<r~s z@ClassPropertiesAndMethods.test_builtin_bases..rGrec@s eZdZdS)z7ClassPropertiesAndMethods.test_builtin_bases..LNrr;r;r;r<rVsrVc@s eZdZdS)z7ClassPropertiesAndMethods.test_builtin_bases..CNrr;r;r;r<rsrc@s eZdZdS)z7ClassPropertiesAndMethods.test_builtin_bases..DNrr;r;r;r<rsrz/shouldn't turn list subclass into dict subclassz-shouldn't be able to assign to list.__bases__rz#best_base calculation found wanting) builtinsrFvaluesr rkrBrrGr2rrr)r6Z builtin_typesrrVrrr;r;r<test_builtin_basess.        z,ClassPropertiesAndMethods.test_builtin_basescCs|t$Gdddtd}Wdn1s40Y|t&Gdddttd}Wdn1st0Y|t&Gdddtdt}Wdn1s0YGdddt}|t&Gddd|td}Wdn1s0Y|t&Gdddtd|}Wdn1sH0YGd ddt}|ttdf|_Wdn1s0Y|tttdf|_Wdn1s0Y|ttdtf|_Wdn1s0Y|t|tdf|_Wdn1s>0Y|ttd|f|_Wdn1sx0YdS) Nc@s eZdZdSz>ClassPropertiesAndMethods.test_unsubclassable_types..XNrr;r;r;r<rWsrWc@s eZdZdSrrr;r;r;r<rWsc@s eZdZdSrrr;r;r;r<rWsc@s eZdZdS)z>ClassPropertiesAndMethods.test_unsubclassable_types..ONrr;r;r;r<r}sr}c@s eZdZdSrrr;r;r;r<rWsc@s eZdZdSrrr;r;r;r<rWsc@s eZdZdSrrr;r;r;r<rWs)rgrrDr rG)r6rWr}r;r;r<test_unsubclassable_typess, 2 4 4 6 6 , . . . z3ClassPropertiesAndMethods.test_unsubclassable_typesc sGfdddtGdddt}Gdddt}Gdddt}Gd d d |}Gd d d |}Gd dd|d}Gddd||d}|j}|j} z |f|_Wn.ty||j|||j| Yn 0|ddS)Ncs&eZdZfddZddZZS)zOClassPropertiesAndMethods.test_mutable_bases_with_failing_mro..WorkOncecsd|_t||||Sr)flagrr)r6r9rrF)WorkOncerr;r<rszWClassPropertiesAndMethods.test_mutable_bases_with_failing_mro..WorkOnce.__new__cSs0|jdkrtdn|jd7_t|SdS)NrZbozore)rrrDrTrxr;r;r<rTs  zSClassPropertiesAndMethods.test_mutable_bases_with_failing_mro..WorkOnce.mro)rrrrrTrr;rrr<rsrc@seZdZddZdS)zQClassPropertiesAndMethods.test_mutable_bases_with_failing_mro..WorkAlwayscSs t|Sr)rDrTrxr;r;r<rTszUClassPropertiesAndMethods.test_mutable_bases_with_failing_mro..WorkAlways.mroNrWr;r;r;r< WorkAlwayssrc@s eZdZdS)zHClassPropertiesAndMethods.test_mutable_bases_with_failing_mro..CNrr;r;r;r<rsrc@s eZdZdS)zIClassPropertiesAndMethods.test_mutable_bases_with_failing_mro..C2Nrr;r;r;r<rRsrRc@s eZdZdS)zHClassPropertiesAndMethods.test_mutable_bases_with_failing_mro..DNrr;r;r;r<rsrc@s eZdZdS)zHClassPropertiesAndMethods.test_mutable_bases_with_failing_mro..ENrr;r;r;r<r,sr,c@s eZdZdS)zHClassPropertiesAndMethods.test_mutable_bases_with_failing_mro..FNrr;r;r;r<rcsrcrc@s eZdZdS)zHClassPropertiesAndMethods.test_mutable_bases_with_failing_mro..GNrr;r;r;r<rsrzexception not propagated)rDr rrGrrBr) r6rrrRrr,rcrZ E_mro_beforeZ D_mro_beforer;rr<#test_mutable_bases_with_failing_mros    z=ClassPropertiesAndMethods.test_mutable_bases_with_failing_mrocCsGdddt}Gdddt}Gddd||}Gddd||}Gd d d ||}z||f|_WntyvYn 0|d dS) Nc@s eZdZdS)zJClassPropertiesAndMethods.test_mutable_bases_catch_mro_conflict..ANrr;r;r;r<r src@s eZdZdS)zJClassPropertiesAndMethods.test_mutable_bases_catch_mro_conflict..BNrr;r;r;r<r# sr#c@s eZdZdS)zJClassPropertiesAndMethods.test_mutable_bases_catch_mro_conflict..CNrr;r;r;r<rsrc@s eZdZdS)zJClassPropertiesAndMethods.test_mutable_bases_catch_mro_conflict..DNrr;r;r;r<rsrc@s eZdZdS)zJClassPropertiesAndMethods.test_mutable_bases_catch_mro_conflict..ENrr;r;r;r<r,sr,zdidn't catch MRO conflict)r rGrr)r6rr#rrr,r;r;r<%test_mutable_bases_catch_mro_conflicts z?ClassPropertiesAndMethods.test_mutable_bases_catch_mro_conflictcCsVGdddt}|j}d|_||j|jf|dfd|_||j|jf|dfdS)Nc@s eZdZdS)z7ClassPropertiesAndMethods.test_mutable_names..CNrr;r;r;r<r"srrzD.E)r rrrB)r6rrr;r;r<test_mutable_names s z,ClassPropertiesAndMethods.test_mutable_namescs6Gfdddt}Gddd|d_d_dS)NcseZdZfddZdS)z.Nastycs d_dS)Nr)rrxrr;r<r3szDClassPropertiesAndMethods.test_evil_type_name..Nasty.__del__Nrr;rr;r<Nasty2src@s eZdZdS)z8ClassPropertiesAndMethods.test_evil_type_name..CNrr;r;r;r<r6srrZnormal)rr)r6rr;rr<test_evil_type_name.s z-ClassPropertiesAndMethods.test_evil_type_namecCsGdddt}||ddd|d|ddGdddt}||dd|d|d Gd d d |}|||d |||d Gddd|}||j|j||dd|d|d |||d|||ddS)Nc@seZdZddZddZdS)z;ClassPropertiesAndMethods.test_subclass_right_op..BcSsdS)NB.__floordiv__r;rr;r;r< __floordiv__EszHClassPropertiesAndMethods.test_subclass_right_op..B.__floordiv__cSsdS)NB.__rfloordiv__r;rr;r;r< __rfloordiv__GszIClassPropertiesAndMethods.test_subclass_right_op..B.__rfloordiv__Nrrrrrr;r;r;r<r#Dsr#rerrc@seZdZddZddZdS)z;ClassPropertiesAndMethods.test_subclass_right_op..CcSsdS)NC.__floordiv__r;rr;r;r<rPszHClassPropertiesAndMethods.test_subclass_right_op..C.__floordiv__cSsdS)NC.__rfloordiv__r;rr;r;r<rRszIClassPropertiesAndMethods.test_subclass_right_op..C.__rfloordiv__Nrr;r;r;r<rOsrrrc@seZdZddZddZdS)z;ClassPropertiesAndMethods.test_subclass_right_op..DcSsdS)ND.__floordiv__r;rr;r;r<r[szHClassPropertiesAndMethods.test_subclass_right_op..D.__floordiv__cSsdS)ND.__rfloordiv__r;rr;r;r<r]szIClassPropertiesAndMethods.test_subclass_right_op..D.__rfloordiv__Nrr;r;r;r<rZsrrrc@s eZdZdS)z;ClassPropertiesAndMethods.test_subclass_right_op..ENrr;r;r;r<r,esr,)r)rBr r)r6r#rrr,r;r;r<test_subclass_right_op<sz0ClassPropertiesAndMethods.test_subclass_right_opz)testing an internal kind of method objectcCs,gd}dddd}|t|||i||tjd}||dt||||i||z|ddWntyYn 0|dz|dWntyYn 0|dz|ddWntyYn 0|dz|dtWntyYn 0|ddS)Nrgfromkeysz0shouldn't have allowed descr.__get__(None, None)rz(shouldn't have allowed descr.__get__(42)z.shouldn't have allowed descr.__get__(None, 42)z/shouldn't have allowed descr.__get__(None, int))rBrrrFrrrr))r6rrHrlr;r;r<test_meth_class_getos6        z-ClassPropertiesAndMethods.test_meth_class_getcCsGdddt}Gddd}|}||}||||||Gddd|}|}||}||||||Gdddt}|}||}||||||Gddd|}|}||}||||||dS) Nc@seZdZddZddZdS)z.ProxycSs ||_dSr _Proxy__objr7r;r;r<r0szEClassPropertiesAndMethods.test_isinst_isclass..Proxy.__init__cSs&|drt||St|j|SdSNZ_Proxy__r r rkrErrir;r;r<rks  zMClassPropertiesAndMethods.test_isinst_isclass..Proxy.__getattribute__Nrrrr0rkr;r;r;r<rsrc@s eZdZdSz8ClassPropertiesAndMethods.test_isinst_isclass..CNrr;r;r;r<rsrc@s eZdZdSz8ClassPropertiesAndMethods.test_isinst_isclass..DNrr;r;r;r<rsrc@s eZdZdSrrr;r;r;r<rsc@s eZdZdSrrr;r;r;r<rs)r r)r6rrr?parr;r;r<test_isinst_isclasss*        z-ClassPropertiesAndMethods.test_isinst_isclasscs\Gdddt}Gdddt}Gfddd|}||}|jd|ddS) Nc@seZdZddZddZdS)z9ClassPropertiesAndMethods.test_proxy_super..ProxycSs ||_dSrrr7r;r;r<r0szBClassPropertiesAndMethods.test_proxy_super..Proxy.__init__cSs&|drt||St|j|SdSrrrir;r;r<rks  zJClassPropertiesAndMethods.test_proxy_super..Proxy.__getattribute__Nrr;r;r;r<rsrc@seZdZddZdS)z5ClassPropertiesAndMethods.test_proxy_super..BcSsdS)NzB.fr;rxr;r;r<rsz7ClassPropertiesAndMethods.test_proxy_super..B.fNrSr;r;r;r<r#sr#cseZdZfddZZS)z5ClassPropertiesAndMethods.test_proxy_super..Ccst|dS)Nz->C.f)rrrx)rrr;r<rsz7ClassPropertiesAndMethods.test_proxy_super..C.f)rrrrrr;rrr<rsrrzB.f->C.f)r rBrF)r6rr#rrr;rr<test_proxy_supers  z*ClassPropertiesAndMethods.test_proxy_supercCsbzttddWnty$Yn 0|dzttdWntyRYn 0|ddS)Nrrz"Carlo Verre __setattr__ succeeded!rFz"Carlo Verre __delattr__ succeeded!)r rnrrrrqrxr;r;r<test_carloverres   z)ClassPropertiesAndMethods.test_carloverrecCsjGdddt}Gddd}Gddd||}|dtfi}z d|_Wntyd|d Yn0dS) Nc@seZdZddZdS)zHClassPropertiesAndMethods.test_carloverre_multi_inherit_valid..AcSst|||dSr)rDrnrrrr;r;r<rnszTClassPropertiesAndMethods.test_carloverre_multi_inherit_valid..A.__setattr__Nrrrrnr;r;r;r<rsrc@s eZdZdS)zHClassPropertiesAndMethods.test_carloverre_multi_inherit_valid..BNrr;r;r;r<r#sr#c@s eZdZdS)zHClassPropertiesAndMethods.test_carloverre_multi_inherit_valid..CNrr;r;r;r<rsrrTz1setattr through direct base types should be legalrDr rrrr6rr#rrr;r;r<#test_carloverre_multi_inherit_valids  z=ClassPropertiesAndMethods.test_carloverre_multi_inherit_validcCsjGdddt}Gddd}Gddd||}|dtfi}z d|_WntyZYn 0|d dS) Nc@seZdZddZdS)zJClassPropertiesAndMethods.test_carloverre_multi_inherit_invalid..AcSst|||dSr)r rnrr;r;r<rnszVClassPropertiesAndMethods.test_carloverre_multi_inherit_invalid..A.__setattr__Nrr;r;r;r<rsrc@s eZdZdS)zJClassPropertiesAndMethods.test_carloverre_multi_inherit_invalid..BNrr;r;r;r<r#sr#c@s eZdZdS)zJClassPropertiesAndMethods.test_carloverre_multi_inherit_invalid..CNrr;r;r;r<rsrrTz6setattr through indirect base types should be rejectedrrr;r;r<%test_carloverre_multi_inherit_invalids  z?ClassPropertiesAndMethods.test_carloverre_multi_inherit_invalidcs@ddlGfddd}Gdddt}|}|||_~dS)Nrcs eZdZfddZddZdS)zAClassPropertiesAndMethods.test_weakref_segfault..Provokercs||_dSrr)r6Z referrentrr;r<r0szJClassPropertiesAndMethods.test_weakref_segfault..Provoker.__init__cSs |}dSrr r6r;r;r<rszIClassPropertiesAndMethods.test_weakref_segfault..Provoker.__del__N)rrrr0rr;r r;r<Provokers r c@s eZdZdS)z=ClassPropertiesAndMethods.test_weakref_segfault..OopsNrr;r;r;r<Oopssr )rr Zwhatever)r6r r rr;r r<test_weakref_segfault s  z/ClassPropertiesAndMethods.test_weakref_segfaultcCs$dd}tdD] }|j}qd}dS)NcSsdSrr;r;r;r;r<r!rzAClassPropertiesAndMethods.test_wrapper_segfault..i@B)rr)r6rrr;r;r<test_wrapper_segfaults z/ClassPropertiesAndMethods.test_wrapper_segfaultcCsTtj}Gddd}|t_z*z tdWnty<Yn0W|t_n|t_0dS)Nc@seZdZddZdS)z>ClassPropertiesAndMethods.test_file_fault..StdoutGuardcSstjt_td|dS)Nz!Premature access to sys.stdout.%s)r __stdout__stdoutrrr;r;r<r*szJClassPropertiesAndMethods.test_file_fault..StdoutGuard.__getattr__Nrrrrr;r;r;r< StdoutGuard)srzOops!)rrrr)r6Z test_stdoutrr;r;r<test_file_fault&s  z)ClassPropertiesAndMethods.test_file_faultcspGfdddt}GdddtGfdddt}d|j|<||jdt||d dS) Ncs eZdZddZfddZdS)zHClassPropertiesAndMethods.test_vicious_descriptor_nonsense..EvilcSstdS)Nrrrxr;r;r<r=szQClassPropertiesAndMethods.test_vicious_descriptor_nonsense..Evil.__hash__cs z`WntyYn0dSr)rrrrr;r<r?s  zOClassPropertiesAndMethods.test_vicious_descriptor_nonsense..Evil.__eq__Nrrrrrr;rr;r<Evil<src@seZdZdddZdS)zIClassPropertiesAndMethods.test_vicious_descriptor_nonsense..DescrNcSsdSrr;)r6obrDr;r;r<rHszQClassPropertiesAndMethods.test_vicious_descriptor_nonsense..Descr.__get__)Nrr;r;r;r<DescrGsrcseZdZZdS)zEClassPropertiesAndMethods.test_vicious_descriptor_nonsense..CN)rrrrr;rr;r<rKsrrrer)r rFrBrrrr)r6rrWr;)rrr< test_vicious_descriptor_nonsense5s  z:ClassPropertiesAndMethods.test_vicious_descriptor_nonsensecCs<Gdddt}z |Wnty,Yn 0|ddS)Nc@seZdZddZdS)z0ClassPropertiesAndMethods.test_init..FoocSsdS)Nrr;rxr;r;r<r0Ysz9ClassPropertiesAndMethods.test_init..Foo.__init__Nrr;r;r;r<FooXsrz'did not test __init__() for None return)r rr)r6rr;r;r< test_initVs   z#ClassPropertiesAndMethods.test_initcCs|t||kWdn1s(0Y|t||kWdn1sZ0Y|t||kWdn1s0Y|t||kWdn1s0YdSrrgrr6r?rRr;r;r<assertNotOrderablebs & & & z,ClassPropertiesAndMethods.assertNotOrderablecCsg}||j|jk||j|jk||jgjk||jgjk||j|jk||j|jk||j|j||jjd||jj|||jj t ||jj t jj t |jdS)NrP) rrPrrqrrBrrr __objclass__r2rrr6rr;r;r<test_method_wrapperlsz-ClassPropertiesAndMethods.test_method_wrappercCsg}||j|jk||j|jk||jgjk||jgjk||j|jk||j|jk||j|j||jjd||jj|||jj t jj t |jdS)Nr|) rr|rpoprrBrrrrr2rr!r;r;r<test_builtin_function_or_method~sz9ClassPropertiesAndMethods.test_builtin_function_or_methodcCs|tjtjk|tjtjk|tjtjk|tjtjk|tjtj|tjjd|tjj t|tj tj k|tj tj k|tj tj k|tj tj k|tj tj |tj jd|tj j tdS)NrPr|) rr2rPrrqrrBrrr r|r#rxr;r;r<!test_special_unbound_method_typessz;ClassPropertiesAndMethods.test_special_unbound_method_typescsddldd}fdd}tjd}tj}dD]\}}}d|d d}td d ||i} | } ||| | ||| |||| ||r2||| | ||| |||| |d |d d} td d | |i} | } ||| | ||| |||| |q2dS)NrcSstSrrrr;r;r< specialmethodszEClassPropertiesAndMethods.test_not_implemented..specialmethodcs>zt|||dWnty(Yn0d|fdS)N)r7rcoperatorzno TypeError from %r)r]rr)r:r7rcr'r6r;r<rms  z=ClassPropertiesAndMethods.test_not_implemented..checkre))rPzx + yzx += y)__sub__zx - yzx -= y)rqzx * yzx *= y) __matmul__zx @ yzx @= y) __truediv__zx / yzx /= y)rzx // yzx //= y)__mod__zx % yzx %= y) __divmod__z divmod(x, y)N)rzx ** yzx **= y) __lshift__zx << yzx <<= y) __rshift__zx >> yzx >>= y)__and__zx & yzx &= y)__or__zx | yzx |= y)__xor__zx ^ yzx ^= yZ__rrfrr;Z__ir)r'rrrD)r6r&rmZN1ZN2r9r:ZiexprZrnamerr?ZinamerrWr;r(r<test_not_implementeds,         z.ClassPropertiesAndMethods.test_not_implementedcCs4Gdddt}|}d|dd<||jddS)Nc@seZdZddZdS)z6ClassPropertiesAndMethods.test_assign_slice..CcSs ||_dSrr)r6idxrr;r;r<raszBClassPropertiesAndMethods.test_assign_slice..C.__setitem__N)rrrrar;r;r;r<rsrrhrerf)r rBr)r6rrWr;r;r<test_assign_slices z+ClassPropertiesAndMethods.test_assign_slicecsGdddt}|dGfdddt}|}||jd|_||jdGdddt}Gd dd|d }d|_|d|_||jddS) Nc@seZdZddZddZdS)z.DescrcSs ||_dSrr9rir;r;r<r0szEClassPropertiesAndMethods.test_set_and_no_get..Descr.__init__cSs||j|j<dSr)rFr9r6r;r;r<rszDClassPropertiesAndMethods.test_set_and_no_get..Descr.__set__N)rrrr0rr;r;r;r<rsrr?cseZdZZdSz8ClassPropertiesAndMethods.test_set_and_no_get..XNrr;rlr;r<rWsrWrc@s eZdZdS)z;ClassPropertiesAndMethods.test_set_and_no_get..MetaNrr;r;r;r<rsrc@s eZdZdSr8rr;r;r;r<rWsr)r rr?rBrD)r6rrWr7rr;r9r<test_set_and_no_gets z-ClassPropertiesAndMethods.test_set_and_no_getcsGdddt}|Gfdddt}Gfdddt}Gfdddt}|tt|d |jd |tt|d |jd |tt|d |jd Gfd ddt|ttd dS)Nc@seZdZdZdddZdS)z@ClassPropertiesAndMethods.test_getattr_hooks..DescriptorrNcsfdd}|S)Ncsjd7_t|dSr)r<rr7rxr;r<rszXClassPropertiesAndMethods.test_getattr_hooks..Descriptor.__get__..getterr;)r6rZobjtyperr;rxr<rs zHClassPropertiesAndMethods.test_getattr_hooks..Descriptor.__get__)N)rrrr<rr;r;r;r< Descriptorsr;cseZdZZdS)z7ClassPropertiesAndMethods.test_getattr_hooks..AN)rrrrkr;r9r;r<rsrcseZdZZdS)z7ClassPropertiesAndMethods.test_getattr_hooks..BNrr;r9r;r<r#sr#cseZdZZZdS)z7ClassPropertiesAndMethods.test_getattr_hooks..CN)rrrrkrr;r9r;r<rsrrrerfrkcs eZdZddZfddZdS)zFClassPropertiesAndMethods.test_getattr_hooks..EvilGetattributecSs t|dSrrrir;r;r<rszRClassPropertiesAndMethods.test_getattr_hooks..EvilGetattribute.__getattr__cs&`tdD] }tq t|dSNru)rrrZcollectr)r6r9rEvilGetattributer;r<rk!s  zWClassPropertiesAndMethods.test_getattr_hooks..EvilGetattribute.__getattribute__Nrr;r=r;r<r>sr>)r rgrrErBr<)r6r;rr#rr;)r>rlr<test_getattr_hookss z,ClassPropertiesAndMethods.test_getattr_hookscCs|ttjttdSr)rgrrDrkr2rxr;r;r<test_type___getattribute__)sz4ClassPropertiesAndMethods.test_type___getattribute__cCsr|tttdGdddt}|tt|dGdddt}|t|`Wdn1sd0YdS)N__abstractmethods__c@s eZdZdS)z.metaNrr;r;r;r<meta/srBc@s eZdZdS)z9ClassPropertiesAndMethods.test_abstractmethods..XNrr;r;r;r<rW2srW)rgrrErDr rA)r6rBrWr;r;r<test_abstractmethods,s  z.ClassPropertiesAndMethods.test_abstractmethodscCsGddd}|}||t|tt|Wdn1sJ0Y|tt|dWdn1s0YdS)Nc@seZdZeZdS)z:ClassPropertiesAndMethods.test_proxy_call..FakeStrN)rrrrrr;r;r;r<FakeStr8srDr)rrrgrrrP)r6rDZfake_strr;r;r<test_proxy_call7s  ( z)ClassPropertiesAndMethods.test_proxy_callcCs<Gddd}|j|_|}|tt||tt|dS)Nc@s eZdZdS)z7ClassPropertiesAndMethods.test_repr_as_str..FooNrr;r;r;r<rJsr)rrrgrrr)r6rrr;r;r<test_repr_as_strGs z*ClassPropertiesAndMethods.test_repr_as_strcCs>Gdddt}|}d|_||dd||| dS)Nc@seZdZejZejZdS)z>ClassPropertiesAndMethods.test_mixing_slot_wrappers..XN)rrrrrarnr__neg__r;r;r;r<rWRsrWrrc)rrcrB)r6rWr7r;r;r<test_mixing_slot_wrappersQs z3ClassPropertiesAndMethods.test_mixing_slot_wrapperscCs~Gdddt}|}|t||kWdn1s>0Y|t||Wdn1sp0YdS)Nc@seZdZejZejZdS)zBClassPropertiesAndMethods.test_wrong_class_slot_wrapper..AN)rrrrrrPr;r;r;r<r]sr)r)rgr)r6rr?r;r;r<test_wrong_class_slot_wrapperZs  & z7ClassPropertiesAndMethods.test_wrong_class_slot_wrappercCsR|t}Gddd}Wdn1s.0Yt|j}|d|dS)Nc@seZdZdgZdZdS)zEClassPropertiesAndMethods.test_slot_shadows_class_variable..XrN)rrrrrr;r;r;r<rWhsrWz0'foo' in __slots__ conflicts with class variable)rgrrr%rB)r6rrWrLr;r;r< test_slot_shadows_class_variablefs , z:ClassPropertiesAndMethods.test_slot_shadows_class_variablecCsGddd}d|_||jd|t&}ttjdtdWdn1sX0Y|dt |j |t$}t|jd |Wdn1s0Y|dt |j ||jddS)Nc@seZdZdZdS)z1ClassPropertiesAndMethods.test_set_doc..XZelephantNr]r;r;r;r<rWosrWZbananarZblahzcan't set list.__doc__zcan't delete X.__doc__) rrBrgrrDr2rFrrerr%r8)r6rWrr;r;r< test_set_docns 4 2z&ClassPropertiesAndMethods.test_set_doccCs4tjtjtjtjg}gd}t||D]\}}|t |j |dq&|D]$}|j j d|j }||j |qJ|tjj d|tjj d|tjj d|tjj dGdd d }| t|` Wdn1s0Y| tt jd jtd Gd d d a|tj d |tjj ddS)N)rmemberZgetsetwrapperZ _descriptor.z str.lowerz complex.realz float.realz int.__add__c@s eZdZdS)z2ClassPropertiesAndMethods.test_qualname..XNrr;r;r;r<rWsrWrZOinkc@seZdZGdddZdS)rXc@s eZdZdS)Y.InsideNrr;r;r;r<InsidesrPN)rrrrPr;r;r;r<rXsrXrO)rrFrrr*r)rPrrBrDrr rrgrrFrrXrP)r6Z descriptorsrrJnqualnamerWr;r;r< test_qualname{s( "z'ClassPropertiesAndMethods.test_qualnamecCs^ddi}tdd|}||jd|d|j||ddiddi}|ttdd|dS)Nrz some.namerr;re)rDrBrrrFrgr)r6rFrr;r;r<test_qualname_dicts z,ClassPropertiesAndMethods.test_qualname_dictcCs^Gdddt}|}d|_t|}~t||tD]}| t ||qDdS)Nc@seZdZddZdS)z.XcSst|||_dSr)rr0rFrxr;r;r<r0s zEClassPropertiesAndMethods.test_cycle_through_dict..X.__init__Nrr;r;r;r<rWsrWr) rrrrrr assertIsNonerr assertIsNotrD)r6rWr7wrrr;r;r<test_cycle_through_dicts   z1ClassPropertiesAndMethods.test_cycle_through_dictcCsGddd}|t|d|jt|ddGddd}Gddd}Gd d d ||}|||fD]>}|d|dd d|t|dd d |jt|dd d d qddS)Nc@s eZdZdS)z[ClassPropertiesAndMethods.test_object_new_and_init_with_parameters..OverrideNeitherNrr;r;r;r<OverrideNeithersrYrerc@seZdZdddZdS)zWClassPropertiesAndMethods.test_object_new_and_init_with_parameters..OverrideNewrc_stj|g|Ri|SrrF)rrrr7rr;r;r<rsz_ClassPropertiesAndMethods.test_object_new_and_init_with_parameters..OverrideNew.__new__N)rrr;r;r;r< OverrideNewsrZc@seZdZdddZdS)zXClassPropertiesAndMethods.test_object_new_and_init_with_parameters..OverrideInitrc_stj|g|Ri|Sr)r r0)r6rrr7r8r;r;r<r0szaClassPropertiesAndMethods.test_object_new_and_init_with_parameters..OverrideInit.__init__N)rrr;r;r;r< OverrideInitsr[c@s eZdZdS)zXClassPropertiesAndMethods.test_object_new_and_init_with_parameters..OverrideBothNrr;r;r;r< OverrideBothsr\rfrhr>r)r6rYrZr[r\Zcaser;r;r<(test_object_new_and_init_with_parameterss zBClassPropertiesAndMethods.test_object_new_and_init_with_parameterscCs>Gddd}Gddd|}|d|j|d|jdS)Nc@s eZdZdS)z\ClassPropertiesAndMethods.test_subclassing_does_not_duplicate_dict_descriptors..BaseNrr;r;r;r<rsrc@s eZdZdS)z[ClassPropertiesAndMethods.test_subclassing_does_not_duplicate_dict_descriptors..SubNrr;r;r;r<rsrrF)rerFr)r6rrr;r;r<4test_subclassing_does_not_duplicate_dict_descriptorsszNClassPropertiesAndMethods.test_subclassing_does_not_duplicate_dict_descriptorscsRGddd}|t|jdGddd}Gddd|}Gdd d |}|}|}|}t||}|t|jd |t|jd |t|jd |t|jd Gddd}|} |t| jd|t|jdGddd} | } t} t| | } |t| dd| _|t| dd| _|t| ddS)Nc@seZdZddZdS)=ClassPropertiesAndMethods.test_bound_method_repr..FoocSsdSrr;rxr;r;r<rsDClassPropertiesAndMethods.test_bound_method_repr..Foo.methodNrrrrr;r;r;r<rsrz4>c@seZdZddZdS)z>ClassPropertiesAndMethods.test_bound_method_repr..BasecSsdSrr;rxr;r;r<rszEClassPropertiesAndMethods.test_bound_method_repr..Base.methodNrar;r;r;r<rsrc@s eZdZdS)zBClassPropertiesAndMethods.test_bound_method_repr..Derived1Nrr;r;r;r<Derived1srbc@seZdZddZdS)zBClassPropertiesAndMethods.test_bound_method_repr..Derived2cSsdSrr;rxr;r;r<rszIClassPropertiesAndMethods.test_bound_method_repr..Derived2.methodNrar;r;r;r<Derived2srcz6>z:>z>>z:>c@seZdZeddZdS)r_cSsdSrr;rr;r;r<rsr`N)rrrrLrr;r;r;r<rsz/>c@seZdZddZdS)zDClassPropertiesAndMethods.test_bound_method_repr..MyCallablecSsdSrr;rr;r;r<rszMClassPropertiesAndMethods.test_bound_method_repr..MyCallable.__call__N)rrrrr;r;r;r< MyCallablesrdz*>r9z,>rRz0>) Z assertRegexrrrr r MethodTyperr)r6rrrbrcrJZderived1Zderived2Zsuper_d2rrdrUinstancerrr;r<test_bound_method_reprs\           z0ClassPropertiesAndMethods.test_bound_method_reprNzneed the _testcapi modulecs*GdddGfddd}|jdS)Nc@seZdZejZdS)z6ClassPropertiesAndMethods.test_bpo25750..DescrN)rrrrZbad_getrr;r;r;r<r srcseZdZZddZdS)z2ClassPropertiesAndMethods.test_bpo25750..XcSsd|_ddtdD|_dS)NcSsg|] }d|qSrr;r|r;r;r<r~rzNClassPropertiesAndMethods.test_bpo25750..X.__new__..i')rlrrrr;r;r<rsz:ClassPropertiesAndMethods.test_bpo25750..X.__new__N)rrrrlrr;rr;r<rWsrWr9rr;rr< test_bpo25750sz'ClassPropertiesAndMethods.test_bpo25750)rrrrrrrrhrrrrrrrrrrrrrr rrrZ refcount_testr!rr)r,r-r.r1r=r@r.ZexpectedFailurerBrJrRr\rerirjrrrrskipIfrflagsoptimizer cpython_onlyrrrrr rKrRrXrerjrprurrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr rrrrrr"r$r%r3r6r:r?r@rCrErFrHrIrJrKrSrTrXr]r^rgrrhrr;r;rr<rs4X*)%  %=K&(F< 2  1  " " G1 ib?  CS^ pN @OYYM  .  ',  A( 63 +'!  4 '        7rc@seZdZddZeeedo$edddZ eeedoFedddZ eeedohedd d Z d d Z d dZ dS)DictProxyTestscCsGdddt}||_dS)Nc@seZdZddZdS)zDictProxyTests.setUp..CcSsdSrr;rxr;r;r<rIsz$DictProxyTests.setUp..C.methNr r;r;r;r<rsr)r rrr;r;r<setUpszDictProxyTests.setUpgettracez#trace function introduces __local__cCs<|jj}||tt|}|||gddS)NrFrrrrI)rrFr{assertNotIsInstancer2sortrBr6rr{r;r;r<test_iter_keyss   zDictProxyTests.test_iter_keyscCs4|jj}||tt|}|t|ddSr<)rrFrrqr2rBr)r6rrr;r;r<test_iter_values*s  zDictProxyTests.test_iter_valuescCsB|jj}||tdd|D}|||gddS)NcSsg|] }|dqSrr;)r}itemr;r;r<r~9rz2DictProxyTests.test_iter_items..rp)rrFr3rqr2rrrBrsr;r;r<test_iter_items3s   zDictProxyTests.test_iter_itemscCsNGdddt}Gdddt}Gddd|d}|t|jt|jdS)Nc@s eZdZdS)z7DictProxyTests.test_dict_type_with_metaclass..BNrr;r;r;r<r#@sr#c@s eZdZdS)z7DictProxyTests.test_dict_type_with_metaclass..MNrr;r;r;r<rBsrc@s eZdZdS)z7DictProxyTests.test_dict_type_with_metaclass..CNrr;r;r;r<rDsrr)r rDrBrF)r6r#rrr;r;r<test_dict_type_with_metaclass>sz,DictProxyTests.test_dict_type_with_metaclasscCs^t|jj}||d|||d||jjD]\}}|d|||qGdddt}ztd|dWn Yn0ttdS)Nc@seZdZddZdS)z>AAAPTypesLongInitTest.test_pytype_long_ready..UserLongcWsdSrr;r=r;r;r<raszFAAAPTypesLongInitTest.test_pytype_long_ready..UserLong.__pow__N)rrrrr;r;r;r<UserLong`sr}r)r rrDrTr)r6r}r;r;r<test_pytype_long_readyYs z,AAAPTypesLongInitTest.test_pytype_long_readyN)rrrr~r;r;r;r<r|Tsr|c@seZdZddZdS) MiscTestscsjGfdddt}Gdddt}Gdddttd|f|di|jd |jd dS) Ncs"eZdZddZfddZdS)z7MiscTests.test_type_lookup_mro_reference..MyKeycSstdS)Nmykeyrrxr;r;r<rssz@MiscTests.test_type_lookup_mro_reference..MyKey.__hash__cs f_dSrrrBase2rWr;r<rvsz>MiscTests.test_type_lookup_mro_reference..MyKey.__eq__Nrr;rr;r<MyKeyrsrc@seZdZdZdZdS)z6MiscTests.test_type_lookup_mro_reference..Base from BaseNrrrrmykey2r;r;r;r<rysrc@seZdZdZdZdS)z7MiscTests.test_type_lookup_mro_reference..Base2 from Base2Nrr;r;r;r<r}srrWrurr)r rDrBrr)r6rrr;rr<test_type_lookup_mro_referencens z(MiscTests.test_type_lookup_mro_referenceN)rrrrr;r;r;r<rmsrc@sfeZdZdidddfddZddZddZdd d Zed d Zd dZ ddZ ddZ ddZ dS) PicklingTestsr;Nc CsB|dkr||}|rD||dtj||dt|||fn,||dtj||dt|f|||d||dur|t|d|n||d|dur| t |d|n||dndt|j } tj t|| | t urdn| |ff}|dur||f7}|||||||dS)Nrfrrerhrk) __reduce_ex__rBcopyreg __newobj_ex__rD __newobj__assertListEqualr2rUassertDictEqualr__base___reconstructorr  __reduce__) r6protorr7r8r listitems dictitemsZ reduce_valueZ base_typer;r;r< _check_reduces2    zPicklingTests._check_reducec sttjd}ddddddiGfdd d }|}|D]}|||q@D]\}}t|||q\|D]}|j||d qvGd d d }|}|D]@}|d kr|t||Wdq1s0YqGfddd}|}|D] }|d kr|||qGfddd} Gfddd} Gddd} Gddd} |D]d}| | | | fD]P} | }|d kr||tt f||Wdn1s0Yq|qlGfddd}|}|D]}|||qGddd}|}|D]F}|d kr|t ||Wdn1sV0YqGfddd}|}|D]}|j||d qGddd}|}|D]}|j||d d qGd!d"d"}|}|D]z}|t ||Wdn1s0Y|d kr|t | Wdn1sN0YqGfd#d$d$}|}|D]}|d kr|j||dfd nj|t||Wdn1s0Y|t| Wdn1s0YqxGd%d&d&t }|d'd(i}|D]}|j||t |d)q*Gd*d+d+t }|d,g}|D]}|j||t |d-qddS).Nre)iri7i)ZbaconZfishcheeseiocseZdZfddZdS)z%PicklingTests.test_reduce..C1csSrr;rxr|r;r<__getnewargs__sz4PicklingTests.test_reduce..C1.__getnewargs__Nrrrrr;r|r;r<rsrrc@seZdZddZdS)z%PicklingTests.test_reduce..C2cSsdSNzbad argsr;rxr;r;r<rsz4PicklingTests.test_reduce..C2.__getnewargs__Nrr;r;r;r<rRsrRrfcseZdZfddZdS)z%PicklingTests.test_reduce..C3csfSrr;rxr@r;r<__getnewargs_ex__sz7PicklingTests.test_reduce..C3.__getnewargs_ex__Nrrrrr;r@r;r<rsrcseZdZfddZdS)z%PicklingTests.test_reduce..C4csdfS)Nzbad dictr;rxr|r;r<rsz7PicklingTests.test_reduce..C4.__getnewargs_ex__Nrr;r|r;r<rsrcseZdZfddZdS)z%PicklingTests.test_reduce..C5csdfS)Nz bad tupler;rxr8r;r<rsz7PicklingTests.test_reduce..C5.__getnewargs_ex__Nrr;rr;r<C5src@seZdZddZdS)z%PicklingTests.test_reduce..C6cSsdS)Nr;r;rxr;r;r<rsz7PicklingTests.test_reduce..C6.__getnewargs_ex__Nrr;r;r;r<C6src@seZdZddZdS)z%PicklingTests.test_reduce..C7cSsdSrr;rxr;r;r<rsz7PicklingTests.test_reduce..C7.__getnewargs_ex__Nrr;r;r;r<C7srcseZdZfddZdS)z%PicklingTests.test_reduce..C9csifSrr;rxr|r;r<rsz7PicklingTests.test_reduce..C9.__getnewargs_ex__Nrr;r|r;r<C9src@seZdZddZdS)z&PicklingTests.test_reduce..C10cSstdSrrrxr;r;r<rsz8PicklingTests.test_reduce..C10.__getnewargs_ex__Nrr;r;r;r<C10srcseZdZfddZdS)z&PicklingTests.test_reduce..C11csSrr;rxrr;r<rsz3PicklingTests.test_reduce..C11.__getstate__Nrrrrr;rr;r<C11src@seZdZddZdS)z&PicklingTests.test_reduce..C12cSsdS)Nnot dictr;rxr;r;r<rsz3PicklingTests.test_reduce..C12.__getstate__Nrr;r;r;r<C12srrc@seZdZddZdS)z&PicklingTests.test_reduce..C13cSstdSrrrxr;r;r<rsz3PicklingTests.test_reduce..C13.__getstate__Nrr;r;r;r<C13srcs eZdZeZfddZdS)z&PicklingTests.test_reduce..C14cs"D]\}}t|||qdSrr3rrorr;r<r0 sz/PicklingTests.test_reduce..C14.__init__N)rrrrrr0r;rr;r<C14src@s eZdZdS)z&PicklingTests.test_reduce..C15Nrr;r;r;r<C15srZquebeci)rc@s eZdZdS)z&PicklingTests.test_reduce..C16Nrr;r;r;r<C16srZyukon)r)rpickleHIGHEST_PROTOCOLrr3rrgrrrrrrr2)r6 protocolsrrrr9rrRrrrrrrrrrrrrrrr;)r7r8rr< test_reduces  *  2  . *  ,  * ,  zPicklingTests.test_reducecCsLttjd}Gddd}|D]&}|dkr0ind}|j|||dq dS)Nrec@seZdZddZddZdS)z7PicklingTests.test_special_method_lookup..PickycSsiSrr;rxr;r;r<r&szDPicklingTests.test_special_method_lookup..Picky.__getstate__cSs|dvrt|dS)N)rrrKrr;r;r<r)szCPicklingTests.test_special_method_lookup..Picky.__getattr__N)rrrrrr;r;r;r<Picky%srrfr)rrrr)r6rrprotocolrr;r;r<r#s z(PicklingTests.test_special_method_lookupcCs|durd||}t|jtjur,td|j|||d|jt|t||dt|dr|j|j |j |d|j|j |j |dt|dr|j |j |j |d|j D]@}|j t||t|||d|j t ||dt ||d|dq|j t|t||ddS)zKUtility method to verify if two objects are copies of each others. Nz{!r} is not a copy of {!r}zCobject passed to _assert_is_copy must override the __repr__ method.)rrFr)rrDrr rrVrrrrFrrrBrEr)r6robjcopyrslotr;r;r<_assert_is_copy1s&     zPicklingTests._assert_is_copycsDGdddfddtttjdtjtjhtjtjhDS)zLUtility method to generate the many possible pickle configurations. c@s(eZdZdZddZddZddZdS) z.PickleCopierz&This class copies object using pickle.cSs||_||_||_dSr)rdumpsloads)r6rrrr;r;r<r0QszEPicklingTests._generate_pickle_copiers..PickleCopier.__init__cSs||||jSr)rrrr7r;r;r<rUszAPicklingTests._generate_pickle_copiers..PickleCopier.copycSs$d|j|jj|jj|jj|jjS)Nz0PickleCopier(proto={}, dumps={}.{}, loads={}.{}))rrrrrrrxr;r;r<rWs   zEPicklingTests._generate_pickle_copiers..PickleCopier.__repr__N)rrrrr0rrr;r;r;r< PickleCopierOsrc3s|]}|VqdSrr;)r}r7rr;r< _rz9PicklingTests._generate_pickle_copiers..re) itertoolsproductrrrr_dumpsr_loadsr;r;rr<_generate_pickle_copiersKs   z&PicklingTests._generate_pickle_copiersc CsGddda|tttdWdn1s<0YGdddta|tttdWdn1s0YGdddaGdddtaGdd d ta|D]}|j|d t}| |}| ||d |_ | |}| ||t}d |_ d |_ | |}| ||t}d |_ d |_ | |}| ||Wdq1st0YqdS)Nc@seZdZdgZdS)rr?Nrr;r;r;r<rjsrrc@s eZdZdS)rNrr;r;r;r<rpsrc@s.eZdZdZdgZddZddZddZd S) rz7A class with __getstate__ and __setstate__ implemented.r?c Ss^t|di}t|jD]>}|jddD]*}zt||||<Wq,tyTYq,0q,q|S)NrFrr;)rErrDrrFrr)r6rrrr;r;r<rxs  zC.__getstate__cSs"|D]\}}t|||qdSrr)r6rrrr;r;r<rszC.__setstate__cSsdt|j|fS)Nz%s()<%r>)rDrrrxr;r;r<rsz C.__repr__N)rrrrrrrrr;r;r;r<rus  c@seZdZdZdS)rz!A subclass of a class with slots.Nr]r;r;r;r<rsc@seZdZdZdgZdS)r,zA subclass with an extra slot.rRN)rrrrrr;r;r;r<r,sr,) pickle_copierrrr) rrgrrrrr,rsubTestrrr?rR)r6rr7rcr;r;r<test_pickle_slotsds6 , ,        zPicklingTests.test_pickle_slotsc CsGdddaGdddtaGdddtaGdddtaGd d d tatttttf}|}t ||D]\}}|j ||d vt |d i}||j i|}|j }||}||||d kr|js|j||} ||| Wdqp1s0Yqp|D]}|j |dft |d i}||j i|}t|}||||js||jt|} ||| Wdn1s0YqdS)Ncs0eZdZdZdZdZfddZddZZS)rz:The state of this class is copyable via its instance dict.rTcst||_||_dSr)rr0r?rRrrr;r<r0s z C1.__init__cSsd|j|jfS)Nz C1(%r, %r)rQrxr;r;r<rsz C1.__repr__) rrrrARGSNEED_DICT_COPYINGr0rrr;r;rr<rs  rcsHeZdZdZdZdZfddZfddZedd Z d d Z Z S) rRz,A list subclass copyable via __getnewargs__.rFcst|}||_||_|Srrrr?rR)rr?rRr6rr;r<rs z C2.__new__cst|ddSNr)rr0r|r=rr;r<r0s z C2.__init__cSs|jSrrrr;r;r<rszC2.__getnewargs__cSsd|j|jt|fS)NzC2(%r, %r)<%r>r?rRr2rxr;r;r<rsz C2.__repr__) rrrrrrrr0rLrrrr;r;rr<rRs   rRc@s<eZdZdZdZdZddZeddZdd Z d d Z d S) rz*A list subclass copyable via __getstate__.rFcSs||_||_|ddSr)r?rRr|rr;r;r<r0sz C3.__init__cSs|jSrrrr;r;r<rszC3.__getstate__cSs|\}}||_||_dSrrQ)r6rr?rRr;r;r<rszC3.__setstate__cSsd|j|jt|fS)NzC3(%r, %r)<%r>rrxr;r;r<rsz C3.__repr__N) rrrrrrr0rLrrrr;r;r;r<rs rcs<eZdZdZdZdZfddZeddZdd Z Z S) rz,An int subclass copyable via __getnewargs__.)rrreFcst||}||_||_|Srrrr?rRrr6rr;r<rsz C4.__new__cSs|jSrrrr;r;r<rszC4.__getnewargs__cSsd|j|jt|fS)NzC4(%r, %r)<%r>r?rRr)rxr;r;r<rsz C4.__repr__) rrrrrrrrLrrrr;r;rr<rs  rcsJeZdZdZdZddiZdZddfdd Zed d Z d d Z Z S)rz/An int subclass copyable via __getnewargs_ex__.rrrhFrr4cst||}||_||_|Srrrrr;r<rsz C5.__new__cSs |j|jfSr)rKWARGSrr;r;r<rszC5.__getnewargs_ex__cSsd|j|jt|fS)NzC5(%r, %r)<%r>rrxr;r;r<rsz C5.__repr__) rrrrrrrrrLrrrr;r;rr<rs r)rrrrfr)rr2rRrr)rrrrrrrErrrrrrFrfr) r6Z test_classesZpickle_copiersrrr8rrrZobjcopy2r;r;r<test_reduce_copyings8      .   z!PicklingTests.test_reduce_copyingcs^GdddtGfdddddl}|jfdddifddf}|d|dS) Nc@s eZdZdS)z(PicklingTests.test_issue24097..SNrr;r;r;r<r%srcs$eZdZdgZfddZdS)z(PicklingTests.test_issue24097..Arcs(|dkr dgjdd<dStdS)Nrr) __slotnames__rrrrr;r<r)sz4PicklingTests.test_issue24097..A.__getattr__N)rrrrrr;rr;r<r's rrrrrf)rrrrBr)r6rrr;rr<test_issue24097#s  zPicklingTests.test_issue24097cCst|ttdWdn1s60Ytd|ttWdn1sv0Y|ttdWdn1s0YdSr)r rrgrrrxr;r;r<test_object_reduce4s  *  ( z PicklingTests.test_object_reduce)N) rrrrrrrrrrrrrr;r;r;r<rs {  C|rc@seZdZejddZdS)SharedKeyTestscCs6Gddd}Gddd|}||}}|tt|tt||tt|tdditd\|_|_|_|_ |_ |_ | tt|tt||}|tt|tt||tt|tdditd\|_ |_ |_ |_ |_|_|tt|tddidS)Nc@s eZdZdS)z)SharedKeyTests.test_subclasses..ANrr;r;r;r<rGsrc@s eZdZdS)z)SharedKeyTests.test_subclasses..BNrr;r;r;r<r#Isr#r?rerv)rBrrvarsZ assertLessrr7rcrwrrrrKrr)r6rr#r?rRrr;r;r<test_subclassesDs       zSharedKeyTests.test_subclassesN)rrrrrlrr;r;r;r<rBsrc@s eZdZdZddZddZdS)DebugHelperMetaz< Sets default __doc__ and simplifies repr() output. cCs&|ddur||d<t||||S)Nr)rrDr)rEr9rrr;r;r<r^szDebugHelperMeta.__new__cCs t|jSr)rrrr;r;r<rbszDebugHelperMeta.__repr__N)rrrrrrr;r;r;r<rZsrc@s`eZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ dS)MroTestz Regressions for some bugs revealed through mcsl.mro() customization (typeobject.c: mro_internal()) and cls.__bases__ assignment (typeobject.c: type_set_bases()). cCsd|_d|_dS)NrF)stepreadyrxr;r;r<rnmsz MroTest.setUpcCs |j|k}|r|jd7_|Sr)r)r6limitretr;r;r< step_untilqs zMroTest.step_untilcs*Gfdddt}Gddd|d}dS)zM type_set_bases must be aware that type->tp_mro can be NULL. cseZdZfddZdS)z4MroTest.test_incomplete_set_bases_on_self..Mcs0dr&|jdusJ|jd7_t|S)Nrer;)rrrGrDrTrrxr;r<rT|s z8MroTest.test_incomplete_set_bases_on_self..M.mroNrWr;rxr;r<r{src@s eZdZdS)z4MroTest.test_incomplete_set_bases_on_self..ANrr;r;r;r<rsrrNrr6rrr;rxr<!test_incomplete_set_bases_on_selfwsz)MroTest.test_incomplete_set_bases_on_selfcsJGfdddt}Gddd|dGddd}|jd7_d S) z? Deep reentrancy must not over-decref old_mro. cseZdZfddZdS)z/MroTest.test_reent_set_bases_on_base..Mcs6|jdur,|jdkr,dr,jd7_t|S)Nr#rr;)rrrrGrDrTrrr6r;r<rTs z3MroTest.test_reent_set_bases_on_base..M.mroNrWr;rr;r<rsrc@s eZdZdS)z/MroTest.test_reent_set_bases_on_base..ANrr;r;r;r<rsrrc@s eZdZdS)z/MroTest.test_reent_set_bases_on_base..BNrr;r;r;r<r#sr#r;N)rrG)r6rr#r;rr<test_reent_set_bases_on_bases z$MroTest.test_reent_set_bases_on_basecsJGfdddt}Gddd|d}Gddd|}Gdd d |}d S) zU Similar to test_reent_set_bases_on_base, but may crash differently. cseZdZfddZdS)z6MroTest.test_reent_set_bases_on_direct_base..Mcs4|jd}|tur*dr*|jd7_t|S)Nrrur;)rGr rrDrT)rrJrxr;r<rTs   z:MroTest.test_reent_set_bases_on_direct_base..M.mroNrWr;rxr;r<rsrc@s eZdZdS)z6MroTest.test_reent_set_bases_on_direct_base..ANrr;r;r;r<rsrrc@s eZdZdS)z6MroTest.test_reent_set_bases_on_direct_base..BNrr;r;r;r<r#sr#c@s eZdZdS)z6MroTest.test_reent_set_bases_on_direct_base..CNrr;r;r;r<rsrNr)r6rrr#rr;rxr<#test_reent_set_bases_on_direct_bases z+MroTest.test_reent_set_bases_on_direct_basecsGfdddt}Gddd|d}Gddd|Gdd d |d _tjd 7_Wd n1s~0Yd S) aM type_set_bases must check for an inheritance cycle not only through MRO of the type, which may be not yet updated in case of reentrance, but also through tp_base chain, which is assigned before diving into inner calls to mro(). Otherwise, the following snippet can loop forever: do { // ... type = type->tp_base; } while (type != NULL); Functions that rely on tp_base (like solid_base and PyType_IsSubtype) would not be happy in that case, causing a stack overflow. cseZdZfddZdS)z5MroTest.test_reent_set_bases_tp_base_cycle..Mcs4jr*|jdkrf_|jdkr*f_t|S)NB1B2rrrGrDrTrrrr6r;r<rTs   z9MroTest.test_reent_set_bases_tp_base_cycle..M.mroNrWr;rr;r<rsrc@s eZdZdS)z5MroTest.test_reent_set_bases_tp_base_cycle..ANrr;r;r;r<rsrrc@s eZdZdS)z6MroTest.test_reent_set_bases_tp_base_cycle..B1Nrr;r;r;r<rsrc@s eZdZdS)z6MroTest.test_reent_set_bases_tp_base_cycle..B2Nrr;r;r;r<rsrTr;N)rrrgrrGrr;rr<"test_reent_set_bases_tp_base_cycles  z*MroTest.test_reent_set_bases_tp_base_cyclecsGfdddt}Gddd|d}Gddd|}Gdd d |Gd d d |d _|f_f|_jfg|g|jf|gd S)a type_set_bases must check for reentrancy upon finishing its job by updating tp_subclasses of old/new bases of the type. Otherwise, an implicit inheritance cycle through tp_subclasses can break functions that recurse on elements of that field (like recurse_down_subclasses and mro_hierarchy) eventually leading to a stack overflow. cseZdZfddZdS)z;MroTest.test_tp_subclasses_cycle_in_update_slots..Mcs(jr|jdkrd_f_t|SNrFrrrrr6r;r<rTsz?MroTest.test_tp_subclasses_cycle_in_update_slots..M.mroNrWr;rr;r<rsrc@s eZdZdS)z;MroTest.test_tp_subclasses_cycle_in_update_slots..ANrr;r;r;r<rsrrc@s eZdZdS)z.B1Nrr;r;r;r<rsrc@s eZdZdS)z.B2Nrr;r;r;r<rsrc@s eZdZdS)z;MroTest.test_tp_subclasses_cycle_in_update_slots..CNrr;r;r;r<rsrTN)rrrGrBrr6rrrr;rr<(test_tp_subclasses_cycle_in_update_slotss z0MroTest.test_tp_subclasses_cycle_in_update_slotscsGdddtGfdddt}Gddd|d}Gdd d |}Gd d d |Gd d d |d_|f_Wdn1s0Yf|_jfjtt dS)z The same as test_tp_subclasses_cycle_in_update_slots, but tests a code path executed on error (goto bail). c@s eZdZdS)z=MroTest.test_tp_subclasses_cycle_error_return_path..ENrr;r;r;r<r,sr,cseZdZfddZdS)z=MroTest.test_tp_subclasses_cycle_error_return_path..Mcs:jr0|jdkr0jfkr$d_n f_t|Srrrrrr,r6r;r<rTs  zAMroTest.test_tp_subclasses_cycle_error_return_path..M.mroNrWr;rr;r<rsrc@s eZdZdS)z=MroTest.test_tp_subclasses_cycle_error_return_path..ANrr;r;r;r<rsrrc@s eZdZdS)z>MroTest.test_tp_subclasses_cycle_error_return_path..B1Nrr;r;r;r<rsrc@s eZdZdS)z>MroTest.test_tp_subclasses_cycle_error_return_path..B2Nrr;r;r;r<r src@s eZdZdS)z=MroTest.test_tp_subclasses_cycle_error_return_path..CNrr;r;r;r<r srTN) rrrrgrGrBrrrDrTrr;rr<*test_tp_subclasses_cycle_error_return_paths  &z2MroTest.test_tp_subclasses_cycle_error_return_pathcs*Gfdddt}Gddd|d}dS)z Extending an unitialized type with type->tp_mro == NULL must throw a reasonable TypeError exception, instead of failing with PyErr_BadInternalCall. cseZdZfddZdS)z)MroTest.test_incomplete_extend..McsX|jdurN|jdkrNt Gddd|}Wdn1sD0Yt|S)NrWc@s eZdZdS)z8MroTest.test_incomplete_extend..M.mro..XNrr;r;r;r<rW!s)rrrgrrDrT)rrWrxr;r<rTs .z-MroTest.test_incomplete_extend..M.mroNrWr;rxr;r<rsrc@s eZdZdS)z)MroTest.test_incomplete_extend..ANrr;r;r;r<r&srrNrrr;rxr<test_incomplete_extends zMroTest.test_incomplete_extendcs*Gfdddt}Gddd|d}dS)z Attribute lookup on a super object must be aware that its target type can be uninitialized (type->tp_mro == NULL). cseZdZfddZZS)z(MroTest.test_incomplete_super..McsJ|jdur@tt||jWdn1s60Yt|Sr)rrgrrZxxxrDrTrrr;r<rT/s  *z,MroTest.test_incomplete_super..M.mro)rrrrTrr;rxrr<r.src@s eZdZdS)z(MroTest.test_incomplete_super..ANrr;r;r;r<r6srrNrrr;rxr<test_incomplete_super)szMroTest.test_incomplete_superN)rrrrrnrrrrrrrrrr;r;r;r<rfs$$"r__main__) rrrrrrrvrxrrr.rNrrrrrrrr/rrrmr|rrrrDrrrmainr;r;r;r<s     x-<= U