a zeC&@sFddlZddlZddlZddlmZGdddeZGdddeZGdddeZGd d d eZ Gd d d e Z Gd dde Z Gddde Z Gddde ZGddde ZGddde ZGdddejdZGdddejdZGdddejZGdddeZGd d!d!eZGd"d#d#ejZed$krBedS)%N)DynamicClassAttributec@s eZdZdS) PropertyBaseN__name__ __module__ __qualname__rrS/opt/bitninja-python-dojo/embedded/lib/python3.9/test/test_dynamicclassattribute.pyr src@s eZdZdS) PropertyGetNrrrrr r sr c@s eZdZdS) PropertySetNrrrrr r sr c@s eZdZdS) PropertyDelNrrrrr r sr c@s<eZdZddZeddZejddZejddZdS) BaseClasscCs d|_dSN_spamselfrrr __init__szBaseClass.__init__cCs|jSNrrrrr spamszBaseClass.spamcCs ||_dSrrrvaluerrr rscCs|`dSrrrrrr r"sN)rrrrrrsetterdeleterrrrr r s  r c@s@eZdZejdZejddZejddZejddZdS)SubClassrcCst|jdSr)r rrrrr r*sz SubClass.spamcCst|jdSr)r rrrrr r/scCst|jdSr)r rrrrr r3sN) rrrr __dict__rgetterrrrrrr r&s   rc@s$eZdZdZddZeeddZdS)PropertyDocBasecCs|jSrrrrrr _get_spam9szPropertyDocBase._get_spamspam spam spam)docN)rrrrr rrrrrr r7src@s$eZdZejdZejddZdS)PropertyDocSubrcCs|jSrrrrrr r?szPropertyDocSub.spamN)rrrrrrrrrrr r#=s r#c@s$eZdZejdZejddZdS)PropertySubNewGetterrcCsdSrrrrrr rFszPropertySubNewGetter.spamN)rrrr rrrrrrr r$Ds r$c@s&eZdZeddZejddZdS)PropertyNewGettercCsdSNrrrrrr rLszPropertyNewGetter.spamcCsdS)Nrrrrr rPsN)rrrrrrrrrr r%Ks r%c@seZdZeejddZdS) ClassWithAbstractVirtualPropertycCsdSrrrrrr colorVsz&ClassWithAbstractVirtualProperty.colorN)rrrrabcabstractmethodr)rrrr r(Usr() metaclassc@seZdZejeddZdS) ClassWithPropertyAbstractVirtualcCsdSrrrrrr r)\sz&ClassWithPropertyAbstractVirtual.colorN)rrrr*r+rr)rrrr r-[sr-c@seZdZddZddZeejj dkdddZ eejj dkdd d Z d d Z eejj dkdd dZ ddZddZdS) PropertyTestscCst}||jd||jdd|_||jd||jdt|d|t|d |t|d d|_||jd||jddS)Nr rr)r assertEqualrrdelattrZ assertTruehasattrrbaserrr !test_property_decorator_baseclassbs z/PropertyTests.test_property_decorator_baseclasscCs<t}|tt|d|tt|dd|tt|ddS)Nr)r assertRaisesr getattrr setattrr r2rsubrrr test_property_decorator_subclassqsz.PropertyTests.test_property_decorator_subclass)Docstrings are omitted with -O2 and abovecCs t}||jjdjddS)NrzSubClass.getter)rr1 __class__r__doc__r:rrr $test_property_decorator_subclass_docxsz2PropertyTests.test_property_decorator_subclass_doccCs t}||jjdjddS)NrzBaseClass.getter)r r1r?rr@r4rrr %test_property_decorator_baseclass_doc~sz3PropertyTests.test_property_decorator_baseclass_doccCs<t}t}||jjdjd||jjdjddS)Nrr!)rr#r1r?rr@)rr5r;rrr test_property_decorator_docsz)PropertyTests.test_property_decorator_doccCsXt}||jd||jjdjdt}||jd||jjdjddS)Nrrz new docstringr')r$r1rr?rr@r%)rZ newgettersubZ newgetterrrr !test_property_getter_doc_overrides z/PropertyTests.test_property_getter_doc_overridecsddgdgddfD]0Gfdddt}||jdjtqGd d d t|t$Gfd ddt}Wdn1s0YdS) NTFr1cs"eZdZddZe_eeZdS)EPropertyTests.test_property___isabstractmethod__descriptor..CcSsdSrrrrrr foosIPropertyTests.test_property___isabstractmethod__descriptor..C.fooNrrrrH__isabstractmethod__rr)valrr CsrMrHc@seZdZddZeZdS)zKPropertyTests.test_property___isabstractmethod__descriptor..NotBoolcSs tdSr) ValueErrorrrrr __bool__szTPropertyTests.test_property___isabstractmethod__descriptor..NotBool.__bool__N)rrrrO__len__rrrr NotBoolsrQcs$eZdZddZe_eeZdS)rGcSsdSrrrrrr rHsrINrJr)rQrr rMs)objectZassertIsrrKboolr7rN)rrMr)rQrLr ,test_property___isabstractmethod__descriptors  z:PropertyTests.test_property___isabstractmethod__descriptorcCs|tt|ttGdddt}|t|Gdddt}|t|Gdddt}|t|jWdn1s0Y||jdGdd d t}|t|jWdn1s0Y||jd dS) Nc@s eZdZdS)z0PropertyTests.test_abstract_virtual..APVNrrrrr APVsrUc@s eZdZdS)z0PropertyTests.test_abstract_virtual..AVPNrrrrr AVPsrVc@s eZdZeddZddZdS)z2PropertyTests.test_abstract_virtual..Okay1cSs|jSrZ_colorrrrr r)sz8PropertyTests.test_abstract_virtual..Okay1.colorcSs d|_dS)NcyanrWrrrr rsz;PropertyTests.test_abstract_virtual..Okay1.__init__Nrrrrr)rrrrr Okay1s rZrXc@s eZdZeddZddZdS)z2PropertyTests.test_abstract_virtual..Okay2cSs|jSrrWrrrr r)sz8PropertyTests.test_abstract_virtual..Okay2.colorcSs d|_dS)NmagentarWrrrr rsz;PropertyTests.test_abstract_virtual..Okay2.__init__NrYrrrr Okay2s r\r[)r7 TypeErrorr(r-AttributeErrorr)r1)rrUrVrZr\rrr test_abstract_virtuals     $ $z#PropertyTests.test_abstract_virtualN)rrrr6r<unittestskipIfsysflagsoptimizerArBrCrDrTr_rrrr r.as"   r.c@s eZdZdS) PropertySubNrrrrr resrec@seZdZdZdS)PropertySubSlotsrN)rrr __slots__rrrr rfsrfc@szeZdZeeeddddZeej j dkdddZ eej j dkdd d Z eej j dkdd d Z d S)PropertySubclassTestsr@z9__doc__ is already present, __slots__ will have no effectcCs4zGdddt}Wnty&Yn 0tddS)Nc@s$eZdZeddZedejdS)zFPropertySubclassTests.test_slots_docstring_copy_exception..FoocSsdSr&rrrrr rszKPropertySubclassTests.test_slots_docstring_copy_exception..Foo.spam N)rrrrfrprintr@rrrr Foos rkzAttributeError not raised)rRr^ Exceptionrrkrrr #test_slots_docstring_copy_exceptions  z9PropertySubclassTests.test_slots_docstring_copy_exceptionr=r>cCs(Gdddt}||jdjddS)Nc@seZdZeddZdS)z6PropertySubclassTests.test_docstring_copy..FoocSsdSr&rrrrr rsz;PropertySubclassTests.test_docstring_copy..Foo.spamNrrrrerrrrr rksrkr.spam wrapped in DynamicClassAttribute subclassrRr1rr@rmrrr test_docstring_copys  z)PropertySubclassTests.test_docstring_copycsGdddt}||jdd|_||jd|jdjdGfddd}|}||jdd |_||jd ||jdjddS) Nc@s.eZdZddZeddZejddZdS)zOPropertySubclassTests.test_property_setter_copies_getter_docstring..FoocSs d|_dSr&rrrrr rzXPropertySubclassTests.test_property_setter_copies_getter_docstring..Foo.__init__cSs|jSrrrrrr rszTPropertySubclassTests.test_property_setter_copies_getter_docstring..Foo.spamcSs ||_dSrrrrrr rsN)rrrrrerrrrrr rks  rkrr=rrpcs$eZdZjdZejddZdS)zRPropertySubclassTests.test_property_setter_copies_getter_docstring..FooSubrcSs d|_dS)Neggsrrrrr rszWPropertySubclassTests.test_property_setter_copies_getter_docstring..FooSub.spamN)rrrrrrrrkrr FooSubs rvrt)rRr1rrr@)rrHrvZfoosubrrur ,test_property_setter_copies_getter_docstrings$   zBPropertySubclassTests.test_property_setter_copies_getter_docstringcs`Gdddt}||jdjdGdddtGfddd}||jdjddS) Nc@s&eZdZeddZejddZdS)zIPropertySubclassTests.test_property_new_getter_new_docstring..FoocSsdSr&rrrrr rszNPropertySubclassTests.test_property_new_getter_new_docstring..Foo.spamcSsdSNr=rrrrr rsN)rrrrerrrrrr rks rkrza new docstringc@seZdZeddZdS)zMPropertySubclassTests.test_property_new_getter_new_docstring..FooBasecSsdSr&rrrrr rszRPropertySubclassTests.test_property_new_getter_new_docstring..FooBase.spamNrorrrr FooBasesrzcs$eZdZjdZejddZdS)zJPropertySubclassTests.test_property_new_getter_new_docstring..Foo2rcSsdSryrrrrr r#szOPropertySubclassTests.test_property_new_getter_new_docstring..Foo2.spamN)rrrrrrrrzrr Foo2!s r|rq)rrkr|rr{r &test_property_new_getter_new_docstrings  zs*  g\