Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.9/test/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.9/test/__pycache__/test_sys_setprofile.cpython-39.pyc

a

��g=1�@s�ddlZddlZddlZddlZGdd�dej�ZGdd�d�ZGdd�de�ZGdd	�d	ej�ZGd
d�de�Z	Gdd
�d
e�Z
dd�Zdd�Zee�Z
ddd�Zdd�Zedkr�e��dS)�Nc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�TestGetProfilecCst�d�dS�N��sys�
setprofile��self�r	�4/usr/local/lib/python3.9/test/test_sys_setprofile.py�setUpszTestGetProfile.setUpcCst�d�dSrrrr	r	r
�tearDownszTestGetProfile.tearDowncCs|�t���dSr)ZassertIsNoner�
getprofilerr	r	r
�
test_emptyszTestGetProfile.test_emptycCs&dd�}t�|�|�t��|�dS)NcWsdSrr	)�argsr	r	r
�fnsz&TestGetProfile.test_setget.<locals>.fn)rrZassertIsr
)rrr	r	r
�test_setgets
zTestGetProfile.test_setgetN)�__name__�
__module__�__qualname__rrrrr	r	r	r
rsrc@s.eZdZdd�Zdd�Zd
dd�Zdd	�ZdS)�HookWatchercCsg|_g|_dSr)�frames�eventsrr	r	r
�__init__szHookWatcher.__init__cCs(|dks|dks|dkr$|�||�dS)N�call�return�	exception��	add_event�r�frame�event�argr	r	r
�callbacks��zHookWatcher.callbackNcCsf|durt�d�}z|j�|�}Wn(tyJt|j�}|j�|�Yn0|j�||t|�f�dS)zAdd an event to the log.N�)	r�	_getframer�index�
ValueError�len�appendr�ident)rr rZframenor	r	r
r#s

zHookWatcher.add_eventcs.t|jj�tt�g�d|_�fdd�|jD�S)zRemove calls to add_event().Ncsg|]}|d�vr|�qS)�r	)�.0�item�Z
disallowedr	r
�
<listcomp>5�z*HookWatcher.get_events.<locals>.<listcomp>)r)r�__func__rrrr	r-r
�
get_events0szHookWatcher.get_events)N)rrrrr"rr1r	r	r	r
rs

rc@sNeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zeeeeeed
�Z	dS)�ProfileSimulatorcCs||_g|_t�|�dSr)�testcase�stackrr)rr3r	r	r
r9szProfileSimulator.__init__cCs|j|||�dSr)�dispatchrr	r	r
r">szProfileSimulator.callbackcCs|�d|�|j�|�dS)Nr)rr4r(�rrr	r	r
�
trace_callBszProfileSimulator.trace_callcCs|�d|�|j��dS)Nr)rr4�popr6r	r	r
�trace_returnFszProfileSimulator.trace_returncCs|j�d�dS)Nz2the profiler should never receive exception events)r3�failr6r	r	r
�trace_exceptionJs�z ProfileSimulator.trace_exceptioncCsdSrr	r6r	r	r
�
trace_passNszProfileSimulator.trace_pass)rrrZc_callZc_returnZc_exceptionN)
rrrrr"r7r9r;r<r5r	r	r	r
r28s�r2c@seZdZdd�ZdS)�TestCaseBasecCs8t||���}||kr4|�dt�|�t�|�f�dS)Nz'Expected events:
%s
Received events:
%s)�capture_events�new_watcherr:�pprintZpformat)r�callableZexpectedrr	r	r
�check_events\s
�zTestCaseBase.check_eventsN)rrrrBr	r	r	r
r=[sr=c@s|eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)�ProfileHookTestCasecCst�Sr)rrr	r	r
r?dszProfileHookTestCase.new_watchercCs0dd�}t|�}|�|dd|fdd|fg�dS)NcSsdSrr	��pr	r	r
�fhsz*ProfileHookTestCase.test_simple.<locals>.fr#rr�r)rB�rrF�f_identr	r	r
�test_simplegs
�zProfileHookTestCase.test_simplecCs0dd�}t|�}|�|dd|fdd|fg�dS)NcSsdddS�Nr#rr	rDr	r	r
rFpsz-ProfileHookTestCase.test_exception.<locals>.fr#rrrGrHr	r	r
�test_exceptionos
�z"ProfileHookTestCase.test_exceptioncCs0dd�}t|�}|�|dd|fdd|fg�dS)NcSszddWnYn0dSrKr	rDr	r	r
rFxsz4ProfileHookTestCase.test_caught_exception.<locals>.fr#rrrGrHr	r	r
�test_caught_exceptionws
�z)ProfileHookTestCase.test_caught_exceptioncCs0dd�}t|�}|�|dd|fdd|fg�dS)NcSszddWnYn0dSrKr	rDr	r	r
rF�sz;ProfileHookTestCase.test_caught_nested_exception.<locals>.fr#rrrGrHr	r	r
�test_caught_nested_exception�s
�z0ProfileHookTestCase.test_caught_nested_exceptioncCs0dd�}t|�}|�|dd|fdd|fg�dS)NcSsdddSrKr	rDr	r	r
rF�sz4ProfileHookTestCase.test_nested_exception.<locals>.fr#rrrGrHr	r	r
�test_nested_exception�s
�z)ProfileHookTestCase.test_nested_exceptioncsddd���fdd�}t��}t|�}|�|dd|fdd|fdd|fd	d|fd	d|fdd|fg�dS)
NcSsdddSrKr	rDr	r	r
rF�sz>ProfileHookTestCase.test_exception_in_except_clause.<locals>.fc	s8z�|�Wn&z�|�WnYn0Yn0dSrr	rD�rFr	r
�g�s
z>ProfileHookTestCase.test_exception_in_except_clause.<locals>.gr#rr*r�rG�rrQrI�g_identr	rPr
�test_exception_in_except_clause�s�z3ProfileHookTestCase.test_exception_in_except_clausec
s\dd���fdd�}t��}t|�}|�|dd|fdd|fdd|fdd	|fdd|fg�dS)
NcSsdddSrKr	rDr	r	r
rF�sz9ProfileHookTestCase.test_exception_propagation.<locals>.fc	s(z�|�W|�d�n|�d�0dS)N�falling throughrrDrPr	r
rQ�sz9ProfileHookTestCase.test_exception_propagation.<locals>.gr#rr*rrVrGrSr	rPr
�test_exception_propagation�s�z.ProfileHookTestCase.test_exception_propagationcCs0dd�}t|�}|�|dd|fdd|fg�dS)NcSs&zddWnddYn0dSrKr	rDr	r	r
rF�sz/ProfileHookTestCase.test_raise_twice.<locals>.fr#rrrGrHr	r	r
�test_raise_twice�s
�z$ProfileHookTestCase.test_raise_twicecCs0dd�}t|�}|�|dd|fdd|fg�dS)NcSs zddWn�Yn0dSrKr	rDr	r	r
rF�sz1ProfileHookTestCase.test_raise_reraise.<locals>.fr#rrrGrHr	r	r
�test_raise_reraise�s
�z&ProfileHookTestCase.test_raise_reraisecCs0dd�}t|�}|�|dd|fdd|fg�dS)NcSs
t��dSr)�	ExceptionrDr	r	r
rF�sz)ProfileHookTestCase.test_raise.<locals>.fr#rrrGrHr	r	r
�
test_raise�s
�zProfileHookTestCase.test_raisecs�dd���fdd���fdd���fdd���fd	d
�}t��}t��}t��}t��}t|�}|�|dd|fd
d|fdd|fdd|fdd|fdd|fdd|fdd|fd
d|fdd|fg
�dS)NcSsdddSrKr	r	r	r	r
rF�sz5ProfileHookTestCase.test_distant_exception.<locals>.fcs
��dSrr	r	rPr	r
rQ�sz5ProfileHookTestCase.test_distant_exception.<locals>.gcs
��dSrr	r	�rQr	r
�h�sz5ProfileHookTestCase.test_distant_exception.<locals>.hcs
��dSrr	r	�r]r	r
�i�sz5ProfileHookTestCase.test_distant_exception.<locals>.ics
��dSrr	rD�r_r	r
�j�sz5ProfileHookTestCase.test_distant_exception.<locals>.jr#rr*rR��rrG�rrarIrTZh_identZi_identZj_identr	�rFrQr]r_r
�test_distant_exception�s*�z*ProfileHookTestCase.test_distant_exceptionc
stdd���fdd�}t��}t|�}|�|dd|fdd|fdd|fdd|fdd|fdd|fdd|fdd|fg�dS)	Ncsstd�D]
}|VqdS�Nr*��ranger`r	r	r
rF�sz-ProfileHookTestCase.test_generator.<locals>.fcs��D]}qdSrr	�rEr_rPr	r
rQ�s
z-ProfileHookTestCase.test_generator.<locals>.gr#rr*rrGrSr	rPr
�test_generator�s�z"ProfileHookTestCase.test_generatorc
stdd���fdd�}t��}t|�}|�|dd|fdd|fdd|fdd|fdd|fdd|fdd|fdd|fg�dS)	Ncsstd�D]
}|VqdSrgrhr`r	r	r
rFsz2ProfileHookTestCase.test_stop_iteration.<locals>.fcs��D]}qdSrr	rjrPr	r
rQs
z2ProfileHookTestCase.test_stop_iteration.<locals>.gr#rr*rrGrSr	rPr
�test_stop_iterations�z'ProfileHookTestCase.test_stop_iterationN)rrrr?rJrLrMrNrOrUrWrXrYr[rfrkrlr	r	r	r
rCcs				rCc@s\eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�ZdS)�ProfileSimulatorTestCasecCst|�Sr)r2rr	r	r
r?sz$ProfileSimulatorTestCase.new_watchercCs0dd�}t|�}|�|dd|fdd|fg�dS)NcSsdSrr	rDr	r	r
rFsz/ProfileSimulatorTestCase.test_simple.<locals>.fr#rrrGrHr	r	r
rJs
�z$ProfileSimulatorTestCase.test_simplecCs0dd�}t|�}|�|dd|fdd|fg�dS)NcSsdddSrKr	rDr	r	r
rF%sz8ProfileSimulatorTestCase.test_basic_exception.<locals>.fr#rrrGrHr	r	r
�test_basic_exception$s
�z-ProfileSimulatorTestCase.test_basic_exceptioncCs0dd�}t|�}|�|dd|fdd|fg�dS)NcSszddWnYn0dSrKr	rDr	r	r
rF-sz9ProfileSimulatorTestCase.test_caught_exception.<locals>.fr#rrrGrHr	r	r
rM,s
�z.ProfileSimulatorTestCase.test_caught_exceptioncs�dd���fdd���fdd���fdd���fd	d
�}t��}t��}t��}t��}t|�}|�|dd|fd
d|fdd|fdd|fdd|fdd|fdd|fdd|fd
d|fdd|fg
�dS)NcSsdddSrKr	r	r	r	r
rF6sz:ProfileSimulatorTestCase.test_distant_exception.<locals>.fcs
��dSrr	r	rPr	r
rQ8sz:ProfileSimulatorTestCase.test_distant_exception.<locals>.gcs
��dSrr	r	r\r	r
r]:sz:ProfileSimulatorTestCase.test_distant_exception.<locals>.hcs
��dSrr	r	r^r	r
r_<sz:ProfileSimulatorTestCase.test_distant_exception.<locals>.ics
��dSrr	rDr`r	r
ra>sz:ProfileSimulatorTestCase.test_distant_exception.<locals>.jr#rr*rRrbrcrrGrdr	rer
rf5s*�z/ProfileSimulatorTestCase.test_distant_exceptioncs8i��fdd�}t|�}|�|dd|fdd|fg�dS)Ncstjidfi���dS�N�*��dict�getrD��kwargsr	r
rFTsz7ProfileSimulatorTestCase.test_unbound_method.<locals>.fr#rrrGrHr	rtr
�test_unbound_methodRs�z,ProfileSimulatorTestCase.test_unbound_methodcCs0dd�}t|�}|�|dd|fdd|fg�dS)NcSst��dSrrqrDr	r	r
rF\sz?ProfileSimulatorTestCase.test_unbound_method_no_args.<locals>.fr#rrrGrHr	r	r
�test_unbound_method_no_args[s
�z4ProfileSimulatorTestCase.test_unbound_method_no_argscCs0dd�}t|�}|�|dd|fdd|fg�dS)NcSst�td�dSro�rrrs�printrDr	r	r
rFdszDProfileSimulatorTestCase.test_unbound_method_invalid_args.<locals>.fr#rrrGrHr	r	r
� test_unbound_method_invalid_argscs
�z9ProfileSimulatorTestCase.test_unbound_method_invalid_argscs8i��fdd�}t|�}|�|dd|fdd|fg�dS)Ncstjfi���dSrrqrDrtr	r
rFmszGProfileSimulatorTestCase.test_unbound_method_no_keyword_args.<locals>.fr#rrrGrHr	rtr
�#test_unbound_method_no_keyword_argsks�z<ProfileSimulatorTestCase.test_unbound_method_no_keyword_argscs8i��fdd�}t|�}|�|dd|fdd|fg�dS)Ncstjtdfi���dSrorxrDrtr	r
rFvszLProfileSimulatorTestCase.test_unbound_method_invalid_keyword_args.<locals>.fr#rrrGrHr	rtr
�(test_unbound_method_invalid_keyword_argsts�zAProfileSimulatorTestCase.test_unbound_method_invalid_keyword_argsN)
rrrr?rJrnrMrfrvrwrzr{r|r	r	r	r
rms			rmcCs$t|d�r|j}n|j}|j|jfS)N�f_code)�hasattrr}�__code__�co_firstlineno�co_name)�function�coder	r	r
r)}s
r)cCsz||�WnYn0dSrr	)rFrEr	r	r
�protect�sr�cCsn|durt�}t��}t��z0t�|j�t||�t�d�W|r^t��n|r\t��0|�	�dd�S)Nr#���)
r�gc�	isenabled�disablerrr"r��enabler1)rArEZold_gcr	r	r
r>�s

�
r>cCsddl}|�t|��dS)Nr)r@r>)rAr@r	r	r
�show_events�sr��__main__)N)r�r@rZunittestZTestCaserrr2r=rCrmr)r�Z
protect_identr>r�r�mainr	r	r	r
�<module>s" #6e


Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists