Your IP : 216.73.216.213


Current Path : /opt/alt/python34/lib64/python3.4/test/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/test/__pycache__/test_dynamicclassattribute.cpython-34.pyc

�
g f�&�@s�ddlZddlZddlZddlmZddlmZGdd�de�ZGdd�de�Z	Gdd	�d	e�Z
Gd
d�de�ZGdd
�d
e�Z
Gdd�de
�ZGdd�de�ZGdd�de�ZGdd�de
�ZGdd�de�ZGdd�ddej�ZGdd�ddej�ZGdd�dej�ZGdd �d e�ZGd!d"�d"e�ZGd#d$�d$ej�Zd%d&�Zed'kr�e�ndS)(�N)�run_unittest)�DynamicClassAttributec@seZdZdS)�PropertyBaseN)�__name__�
__module__�__qualname__�rr�D/opt/alt/python34/lib64/python3.4/test/test_dynamicclassattribute.pyr
src@seZdZdS)�PropertyGetN)rrrrrrr	r

sr
c@seZdZdS)�PropertySetN)rrrrrrr	rsrc@seZdZdS)�PropertyDelN)rrrrrrr	rsrc@sXeZdZdd�Zedd��Zejdd��Zejdd��ZdS)�	BaseClasscCs
d|_dS)N�)�_spam)�selfrrr	�__init__szBaseClass.__init__cCs|jS)zBaseClass.getter)r)rrrr	�spamszBaseClass.spamcCs
||_dS)N)r)r�valuerrr	rscCs
|`dS)N)r)rrrr	r#sN)rrrrrr�setter�deleterrrrr	r
sr
c@s\eZdZejdZejdd��Zejdd��Zejdd��ZdS)�SubClassrcCst|j��dS)zSubClass.getterN)r
r)rrrr	r+sz
SubClass.spamcCst|j��dS)N)rr)rrrrr	r0scCst|j��dS)N)rr)rrrr	r4sN)	rrrr
�__dict__r�getterrrrrrr	r's
rc@s4eZdZdZdd�Zeedd�ZdS)�PropertyDocBase�cCs|jS)N)r)rrrr	�	_get_spam:szPropertyDocBase._get_spam�doczspam spam spamN)rrrrrrrrrrr	r8src@s2eZdZejdZejdd��ZdS)�PropertyDocSubrcCs|jS)z*The decorator does not use this doc string)r)rrrr	r@szPropertyDocSub.spamN)rrrrrrrrrrr	r>s
rc@s2eZdZejdZejdd��ZdS)�PropertySubNewGetterrcCsdS)z
new docstringrr)rrrr	rGszPropertySubNewGetter.spamN)rrrr
rrrrrrr	rEs
rc@s7eZdZedd��Zejdd��ZdS)�PropertyNewGettercCsdS)zoriginal docstringrr)rrrr	rMszPropertyNewGetter.spamcCsdS)z
new docstring�r)rrrr	rQsN)rrrrrrrrrr	rLsrc@s+eZdZeejdd���ZdS)� ClassWithAbstractVirtualPropertycCsdS)Nrrrrr	�colorWsz&ClassWithAbstractVirtualProperty.colorN)rrrr�abc�abstractmethodr"rrrr	r!Vsr!�	metaclassc@s+eZdZejedd���ZdS)� ClassWithPropertyAbstractVirtualcCsdS)Nrrrrr	r"]sz&ClassWithPropertyAbstractVirtual.colorN)rrrr#r$rr"rrrr	r&\sr&c@s�eZdZdd�Zdd�Zejejj	dkd�dd��Z
ejejj	dkd�d	d
��Zdd�Zejejj	dkd�d
d��Z
dd�Zdd�ZdS)�
PropertyTestscCs�t�}|j|jd�|j|jd�d|_|j|jd�|j|jd�t|d�|jt|d��|jt|d��d|_|j|jd�|j|jd�dS)Nr�
rr�)r
�assertEqualrr�delattrZ
assertTrue�hasattr)r�baserrr	�!test_property_decorator_baseclasscs		
	z/PropertyTests.test_property_decorator_baseclasscCsRt�}|jtt|d�|jtt|dd�|jtt|d�dS)Nr)r�assertRaisesr
�getattrr�setattrrr+)r�subrrr	� test_property_decorator_subclassrs	z.PropertyTests.test_property_decorator_subclass�z)Docstrings are omitted with -O2 and abovecCs*t�}|j|jjdjd�dS)NrzSubClass.getter)rr*�	__class__r�__doc__)rr2rrr	�$test_property_decorator_subclass_docys	z2PropertyTests.test_property_decorator_subclass_doccCs*t�}|j|jjdjd�dS)NrzBaseClass.getter)r
r*r5rr6)rr-rrr	�%test_property_decorator_baseclass_docs	z3PropertyTests.test_property_decorator_baseclass_doccCsPt�}t�}|j|jjdjd�|j|jjdjd�dS)Nrzspam spam spam)rrr*r5rr6)rr-r2rrr	�test_property_decorator_doc�s		z)PropertyTests.test_property_decorator_doccCsvt�}|j|jd�|j|jjdjd�t�}|j|jd�|j|jjdjd�dS)Nrrz
new docstringr )rr*rr5rr6r)rZnewgettersubZ	newgetterrrr	�!test_property_getter_doc_override�s		z/PropertyTests.test_property_getter_doc_overridecs�x_ddgdgddfD]B�G�fdd�dt�}|j|jdjt���qWGd	d
�d
t��|jt��!G�fdd�dt�}WdQXdS)NTFr��1cs1eZdZdd�Z�e_ee�ZdS)zEPropertyTests.test_property___isabstractmethod__descriptor.<locals>.CcSsdS)Nr)rrrr	�foo�szIPropertyTests.test_property___isabstractmethod__descriptor.<locals>.C.fooN)rrrr=�__isabstractmethod__rr)�valrr	�C�s	r@r=c@s"eZdZdd�ZeZdS)zKPropertyTests.test_property___isabstractmethod__descriptor.<locals>.NotBoolcSs
t��dS)N)�
ValueError)rrrr	�__bool__�szTPropertyTests.test_property___isabstractmethod__descriptor.<locals>.NotBool.__bool__N)rrrrB�__len__rrrr	�NotBool�srDcs4eZdZdd�Z��e_ee�ZdS)zEPropertyTests.test_property___isabstractmethod__descriptor.<locals>.CcSsdS)Nr)rrrr	r=�szIPropertyTests.test_property___isabstractmethod__descriptor.<locals>.C.fooN)rrrr=r>rr)rDrr	r@�s)�objectZassertIsrr>�boolr/rA)rr@r)rDr?r	�,test_property___isabstractmethod__descriptor�s"$z:PropertyTests.test_property___isabstractmethod__descriptorcCs|jtt�|jtt�Gdd�dt�}|jt|�Gdd�dt�}|jt|�Gdd�dt�}|jt��|jWdQX|j|�jd�Gdd	�d	t�}|jt��|jWdQX|j|�jd
�dS)Nc@seZdZdS)z0PropertyTests.test_abstract_virtual.<locals>.APVN)rrrrrrr	�APV�srHc@seZdZdS)z0PropertyTests.test_abstract_virtual.<locals>.AVPN)rrrrrrr	�AVP�srIc@s.eZdZedd��Zdd�ZdS)z2PropertyTests.test_abstract_virtual.<locals>.Okay1cSs|jS)N)�_color)rrrr	r"�sz8PropertyTests.test_abstract_virtual.<locals>.Okay1.colorcSs
d|_dS)N�cyan)rJ)rrrr	r�sz;PropertyTests.test_abstract_virtual.<locals>.Okay1.__init__N)rrrrr"rrrrr	�Okay1�srLrKc@s.eZdZedd��Zdd�ZdS)z2PropertyTests.test_abstract_virtual.<locals>.Okay2cSs|jS)N)rJ)rrrr	r"�sz8PropertyTests.test_abstract_virtual.<locals>.Okay2.colorcSs
d|_dS)N�magenta)rJ)rrrr	r�sz;PropertyTests.test_abstract_virtual.<locals>.Okay2.__init__N)rrrrr"rrrrr	�Okay2�srNrM)r/�	TypeErrorr!r&�AttributeErrorr"r*)rrHrIrLrNrrr	�test_abstract_virtual�s

z#PropertyTests.test_abstract_virtualN)rrrr.r3�unittest�skipIf�sys�flags�optimizer7r8r9r:rGrQrrrr	r'bs	r'c@seZdZdZdS)�PropertySubz+This is a subclass of DynamicClassAttributeN)rrrr6rrrr	rW�srWc@seZdZdZfZdS)�PropertySubSlotszBThis is a subclass of DynamicClassAttribute that defines __slots__N)rrrr6�	__slots__rrrr	rX�srXc@s�eZdZejeed�d�dd��Zejej	j
dkd�dd��Zejej	j
dkd�d	d
��Zejej	j
dkd�dd��Z
d
S)�PropertySubclassTestsr6z9__doc__ is already present, __slots__ will have no effectcCs?yGdd�dt�}Wntk
r.Yn
Xtd��dS)Nc@s2eZdZedd��Zedej�dS)zFPropertySubclassTests.test_slots_docstring_copy_exception.<locals>.FoocSsdS)z5Trying to copy this docstring will raise an exceptionrr)rrrr	r�szKPropertySubclassTests.test_slots_docstring_copy_exception.<locals>.Foo.spam�
N)rrrrXr�printr6rrrr	�Foo�sr]zAttributeError not raised)rErP�	Exception)rr]rrr	�#test_slots_docstring_copy_exception�s

z9PropertySubclassTests.test_slots_docstring_copy_exceptionr4z)Docstrings are omitted with -O2 and abovecCs4Gdd�dt�}|j|jdjd�dS)Nc@s"eZdZedd��ZdS)z6PropertySubclassTests.test_docstring_copy.<locals>.FoocSsdS)z.spam wrapped in DynamicClassAttribute subclassrr)rrrr	r�sz;PropertySubclassTests.test_docstring_copy.<locals>.Foo.spamN)rrrrWrrrrr	r]�sr]rz.spam wrapped in DynamicClassAttribute subclass)rEr*rr6)rr]rrr	�test_docstring_copy�s
z)PropertySubclassTests.test_docstring_copycs�Gdd�dt����}|j|jd�d|_|j|jd�|j�jdjd�G�fdd�d��}|�}|j|jd�d	|_|j|jd
�|j|jdjd�dS)Nc@sCeZdZdd�Zedd��Zejdd��ZdS)zOPropertySubclassTests.test_property_setter_copies_getter_docstring.<locals>.FoocSs
d|_dS)Nr)r)rrrr	r�szXPropertySubclassTests.test_property_setter_copies_getter_docstring.<locals>.Foo.__init__cSs|jS)z.spam wrapped in DynamicClassAttribute subclass)r)rrrr	r�szTPropertySubclassTests.test_property_setter_copies_getter_docstring.<locals>.Foo.spamcSs
||_dS)zthis docstring is ignoredN)r)rrrrr	r�sN)rrrrrWrrrrrr	r]�sr]rr4rz.spam wrapped in DynamicClassAttribute subclasscs2eZdZ�jdZejdd��ZdS)zRPropertySubclassTests.test_property_setter_copies_getter_docstring.<locals>.FooSubrcSs
d|_dS)zanother ignored docstring�eggsN)r)rrrrr	rszWPropertySubclassTests.test_property_setter_copies_getter_docstring.<locals>.FooSub.spamN)rrrrrrr)r]rr	�FooSubs
rb�ra)rEr*rrr6)rr=rbZfoosubr)r]r	�,test_property_setter_copies_getter_docstring�s 
		
		
zBPropertySubclassTests.test_property_setter_copies_getter_docstringcs�Gdd�dt�}|j|jdjd�Gdd�dt��G�fdd�d��}|j|jdjd�dS)	Nc@s7eZdZedd��Zejdd��ZdS)zIPropertySubclassTests.test_property_new_getter_new_docstring.<locals>.FoocSsdS)za docstringrr)rrrr	rszNPropertySubclassTests.test_property_new_getter_new_docstring.<locals>.Foo.spamcSsdS)za new docstringr4r)rrrr	rsN)rrrrWrrrrrr	r]sr]rza new docstringc@s"eZdZedd��ZdS)zMPropertySubclassTests.test_property_new_getter_new_docstring.<locals>.FooBasecSsdS)za docstringrr)rrrr	rszRPropertySubclassTests.test_property_new_getter_new_docstring.<locals>.FooBase.spamN)rrrrWrrrrr	�FooBasesrecs2eZdZ�jdZejdd��ZdS)zJPropertySubclassTests.test_property_new_getter_new_docstring.<locals>.Foo2rcSsdS)za new docstringr4r)rrrr	r$szOPropertySubclassTests.test_property_new_getter_new_docstring.<locals>.Foo2.spamN)rrrrrrr)rerr	�Foo2"s
rf)rEr*rr6)rr]rfr)rer	�&test_property_new_getter_new_docstrings
	z<PropertySubclassTests.test_property_new_getter_new_docstringN)rrrrRrSr,rXr_rTrUrVr`rdrgrrrr	rZ�s!rZcCsttt�dS)N)rr'rZrrrr	�	test_main,srh�__main__)r#rTrRZtest.supportr�typesrr^rr
rrrEr
rrrrr�ABCMetar!r&ZTestCaser'rWrXrZrhrrrrr	�<module>s.
g\