HEX
Server: LiteSpeed
System: Linux server.nevid-deploma.com 4.18.0-553.111.1.lve.el8.x86_64 #1 SMP Fri Mar 13 13:42:17 UTC 2026 x86_64
User: smilepac (1037)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //opt/cppython/lib/python3.8/test/__pycache__/test_decorators.cpython-38.opt-2.pyc
U

.D�g�%�@s�ddlZdd�ZGdd�de�ZGdd�de�Zddd	�Zd
d�Zdd
�ZGdd�dej	�Z
Gdd�dej	�Zedkr~e�
�dS)�Ncs�fdd�}|S)Ncs|j���|S�N)�__dict__�update��func��kwds��3/opt/cppython/lib/python3.8/test/test_decorators.py�decorateszfuncattrs.<locals>.decorater	)rrr	rr
�	funcattrssrc@seZdZedd��ZdS)�MiscDecoratorscs�fdd�}|S)Ncs�|jd<|S)N�author)rr��namer	r
rs
z'MiscDecorators.author.<locals>.decorater	)rrr	rr
r
szMiscDecorators.authorN)�__name__�
__module__�__qualname__�staticmethodrr	r	r	r
r
	sr
c@seZdZdd�ZdS)�DbcheckErrorcCst�|d||||f�dS)Nz+dbcheck %r failed (func=%s args=%s kwds=%s))�	Exception�__init__)�self�exprstrr�argsrr	r	r
rs
�zDbcheckError.__init__N)rrrrr	r	r	r
rsrcs���fdd�}|S)Ncs*t�d�jd�������fdd�}|S)Nz
dbcheck-%s�evalcs$t����st��||���||�Sr)rr�rr)�exprrr�globals�localsr	r
�checksz(dbcheck.<locals>.decorate.<locals>.check)�compiler)rr �rrr)rrr
rszdbcheck.<locals>.decorater	)rrrrr	r"r
�dbchecksr#cs�fdd�}|S)Ncs(�j�d��<���fdd�}�|_|S)Nrcs��d7<�||�S)N�r	r)�countsr�	func_namer	r
�call,sz*countcalls.<locals>.decorate.<locals>.call�r�rr'�r%)rr&r
r)s
zcountcalls.<locals>.decorater	)r%rr	r*r
�
countcalls'sr+csi���fdd�}�j|_|S)NcsRz
�|WStk
r2�|�}|�|<|YStk
rL�|�YSXdSr)�KeyError�	TypeError)r�res�rZsavedr	r
r'7s
zmemoize.<locals>.callr(r)r	r/r
�memoize5s
r0c@s\eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�ZdS)�TestDecoratorscCs6Gdd�dt�}|�|��d�|�|���d�dS)Nc@seZdZedd��ZdS)z%TestDecorators.test_single.<locals>.CcSsdS�N�*r	r	r	r	r
�fooJsz)TestDecorators.test_single.<locals>.C.fooN)rrrrr4r	r	r	r
�CIsr5r3)�object�assertEqualr4�rr5r	r	r
�test_singleHszTestDecorators.test_singlecCstdd��}|�t|d�dS)NcSs|Srr	��xr	r	r
�
notamethodPsz=TestDecorators.test_staticmethod_function.<locals>.notamethodr$)r�assertRaisesr-)rr<r	r	r
�test_staticmethod_functionOs
z)TestDecorators.test_staticmethod_functioncCs8t�}|�d�dd��}|�|�d�|�|jd�dS)NZCleesecSsdSr2r	r	r	r	r
r4Wsz'TestDecorators.test_dotted.<locals>.foor3)r
rr7)rZ
decoratorsr4r	r	r
�test_dottedUs

zTestDecorators.test_dottedcCs�dd�}d}tddd�}|||�dd��}|�|�d	�|�|j||f�|d
ddd
d�dd��}|�|�d�|�|jdtdd
d�f�|dd�dd��}|�|jdif�dS)Ncs��fdd�}|S)Ncst|d��f�|S)N�dbval)�setattrrrr	r
rasz@TestDecorators.test_argforms.<locals>.noteargs.<locals>.decorater	)rrrr	rr
�noteargs`sz.TestDecorators.test_argforms.<locals>.noteargs)ZNow�isZthe�timer$�)ZoneZtwocSsdSr2r	r	r	r	r
�f1hsz(TestDecorators.test_argforms.<locals>.f1r3�terry�gilliamZidleZcleese)ZericZjohncSsdS)N�Tr	r	r	r	r
�f2msz(TestDecorators.test_argforms.<locals>.f2rI)rGrHcSsdSrr	r	r	r	r
�f3ssz(TestDecorators.test_argforms.<locals>.f3)r$rE)�dictr7r@)rrBrrrFrJrKr	r	r
�
test_argforms\s 



�
zTestDecorators.test_argformscCs6td�dd��}|�|dd�d�|�t|dd�dS)Nzargs[1] is not NonecSs||Srr	)�a�br	r	r
�fxsz&TestDecorators.test_dbcheck.<locals>.fr$rE�)r#r7r=r)rrPr	r	r
�test_dbcheckws
zTestDecorators.test_dbcheckcCs�i}tt|�dd���}|�|jd�|�|tdd��|�|d�d�|�|dd�|�|d�d�|�|dd�|�|d	�d
�|�|dd�|�|dg�ddg�|�|dd	�|�|dg�ddg�|�|dd�dS)NcSs|dS)NrEr	r:r	r	r
�double�sz+TestDecorators.test_memoize.<locals>.doublerSr)rSrE�r$rQ��
)r0r+r7rrL)rr%rSr	r	r
�test_memoize~s zTestDecorators.test_memoizecCs�dD]*}t|dd�d|}|�tt|dd�q|�ttddd�dd�}td|d	�}d
tfdtfdtfd
tffD],\}}d|}t|dd�}|�|t||�qrdS)N)z1+2zx[3]z(1, 2)Ztestexpr�execz@%s
def f(): pass�testz@f1 @f2
def f(): passcSst�dSr)�NotImplementedErrorrr	r	r
�unimp�sz)TestDecorators.test_errors.<locals>.unimp)�nullvalr[Zundefr\znullval.attrr[z$@%s
def f(): pass
assert f() is None)	r!r=�SyntaxErrorrL�	NameErrorr-�AttributeErrorrZr)rrZcodestrr[�context�exc�coder	r	r
�test_errors�s&��zTestDecorators.test_errorscCsVGdd�dt�}|�|���d�|�|jjd�|�|jjd�|�|jjd�dS)Nc@s*eZdZeddd�edd�dd���ZdS)	z%TestDecorators.test_double.<locals>.Cr$�haha)�abc�xyzr3)�boohcSsdSr2r	)rr	r	r
r4�sz)TestDecorators.test_double.<locals>.C.fooN)rrrrr4r	r	r	r
r5�s
r5r3r$rd)r6r7r4rerfrgr8r	r	r
�test_double�s
zTestDecorators.test_doublecCs4dd�}|d�|d�dd���}|�|�dd�dS)Ncs�fdd�}|S)Ncs�fdd�S)Ncs�Srr	r	��numr	r
�<lambda>��zJTestDecorators.test_order.<locals>.callnum.<locals>.deco.<locals>.<lambda>r	rrir	r
�deco�sz8TestDecorators.test_order.<locals>.callnum.<locals>.decor	)rjrmr	rir
�callnum�sz*TestDecorators.test_order.<locals>.callnumrEr$cSsdSr2r	r	r	r	r
r4�sz&TestDecorators.test_order.<locals>.fooz,Application order of decorators is incorrect)r7)rrnr4r	r	r
�
test_order�s
�zTestDecorators.test_ordercs�g��fdd��G��fdd�dt�}t|dddg�\}}}dd	d
ddd
ddddddg}g�|�|j�|�|j�|�|j�dd����}|�|�d�|��|�g�dd�}|�|j�|�|j�|�|j�|���}|�|�d�|��|�dS)Ncs ��d����fdd�}|S)NZmakedeccs��d��|S)NZcalldec��appendr)�actions�tagr	r
r�szHTestDecorators.test_eval_order.<locals>.make_decorator.<locals>.decoraterp)rsr)rr)rsr
�make_decorator�sz6TestDecorators.test_eval_order.<locals>.make_decoratorcs"eZdZdd�Z��fdd�ZdS)z8TestDecorators.test_eval_order.<locals>.NameLookupTracercSs
||_dSr)�index)rrur	r	r
r�szATestDecorators.test_eval_order.<locals>.NameLookupTracer.__init__csF|dkrd�}}n|dkr.dt|j�}}n��d||jf�|S)NrtZevalname�argZevalargsz%s%d)�strrurq)rZfname�opnamer.�rrrtr	r
�__getattr__�szDTestDecorators.test_eval_order.<locals>.NameLookupTracer.__getattr__N)rrrrrzr	ryr	r
�NameLookupTracer�sr{r$rErQZ	evalname1Z	evalargs1Zmakedec1Z	evalname2Z	evalargs2Zmakedec2Z	evalname3Z	evalargs3Zmakedec3Zcalldec3Zcalldec2Zcalldec1cSsdSr2r	r	r	r	r
r4�sz+TestDecorators.test_eval_order.<locals>.foor3cSsdSr2r	r	r	r	r
�barrlz+TestDecorators.test_eval_order.<locals>.bar)r6�maprtrvr7)rr{�c1�c2Zc3Zexpected_actionsr4r|r	ryr
�test_eval_order�s6�


(zTestDecorators.test_eval_orderN)
rrrr9r>r?rMrRrWrcrhror�r	r	r	r
r1Fs
r1c@s$eZdZdd�Zdd�Zdd�ZdS)�TestClassDecoratorscCs.dd�}|Gdd�dt��}|�|jd�dS)NcSs
d|_|S)N�Hello��extrar:r	r	r
�plainsz.TestClassDecorators.test_simple.<locals>.plainc@seZdZdS)z*TestClassDecorators.test_simple.<locals>.CN�rrrr	r	r	r
r5sr5r��r6r7r�)rr�r5r	r	r
�test_simpleszTestClassDecorators.test_simplecCs:dd�}dd�}||Gdd�dt���}|�|jd�dS)NcSs
d|_|S)NrVr�r:r	r	r
�tensz,TestClassDecorators.test_double.<locals>.tencSs|jd7_|S)N�r�r:r	r	r
�add_fivesz1TestClassDecorators.test_double.<locals>.add_fivec@seZdZdS)z*TestClassDecorators.test_double.<locals>.CNr�r	r	r	r
r5sr5�r�)rr�r�r5r	r	r
rhszTestClassDecorators.test_doublecCs:dd�}dd�}||Gdd�dt���}|�|jd�dS)NcSs
d|_|S)N�firstr�r:r	r	r
�
applied_first$sz5TestClassDecorators.test_order.<locals>.applied_firstcSs
d|_|S)N�secondr�r:r	r	r
�applied_second'sz6TestClassDecorators.test_order.<locals>.applied_secondc@seZdZdS)z)TestClassDecorators.test_order.<locals>.CNr�r	r	r	r
r5*sr5r�r�)rr�r�r5r	r	r
ro#szTestClassDecorators.test_orderN)rrrr�rhror	r	r	r
r�s
r��__main__)NN)Zunittestrr6r
rrr#r+r0ZTestCaser1r�r�mainr	r	r	r
�<module>s


G#