HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.7/test/__pycache__/test_sys_setprofile.cpython-37.opt-1.pyc
B

��g�-�@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.7/test/test_sys_setprofile.py�setUpszTestGetProfile.setUpcCst�d�dS)N)rr)rrrr�tearDownszTestGetProfile.tearDowncCs|�t���dS)N)ZassertIsNoner�
getprofile)rrrr�
test_emptyszTestGetProfile.test_emptycCs&dd�}t�|�|�t��|�dS)NcWsdS)Nr)�argsrrr�fnsz&TestGetProfile.test_setget.<locals>.fn)rrZassertIsr
)rr
rrr�test_setgets
zTestGetProfile.test_setgetN)�__name__�
__module__�__qualname__rr	rrrrrrrsrc@s.eZdZdd�Zdd�Zd
dd�Zdd	�ZdS)�HookWatchercCsg|_g|_dS)N)�frames�events)rrrr�__init__szHookWatcher.__init__cCs(|dks|dks|dkr$|�||�dS)N�call�return�	exception)�	add_event)r�frame�event�argrrr�callbackszHookWatcher.callbackNcCsh|dkrt�d�}y|j�|�}Wn*tk
rLt|j�}|j�|�YnX|j�||t|�f�dS)zAdd an event to the log.N�)	r�	_getframer�index�
ValueError�len�appendr�ident)rrrZframenorrrr#s

zHookWatcher.add_eventcs.t|jj�tt�g�d|_�fdd�|jD�S)zRemove calls to add_event().Ncsg|]}|d�kr|�qS)�r)�.0�item)�
disallowedrr�
<listcomp>5sz*HookWatcher.get_events.<locals>.<listcomp>)r$r�__func__rr)rr)r(r�
get_events0szHookWatcher.get_events)N)rrrrrrr+rrrrrs

rc@sNeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zeeeeeed
�Z	dS)�ProfileSimulatorcCs||_g|_t�|�dS)N)�testcase�stackrr)rr-rrrr9szProfileSimulator.__init__cCs|j|||�dS)N)�dispatch)rrrrrrrr>szProfileSimulator.callbackcCs|�d|�|j�|�dS)Nr)rr.r#)rrrrr�
trace_callBszProfileSimulator.trace_callcCs|�d|�|j��dS)Nr)rr.�pop)rrrrr�trace_returnFszProfileSimulator.trace_returncCs|j�d�dS)Nz2the profiler should never receive exception events)r-�fail)rrrrr�trace_exceptionJsz ProfileSimulator.trace_exceptioncCsdS)Nr)rrrrr�
trace_passNszProfileSimulator.trace_pass)rrrZc_callZc_returnZc_exceptionN)
rrrrrr0r2r4r5r/rrrrr,8sr,c@seZdZdd�ZdS)�TestCaseBasecCs8t||���}||kr4|�dt�|�t�|�f�dS)Nz'Expected events:
%s
Received events:
%s)�capture_events�new_watcherr3�pprintZpformat)r�callableZexpectedrrrr�check_events\szTestCaseBase.check_eventsN)rrrr;rrrrr6[sr6c@s|eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)�ProfileHookTestCasecCst�S)N)r)rrrrr8dszProfileHookTestCase.new_watchercCs0dd�}t|�}|�|dd|fdd|fg�dS)NcSsdS)Nr)�prrr�fhsz*ProfileHookTestCase.test_simple.<locals>.frrr)r$r;)rr>�f_identrrr�test_simplegszProfileHookTestCase.test_simplecCs0dd�}t|�}|�|dd|fdd|fg�dS)NcSsdddS)Nrrr)r=rrrr>psz-ProfileHookTestCase.test_exception.<locals>.frrr)r$r;)rr>r?rrr�test_exceptionosz"ProfileHookTestCase.test_exceptioncCs0dd�}t|�}|�|dd|fdd|fg�dS)NcSsyddWnYnXdS)Nrrr)r=rrrr>xsz4ProfileHookTestCase.test_caught_exception.<locals>.frrr)r$r;)rr>r?rrr�test_caught_exceptionwsz)ProfileHookTestCase.test_caught_exceptioncCs0dd�}t|�}|�|dd|fdd|fg�dS)NcSsyddWnYnXdS)Nrrr)r=rrrr>�sz;ProfileHookTestCase.test_caught_nested_exception.<locals>.frrr)r$r;)rr>r?rrr�test_caught_nested_exception�sz0ProfileHookTestCase.test_caught_nested_exceptioncCs0dd�}t|�}|�|dd|fdd|fg�dS)NcSsdddS)Nrrr)r=rrrr>�sz4ProfileHookTestCase.test_nested_exception.<locals>.frrr)r$r;)rr>r?rrr�test_nested_exception�sz)ProfileHookTestCase.test_nested_exceptioncsddd���fdd�}t��}t|�}|�|dd|fdd|fdd|fd	d|fd	d|fdd|fg�dS)
NcSsdddS)Nrrr)r=rrrr>�sz>ProfileHookTestCase.test_exception_in_except_clause.<locals>.fc	s8y�|�Wn&y�|�WnYnXYnXdS)Nr)r=)r>rr�g�sz>ProfileHookTestCase.test_exception_in_except_clause.<locals>.grrr%r�)r$r;)rrEr?�g_identr)r>r�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dddS)Nrrr)r=rrrr>�sz9ProfileHookTestCase.test_exception_propagation.<locals>.fc	sz�|�Wd|�d�XdS)Nzfalling through)r)r=)r>rrrE�sz9ProfileHookTestCase.test_exception_propagation.<locals>.grrr%rzfalling through)r$r;)rrEr?rGr)r>r�test_exception_propagation�sz.ProfileHookTestCase.test_exception_propagationcCs0dd�}t|�}|�|dd|fdd|fg�dS)NcSs&yddWnddYnXdS)Nrrr)r=rrrr>�sz/ProfileHookTestCase.test_raise_twice.<locals>.frrr)r$r;)rr>r?rrr�test_raise_twice�sz$ProfileHookTestCase.test_raise_twicecCs0dd�}t|�}|�|dd|fdd|fg�dS)NcSs yddWn�YnXdS)Nrrr)r=rrrr>�sz1ProfileHookTestCase.test_raise_reraise.<locals>.frrr)r$r;)rr>r?rrr�test_raise_reraise�sz&ProfileHookTestCase.test_raise_reraisecCs0dd�}t|�}|�|dd|fdd|fg�dS)NcSs
t��dS)N)�	Exception)r=rrrr>�sz)ProfileHookTestCase.test_raise.<locals>.frrr)r$r;)rr>r?rrr�
test_raise�szProfileHookTestCase.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dddS)Nrrrrrrrr>�sz5ProfileHookTestCase.test_distant_exception.<locals>.fcs
��dS)Nrr)r>rrrE�sz5ProfileHookTestCase.test_distant_exception.<locals>.gcs
��dS)Nrr)rErr�h�sz5ProfileHookTestCase.test_distant_exception.<locals>.hcs
��dS)Nrr)rNrr�i�sz5ProfileHookTestCase.test_distant_exception.<locals>.ics
��dS)Nr)r=)rOrr�j�sz5ProfileHookTestCase.test_distant_exception.<locals>.jrrr%rF��r)r$r;)rrPr?rG�h_ident�i_ident�j_identr)r>rErNrOr�test_distant_exception�s(z*ProfileHookTestCase.test_distant_exceptionc
stdd���fdd�}t��}t|�}|�|dd|fdd|fdd|fdd|fdd|fdd|fdd|fdd|fg�dS)	Ncssxtd�D]
}|Vq
WdS)Nr%)�range)rOrrrr>�sz-ProfileHookTestCase.test_generator.<locals>.fcsx��D]}qWdS)Nr)r=rO)r>rrrE�sz-ProfileHookTestCase.test_generator.<locals>.grrr%r)r$r;)rrEr?rGr)r>r�test_generator�sz"ProfileHookTestCase.test_generatorc
stdd���fdd�}t��}t|�}|�|dd|fdd|fdd|fdd|fdd|fdd|fdd|fdd|fg�dS)	Ncssxtd�D]
}|Vq
WdS)Nr%)rW)rOrrrr>sz2ProfileHookTestCase.test_stop_iteration.<locals>.fcsx��D]}qWdS)Nr)r=rO)r>rrrEsz2ProfileHookTestCase.test_stop_iteration.<locals>.grrr%r)r$r;)rrEr?rGr)r>r�test_stop_iterationsz'ProfileHookTestCase.test_stop_iterationN)rrrr8r@rArBrCrDrHrIrJrKrMrVrXrYrrrrr<cs				r<c@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�ProfileSimulatorTestCasecCst|�S)N)r,)rrrrr8sz$ProfileSimulatorTestCase.new_watchercCs0dd�}t|�}|�|dd|fdd|fg�dS)NcSsdS)Nr)r=rrrr>sz/ProfileSimulatorTestCase.test_simple.<locals>.frrr)r$r;)rr>r?rrrr@sz$ProfileSimulatorTestCase.test_simplecCs0dd�}t|�}|�|dd|fdd|fg�dS)NcSsdddS)Nrrr)r=rrrr>%sz8ProfileSimulatorTestCase.test_basic_exception.<locals>.frrr)r$r;)rr>r?rrr�test_basic_exception$sz-ProfileSimulatorTestCase.test_basic_exceptioncCs0dd�}t|�}|�|dd|fdd|fg�dS)NcSsyddWnYnXdS)Nrrr)r=rrrr>-sz9ProfileSimulatorTestCase.test_caught_exception.<locals>.frrr)r$r;)rr>r?rrrrB,sz.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dddS)Nrrrrrrrr>6sz:ProfileSimulatorTestCase.test_distant_exception.<locals>.fcs
��dS)Nrr)r>rrrE8sz:ProfileSimulatorTestCase.test_distant_exception.<locals>.gcs
��dS)Nrr)rErrrN:sz:ProfileSimulatorTestCase.test_distant_exception.<locals>.hcs
��dS)Nrr)rNrrrO<sz:ProfileSimulatorTestCase.test_distant_exception.<locals>.ics
��dS)Nr)r=)rOrrrP>sz:ProfileSimulatorTestCase.test_distant_exception.<locals>.jrrr%rFrQrRr)r$r;)rrPr?rGrSrTrUr)r>rErNrOrrV5s(z/ProfileSimulatorTestCase.test_distant_exceptioncCs0dd�}t|�}|�|dd|fdd|fg�dS)NcSst��dS)N)�dict�get)r=rrrr>Ssz?ProfileSimulatorTestCase.test_unbound_method_no_args.<locals>.frrr)r$r;)rr>r?rrr�test_unbound_method_no_argsRsz4ProfileSimulatorTestCase.test_unbound_method_no_argscCs0dd�}t|�}|�|dd|fdd|fg�dS)NcSst�td�dS)N�*)r\r]�print)r=rrrr>[szDProfileSimulatorTestCase.test_unbound_method_invalid_args.<locals>.frrr)r$r;)rr>r?rrr� test_unbound_method_invalid_argsZsz9ProfileSimulatorTestCase.test_unbound_method_invalid_argsN)
rrrr8r@r[rBrVr^rarrrrrZs	rZcCs$t|d�r|j}n|j}|j|jfS)N�f_code)�hasattrrb�__code__�co_firstlineno�co_name)Zfunction�coderrrr$bs
r$cCsy||�WnYnXdS)Nr)r>r=rrr�protectjsrhcCsb|dkrt�}t��}t��z$t�|j�t||�t�d�Wd|rPt��X|�	�dd�S)Nr���)
r�gcZ	isenabledZdisablerrrrhZenabler+)r:r=Zold_gcrrrr7qs

r7cCsddl}|�t|��dS)Nr)r9r7)r:r9rrr�show_events�srk�__main__)N)rjr9rZunittestZTestCaserrr,r6r<rZr$rhZ
protect_identr7rkr�mainrrrr�<module>s" #6J