403Webshell
Server IP : 118.27.122.248  /  Your IP : 216.73.216.15
Web Server : Apache
System : Linux web0264.sh.tyo1 4.18.0-553.79.1.lve.el7h.x86_64 #1 SMP Wed Oct 15 16:34:46 UTC 2025 x86_64
User : c9415830 ( 11735)
PHP Version : 8.4.17
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python36/lib64/python3.6/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python36/lib64/python3.6/test/__pycache__/test_decorators.cpython-36.pyc
3

�w2_�%�@s�ddlZdd�ZGdd�de�ZGdd�de�Zddd	�Zd
d�Zdd
�ZGdd�dej	�Z
Gdd�dej	�Zedkr~ej
�dS)�Ncs�fdd�}|S)Ncs|jj��|S)N)�__dict__�update)�func)�kwds��9/opt/alt/python36/lib64/python3.6/test/test_decorators.py�decorateszfuncattrs.<locals>.decorater)rrr)rr�	funcattrssr	c@seZdZedd��ZdS)�MiscDecoratorscs�fdd�}|S)Ncs�|jd<|S)N�author)r)r)�namerrrs
z'MiscDecorators.author.<locals>.decorater)rrr)rrr
szMiscDecorators.authorN)�__name__�
__module__�__qualname__�staticmethodrrrrrr
	sr
c@seZdZdd�ZdS)�DbcheckErrorcCstj|d||||f�dS)Nz+dbcheck %r failed (func=%s args=%s kwds=%s))�	Exception�__init__)�self�exprstrr�argsrrrrrszDbcheckError.__init__N)r
rrrrrrrrsrcs���fdd�}|S)z+Decorator to implement debugging assertionscs*t�d�jd�������fdd�}|S)Nz
dbcheck-%s�evalcs$t����st��||���||�S)N)rr)rr)�exprrr�globals�localsrr�checksz(dbcheck.<locals>.decorate.<locals>.check)�compiler
)rr)rrr)rrrrszdbcheck.<locals>.decorater)rrrrr)rrrr�dbchecksrcs�fdd�}|S)z&Decorator to count calls to a functioncs(�j�d��<���fdd�}�|_|S)Nrcs��d7<�||�S)N�r)rr)�countsr�	func_namerr�call,sz*countcalls.<locals>.decorate.<locals>.call)r
)rr!)r)rr rr)s
zcountcalls.<locals>.decorater)rrr)rr�
countcalls'sr"csi���fdd�}�j|_|S)NcsHy�|Stk
r,�|�}|�|<|Stk
rB�|�SXdS)N)�KeyError�	TypeError)r�res)r�savedrrr!7szmemoize.<locals>.call)r
)rr!r)rr&r�memoize5s
r'c@s\eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�ZdS)�TestDecoratorscCs6Gdd�dt�}|j|j�d�|j|�j�d�dS)Nc@seZdZedd��ZdS)z%TestDecorators.test_single.<locals>.CcSsdS)N�*rrrrr�fooJsz)TestDecorators.test_single.<locals>.C.fooN)r
rrrr*rrrr�CIsr+r))�object�assertEqualr*)rr+rrr�test_singleHszTestDecorators.test_singlecCstdd��}|jt|d�dS)NcSs|S)Nr)�xrrr�
notamethodPsz=TestDecorators.test_staticmethod_function.<locals>.notamethodr)r�assertRaisesr$)rr0rrr�test_staticmethod_functionOsz)TestDecorators.test_staticmethod_functioncCs8t�}|jd�dd��}|j|�d�|j|jd�dS)NZCleesecSsdS)Nr)rrrrrr*Wsz'TestDecorators.test_dotted.<locals>.foor))r
rr-)rZ
decoratorsr*rrr�test_dottedUszTestDecorators.test_dottedcCs�dd�}d}tddd	�}|||�d
d��}|j|�d�|j|j||f�|d
dddd�dd��}|j|�d�|j|jdtddd�f�|dd�dd��}|j|jdif�dS)Ncs��fdd�}|S)Ncst|d��f�|S)N�dbval)�setattr)r)rrrrrasz@TestDecorators.test_argforms.<locals>.noteargs.<locals>.decorater)rrrr)rrr�noteargs`sz.TestDecorators.test_argforms.<locals>.noteargs�Now�is�the�timer�)ZoneZtwocSsdS)Nr)rrrrr�f1hsz(TestDecorators.test_argforms.<locals>.f1r)�terry�gilliamZidleZcleese)ZericZjohncSsdS)N�Trrrrr�f2msz(TestDecorators.test_argforms.<locals>.f2r?cSsdS)Nrrrrr�f3ssz(TestDecorators.test_argforms.<locals>.f3)r7r8r9r:)r=r>)rr;)�dictr-r4)rr6rrr<r@rArrr�
test_argforms\s
zTestDecorators.test_argformscCs6td�dd��}|j|dd�d�|jt|dd�dS)Nzargs[1] is not NonecSs||S)Nr)�a�brrr�fxsz&TestDecorators.test_dbcheck.<locals>.frr;�)rr-r1r)rrFrrr�test_dbcheckwszTestDecorators.test_dbcheckcCs�i}tt|�dd���}|j|jd�|j|tdd��|j|d�d�|j|dd�|j|d�d�|j|dd�|j|d	�d
�|j|dd�|j|dg�ddg�|j|dd	�|j|dg�ddg�|j|dd�dS)NcSs|dS)Nr;r)r/rrr�double�sz+TestDecorators.test_memoize.<locals>.doublerIr)rIr;�rrG��
)r'r"r-r
rB)rrrIrrr�test_memoize~szTestDecorators.test_memoizecCs�x2dD]*}t|dd�d|}|jtt|dd�qW|jttddd�d	d
�}td|d�}xLdtfd
tfdtfdtfgD],\}}d|}t|dd�}|j|t||�qxWdS)N�1+2�x[3]�(1, 2)Ztestexpr�execz@%s
def f(): passZtestz@f1 @f2
def f(): passcSst�dS)N)�NotImplementedError)rrrr�unimp�sz)TestDecorators.test_errors.<locals>.unimp)�nullvalrSZundefrTznullval.attrrSz$@%s
def f(): pass
assert f() is None)rNrOrP)	rr1�SyntaxErrorrB�	NameErrorr$�AttributeErrorrRr)rrZcodestrrS�context�exc�coderrr�test_errors�s

zTestDecorators.test_errorscCsVGdd�dt�}|j|�j�d�|j|jjd�|j|jjd�|j|jjd�dS)Nc@s*eZdZeddd�edd�dd���ZdS)	z%TestDecorators.test_double.<locals>.Cr�haha)�abc�xyzr))�boohcSsdS)Nr)r)rrrrr*�sz)TestDecorators.test_double.<locals>.C.fooN)r
rrr	r*rrrrr+�s
r+r)rr\)r,r-r*r]r^r_)rr+rrr�test_double�s
zTestDecorators.test_doublecCs4dd�}|d�|d�dd���}|j|�dd�dS)Ncs�fdd�}|S)z�Decorator factory that returns a decorator that replaces the
            passed-in function with one that returns the value of 'num'cs�fdd�S)Ncs�S)Nrr)�numrr�<lambda>�szJTestDecorators.test_order.<locals>.callnum.<locals>.deco.<locals>.<lambda>r)r)rarr�deco�sz8TestDecorators.test_order.<locals>.callnum.<locals>.decor)rarcr)rar�callnum�sz*TestDecorators.test_order.<locals>.callnumr;rcSsdS)Nr)rrrrrr*�sz&TestDecorators.test_order.<locals>.fooz,Application order of decorators is incorrect)r-)rrdr*rrr�
test_order�s

zTestDecorators.test_ordercs�g��fdd��G��fdd�dt�}t|dddg�\}}}dd	d
ddd
ddddddg}g�|j|j�|j|j�|j|j�dd����}|j|�d�|j�|�g�dd�}|j|j�|j|j�|j|j�|���}|j|�d�|j�|�dS)Ncs �jd����fdd�}|S)NZmakedeccs�jd��|S)NZcalldec)�append)r)�actions�tagrrr�szHTestDecorators.test_eval_order.<locals>.make_decorator.<locals>.decorate)rf)rhr)rg)rhr�make_decorator�sz6TestDecorators.test_eval_order.<locals>.make_decoratorcs"eZdZdd�Z��fdd�ZdS)z8TestDecorators.test_eval_order.<locals>.NameLookupTracercSs
||_dS)N)�index)rrjrrrr�szATestDecorators.test_eval_order.<locals>.NameLookupTracer.__init__csV|dkrd�}}n*|dkr.dt|j�}}nds>td|���jd||jf�|S)NriZevalname�argZevalargsFzUnknown attrname %sz%s%d)�strrj�AssertionErrorrf)rZfname�opnamer%)rgrirr�__getattr__�szDTestDecorators.test_eval_order.<locals>.NameLookupTracer.__getattr__N)r
rrrror)rgrirr�NameLookupTracer�srprr;rGZ	evalname1Z	evalargs1Zmakedec1Z	evalname2Z	evalargs2Zmakedec2Z	evalname3Z	evalargs3Zmakedec3Zcalldec3Zcalldec2Zcalldec1cSsdS)Nr)rrrrrr*�sz+TestDecorators.test_eval_order.<locals>.foor)cSsdS)Nr)rrrrr�barsz+TestDecorators.test_eval_order.<locals>.bar)r,�maprirkr-)rrpZc1Zc2Zc3Zexpected_actionsr*rqr)rgrir�test_eval_order�s&


(zTestDecorators.test_eval_orderN)
r
rrr.r2r3rCrHrMr[r`rersrrrrr(Fs
r(c@s$eZdZdd�Zdd�Zdd�ZdS)�TestClassDecoratorscCs.dd�}|Gdd�dt��}|j|jd�dS)NcSs
d|_|S)N�Hello)�extra)r/rrr�plainsz.TestClassDecorators.test_simple.<locals>.plainc@seZdZdS)z*TestClassDecorators.test_simple.<locals>.CN)r
rrrrrrr+sr+ru)r,r-rv)rrwr+rrr�test_simpleszTestClassDecorators.test_simplecCs:dd�}dd�}||Gdd�dt���}|j|jd�dS)NcSs
d|_|S)NrL)rv)r/rrr�tensz,TestClassDecorators.test_double.<locals>.tencSs|jd7_|S)N�)rv)r/rrr�add_fivesz1TestClassDecorators.test_double.<locals>.add_fivec@seZdZdS)z*TestClassDecorators.test_double.<locals>.CN)r
rrrrrrr+sr+�)r,r-rv)rryr{r+rrrr`s
zTestClassDecorators.test_doublecCs:dd�}dd�}||Gdd�dt���}|j|jd�dS)NcSs
d|_|S)N�first)rv)r/rrr�
applied_first$sz5TestClassDecorators.test_order.<locals>.applied_firstcSs
d|_|S)N�second)rv)r/rrr�applied_second'sz6TestClassDecorators.test_order.<locals>.applied_secondc@seZdZdS)z)TestClassDecorators.test_order.<locals>.CN)r
rrrrrrr+*sr+r)r,r-rv)rr~r�r+rrrre#s
zTestClassDecorators.test_orderN)r
rrrxr`rerrrrrts
rt�__main__)NN)Zunittestr	r,r
rrrr"r'ZTestCaser(rtr
�mainrrrr�<module>s


G#

Youez - 2016 - github.com/yon3zu
LinuXploit