Your IP : 216.73.216.213


Current Path : /opt/alt/python35/lib64/python3.5/test/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/test/__pycache__/test_super.cpython-35.opt-1.pyc



��Yf��@s�dZddlZddlZGdd�d�ZGdd�de�ZGdd�de�ZGd	d
�d
ee�ZGdd�de�ZGd
d�de�ZGdd�de�Z	Gdd�dej
�Zedkr�ej
�dS)z*Unit tests for new super() implementation.�Nc@s.eZdZdd�Zedd��ZdS)�AcCsdS)Nr�)�selfrr�4/opt/alt/python35/lib64/python3.5/test/test_super.py�fszA.fcCs
|dfS)Nrr)�clsrrr�cm
szA.cmN)�__name__�
__module__�__qualname__r�classmethodrrrrrrsrcs:eZdZ�fdd�Ze�fdd��Z�S)�Bcst�j�dS)Nr
)�superr)r)�	__class__rrrszB.fcs|t�j�dfS)Nr
)rr)r)rrrrszB.cm)r	r
rrrrrr)rrr
sr
cs:eZdZ�fdd�Ze�fdd��Z�S)�Ccst�j�dS)Nr)rr)r)rrrrszC.fcs|t�j�dfS)Nr)rr)r)rrrrszC.cm)r	r
rrrrrr)rrrsrcs4eZdZ�fdd�Z�fdd�Z�S)�Dcst�j�dS)Nr)rr)r)rrrrszD.fcs|t�j�dfS)Nr)rr)r)rrrrszD.cm)r	r
rrrrr)rrrsrc@seZdZdS)�EN)r	r
rrrrrr"src@seZdZejZdS)�FN)r	r
rrrrrrrr%src@seZdZdS)�GN)r	r
rrrrrr(srcs�eZdZ�fdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
�fdd�Zdd�Zdd�Z
dd�Z�fdd�Zdd�Z�fdd�Z�S)�	TestSupercs
t�dS)N)r)r)rrr�tearDown.szTestSuper.tearDowncCs|jt�j�d�dS)N�ABCD)�assertEqualrr)rrrr�test_basics_working3szTestSuper.test_basics_workingcCs |jtjt��d�dS)Nr)rrr)rrrr�test_class_getattr_working6sz$TestSuper.test_class_getattr_workingcCs9|jt�j�d�|jtjt��d�dS)Nr)rrr)rrrr�!test_subclass_no_override_working9sz+TestSuper.test_subclass_no_override_workingcCs9|jt�j�d�|jtjt��d�dS)Nr)rrr)rrrr�$test_unbound_method_transfer_working=sz.TestSuper.test_unbound_method_transfer_workingcCsz|jtj�tdf�|jt�j�tdf�|jtj�tdf�|jt�j�tdf�dS)Nr)rrrr)rrrr� test_class_methods_still_workingAsz*TestSuper.test_class_methods_still_workingcCs�t�}|j|j�|tttdfdfdfdf�t�}|j|j�|tttdfdfdfdf�dS)Nrr
rr)rrrr)r�d�errr�#test_super_in_class_methods_workingGs	7	z-TestSuper.test_super_in_class_methods_workingcCs3Gdd�dt�}|j|�j�d�dS)Ncs"eZdZ�fdd�Z�S)z,TestSuper.test_super_with_closure.<locals>.Ecs#�fdd�}t�j�dS)Ncs�dS)Nrr)rrr�nestedRsz>TestSuper.test_super_with_closure.<locals>.E.f.<locals>.nestedr)rr)rr!)r)rrrQsz.TestSuper.test_super_with_closure.<locals>.E.f)r	r
rrrr)rrrPsrZAE)rrr)rrrrr�test_super_with_closureMsz!TestSuper.test_super_with_closurecs3Gdd�dt�}|�}|j|j�d�|j|jd�G�fdd�d�}|j|jt|��|jt��}t	dt
�i�WdQRX|jt|j�t�Gdd�d�}|jt
�dd	�t
�d=|jd|j
�G�fd
d�d�}|j�d	�dS)Ncs(eZdZ�fdd�ZdZ�S)z7TestSuper.test_various___class___pathologies.<locals>.Xcs
t�j�S)N)rr)r)rrrr[sz9TestSuper.test_various___class___pathologies.<locals>.X.fi�)r	r
rrrrr)rr�XZsr#ri�cs(eZdZ�Z�fdd�Z�S)z7TestSuper.test_various___class___pathologies.<locals>.Xcs�dS)Nrr)rrrrcsz9TestSuper.test_various___class___pathologies.<locals>.X.f)r	r
r�xrr)r)rrr#aszYclass X:
                __class__
                def f():
                    __class__cs(eZdZda�fdd�Z�S)z7TestSuper.test_various___class___pathologies.<locals>.X�*cs�dS)Nrr)rrrrosz9TestSuper.test_various___class___pathologies.<locals>.X.f)r	r
rrrrr)rrr#lsrr%cs(eZdZd��fdd�Z�S)z7TestSuper.test_various___class___pathologies.<locals>.Xr%cs�dS)Nrr)rrrrwsz9TestSuper.test_various___class___pathologies.<locals>.X.f)r	r
rrr)r)rrr#ts)rrrr�assertIsr$�type�assertRaises�	NameError�exec�globalsZ	exceptionZassertNotIn�__dict__)rr#r$r)rrr�"test_various___class___pathologiesXs 	
z,TestSuper.test_various___class___pathologiescCs0Gdd�d�}|j|�j�|�dS)Ncs"eZdZ�fdd�Z�S)z2TestSuper.test___class___instancemethod.<locals>.Xcs�S)Nr)r)rrrr~sz4TestSuper.test___class___instancemethod.<locals>.X.f)r	r
rrrr)rrr#}sr#)r&r)rr#rrr�test___class___instancemethod{sz'TestSuper.test___class___instancemethodcCs-Gdd�d�}|j|j�|�dS)Ncs(eZdZe�fdd��Z�S)z/TestSuper.test___class___classmethod.<locals>.Xcs�S)Nr)r)rrrr�sz1TestSuper.test___class___classmethod.<locals>.X.f)r	r
rrrrr)rrr#�sr#)r&r)rr#rrr�test___class___classmethod�sz$TestSuper.test___class___classmethodcCs-Gdd�d�}|j|j�|�dS)Ncs(eZdZe�fdd��Z�S)z0TestSuper.test___class___staticmethod.<locals>.Xcs�S)Nrr)rrrr�sz2TestSuper.test___class___staticmethod.<locals>.X.f)r	r
r�staticmethodrrr)rrr#�sr#)r&r)rr#rrr�test___class___staticmethod�sz%TestSuper.test___class___staticmethodcst�fdd�}|jt|��fdd�}|jt|d�Gdd�d�}|jt|�j�dS)Ncst�dS)N)rr)rrrr�sz.TestSuper.test_obscure_super_errors.<locals>.fcs~t�dS)N)r)r$)rrrr�scs"eZdZ�fdd�Z�S)z.TestSuper.test_obscure_super_errors.<locals>.Xcs�t�dS)N)r)r$)rrrr�sz0TestSuper.test_obscure_super_errors.<locals>.X.f)r	r
rrrr)rrr#�sr#)r(�RuntimeErrorr)rrr#)rrr�test_obscure_super_errors�sz#TestSuper.test_obscure_super_errorscsOGdd�d���fdd�}|�jd}|jt�j|�dS)Ncs"eZdZ�fdd�Z�S)z&TestSuper.test_cell_as_self.<locals>.Xcst�dS)N)r)r)rrr�meth�sz+TestSuper.test_cell_as_self.<locals>.X.meth)r	r
rr4rr)rrr#�sr#cs����fdd�}|S)Ncs�S)Nrr)�krr�g�sz1TestSuper.test_cell_as_self.<locals>.f.<locals>.gr)r6)r#)r5rr�s	z&TestSuper.test_cell_as_self.<locals>.fr)�__closure__r(�	TypeErrorr4)rr�cr)r#r�test_cell_as_self�szTestSuper.test_cell_as_selfcs=ttd�}x'td�D]}tj|t|�qWdS)Ng�?i�)r�float�range�__init__�int)rZsp�i)rrr�test_super_init_leaks�szTestSuper.test_super_init_leaks)r	r
rrrrrrrr r"r-r.r/r1r3r:r@rr)rrr,s#
r�__main__)�__doc__�sysZunittestrr
rrrrrZTestCaserr	�mainrrrr�<module>s�