a ze%@sddlZddlZddlmZGdddeZGdddeZGdddeZGd d d eZGd d d e Z Gd dde Z Gddde Z Gddde Z Gddde ZGddde ZGdddejZGdddeZGdddeZGdddejZedkredS) N)supportc@s eZdZdS) PropertyBaseN__name__ __module__ __qualname__rrF/opt/bitninja-python-dojo/embedded/lib/python3.9/test/test_property.pyrsrc@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)rrrrpropertyrsetterdeleterrrrr r s  r c@s8eZdZejjddZejddZejddZdS)SubClasscCst|jdSr)r rrrrr r'sz SubClass.spamcCst|jdSr)r rrrrr r,scCst|jdSr)r rrrrr r0sN)rrrr rgetterrrrrrr r%s   rc@s$eZdZdZddZeeddZdS)PropertyDocBasecCs|jSrrrrrr _get_spam6szPropertyDocBase._get_spamspam spam spamdocN)rrrrr rrrrrr r4src@seZdZejjddZdS)PropertyDocSubcCs|jSrrrrrr r;szPropertyDocSub.spamN)rrrrrrrrrr r$:sr$c@seZdZejjddZdS)PropertySubNewGettercCsdSrrrrrr rAszPropertySubNewGetter.spamN)rrrr rrrrrr r%@sr%c@s&eZdZeddZejddZdS)PropertyNewGettercCsdSNrrrrrr rGszPropertyNewGetter.spamcCsdS)Nrrrrr rKsN)rrrrrrrrrr r&Fs r&c@seZdZddZddZeejj dkdddZ eejj dkdd d Z d d Z eejj dkdd dZ ddZeejj dkdddZeejj dkdddZejddZeejj dkdddZeejj dkdddZdS) PropertyTestscCst}||jd||jdd|_||jd||jdt|d|t|d |t|d d|_||jd||jddS)Nr rr)r assertEqualrrdelattrZ assertTruehasattrrbaserrr !test_property_decorator_baseclassQs z/PropertyTests.test_property_decorator_baseclasscCs<t}|tt|d|tt|dd|tt|ddS)Nr)r assertRaisesr getattrr setattrr r-rsubrrr test_property_decorator_subclass`sz.PropertyTests.test_property_decorator_subclass)Docstrings are omitted with -O2 and abovecCst}||jjjddS)NzSubClass.getter)rr, __class__r__doc__r5rrr $test_property_decorator_subclass_docgsz2PropertyTests.test_property_decorator_subclass_doccCst}||jjjddS)NzBaseClass.getter)r r,r:rr;r/rrr %test_property_decorator_baseclass_docmsz3PropertyTests.test_property_decorator_baseclass_doccCs4t}t}||jjjd||jjjddS)Nr!)rr$r,r:rr;)rr0r6rrr test_property_decorator_docssz)PropertyTests.test_property_decorator_doccCsPt}||jd||jjjdt}||jd||jjjddS)Nrz new docstringr()r%r,rr:r;r&)rZ newgettersubZ newgetterrrr !test_property_getter_doc_overrideys z/PropertyTests.test_property_getter_doc_overridecsddgdgddfD],Gfdddt}||jjtqGdd d t|t,Gfd ddt}|jjWdn1s0YdS) NTFr1cs"eZdZddZe_eeZdS)EPropertyTests.test_property___isabstractmethod__descriptor..CcSsdSrrrrrr foosIPropertyTests.test_property___isabstractmethod__descriptor..C.fooNrrrrC__isabstractmethod__rr)valrr CsrHc@seZdZddZeZdS)zKPropertyTests.test_property___isabstractmethod__descriptor..NotBoolcSs tdSr) ValueErrorrrrr __bool__szTPropertyTests.test_property___isabstractmethod__descriptor..NotBool.__bool__N)rrrrJ__len__rrrr NotBoolsrLcs$eZdZddZe_eeZdS)rBcSsdSrrrrrr rCsrDNrEr)rLrr rHs)objectZassertIsrCrFboolr2rI)rrHr)rLrGr ,test_property___isabstractmethod__descriptors z:PropertyTests.test_property___isabstractmethod__descriptorcCs0tdd}||jdd|_||jddS)NZbasicr"Zextended)rr,r;)rprrr "test_property_builtin_doc_writables z0PropertyTests.test_property_builtin_doc_writablecCsHGdddt}|}||jjjdd|jj_||jjjddS)Nc@seZdZeddZdS)zOPropertyTests.test_property_decorator_doc_writable..PropertyWritableDoccSsdSNeggsrrrrr rszTPropertyTests.test_property_decorator_doc_writable..PropertyWritableDoc.spamN)rrrrrrrrr PropertyWritableDocsrTZEggsZSpam)rMr,r:rr;)rrTr6rrr $test_property_decorator_doc_writables  z2PropertyTests.test_property_decorator_doc_writablecCsXttd}tdddd}|}tdD]}|ddddq(|j||ddd dS) Ngettotalrefcountfgetfsetfdelr#drr*)Zdelta)rZ get_attributesysrrangerZassertAlmostEqual)rrVZ fake_propZ refs_beforeirrr test_refleaks_in___init__s   z'PropertyTests.test_refleaks_in___init__cCs Gddd}||jddS)Nc@seZdZeeddZdS)z,PropertyTests.test_class_property..AcSs d|jS)Nz A doc for %r)rclsrrr r;sz4PropertyTests.test_class_property..A.__doc__Nrrr classmethodrr;rrrr Asrcz A doc for 'A'r,r;rrcrrr test_class_propertysz!PropertyTests.test_class_propertycCs Gddd}||jddS)Nc@seZdZeeddZdS)z5PropertyTests.test_class_property_override..AcSsdS)NSecondrr_rrr r;sz=PropertyTests.test_class_property_override..A.__doc__Nrarrrr rcsrcrgrdrerrr test_class_property_overridesz*PropertyTests.test_class_property_overrideN)rrrr1r7unittestskipIfr[flagsoptimizer<r=r>r?rOrQrUrZ refcount_testr^rfrhrrrr r)PsD       r)c@s eZdZdS) PropertySubNrrrrr rmsrmc@seZdZdZdS)PropertySubSlotsrN)rrr __slots__rrrr rnsrnc@sheZdZddZeejjdkdddZ eejjdkdddZ eejjdkdd d Z d S) PropertySubclassTestscCs4zGdddt}Wnty&Yn 0tddS)Nc@seZdZeddZdS)zFPropertySubclassTests.test_slots_docstring_copy_exception..FoocSsdSr'rrrrr rszKPropertySubclassTests.test_slots_docstring_copy_exception..Foo.spamN)rrrrnrrrrr FoosrqzAttributeError not raised)rMAttributeError Exceptionrrqrrr #test_slots_docstring_copy_exceptions  z9PropertySubclassTests.test_slots_docstring_copy_exceptionr8r9cCs$Gdddt}||jjddS)Nc@seZdZeddZdS)z6PropertySubclassTests.test_docstring_copy..FoocSsdSr'rrrrr rsz;PropertySubclassTests.test_docstring_copy..Foo.spamNrrrrmrrrrr rqsrq!spam wrapped in property subclassrMr,rr;rtrrr test_docstring_copys z)PropertySubclassTests.test_docstring_copycsGdddt}||jdd|_||jd|jjdGfddd}|}||jdd|_||jd ||jjddS) 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)rrrrrmrrrrrr rqs  rqrr8rwcseZdZjjddZdS)zRPropertySubclassTests.test_property_setter_copies_getter_docstring..FooSubcSs d|_dSrRrrrrr rszWPropertySubclassTests.test_property_setter_copies_getter_docstring..FooSub.spamN)rrrrrrrqrr FooSubsr|rSrx)rrCr|Zfoosubrr{r ,test_property_setter_copies_getter_docstrings$ zBPropertySubclassTests.test_property_setter_copies_getter_docstringcsXGdddt}||jjdGdddtGfddd}||jjddS)Nc@s&eZdZeddZejddZdS)zIPropertySubclassTests.test_property_new_getter_new_docstring..FoocSsdSr'rrrrr rszNPropertySubclassTests.test_property_new_getter_new_docstring..Foo.spamcSsdSNr8rrrrr rsN)rrrrmrrrrrr rqs rqza new docstringc@seZdZeddZdS)zMPropertySubclassTests.test_property_new_getter_new_docstring..FooBasecSsdSr'rrrrr r"szRPropertySubclassTests.test_property_new_getter_new_docstring..FooBase.spamNrvrrrr FooBase!srcseZdZjjddZdS)zJPropertySubclassTests.test_property_new_getter_new_docstring..Foo2cSsdSrrrrrr r'szOPropertySubclassTests.test_property_new_getter_new_docstring..Foo2.spamN)rrrrrrrrr Foo2&srrx)rrqrrrr &test_property_new_getter_new_docstrings  zs&  W