Server : LiteSpeed
System : Linux server51.dnsbootclub.com 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
User : nandedex ( 1060)
PHP Version : 8.1.33
Disable Function : NONE
Directory :  /opt/cppython/lib/python3.8/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]


Current File : //opt/cppython/lib/python3.8/test/__pycache__/test_sys_setprofile.cpython-38.pyc
U

>��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	�7/opt/cppython/lib/python3.8/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.callbackNcCsh|dkrt�d�}z|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)rr rZframenor	r	r
r#s

zHookWatcher.add_eventcs.t|jj�tt�g�d|_�fdd�|jD�S)zRemove calls to add_event().Ncsg|]}|d�kr|�qS)�r	)�.0�item�Z
disallowedr	r
�
<listcomp>5sz*HookWatcher.get_events.<locals>.<listcomp>)r)r�__func__rrrr	r-r
�
get_events0szHookWatcher.get_events)N)rrrrr"rr0r	r	r	r
rs

rc@sNeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zeeeeeed
�Z	dS)�ProfileSimulatorcCs||_g|_t�|�dSr)�testcase�stackrr)rr2r	r	r
r9szProfileSimulator.__init__cCs|j|||�dSr)�dispatchrr	r	r
r">szProfileSimulator.callbackcCs|�d|�|j�|�dS)Nr)rr3r(�rrr	r	r
�
trace_callBszProfileSimulator.trace_callcCs|�d|�|j��dS)Nr)rr3�popr5r	r	r
�trace_returnFszProfileSimulator.trace_returncCs|j�d�dS)Nz2the profiler should never receive exception events)r2�failr5r	r	r
�trace_exceptionJs�z ProfileSimulator.trace_exceptioncCsdSrr	r5r	r	r
�
trace_passNszProfileSimulator.trace_pass)rrrZc_callZc_returnZc_exceptionN)
rrrrr"r6r8r:r;r4r	r	r	r
r18s�r1c@seZdZdd�ZdS)�TestCaseBasecCs8t||���}||kr4|�dt�|�t�|�f�dS)Nz'Expected events:
%s
Received events:
%s)�capture_events�new_watcherr9�pprintZpformat)r�callableZexpectedrr	r	r
�check_events\s
�zTestCaseBase.check_eventsN)rrrrAr	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)rA�rrE�f_identr	r	r
�test_simplegs
�zProfileHookTestCase.test_simplecCs0dd�}t|�}|�|dd|fdd|fg�dS)NcSsdddS�Nr#rr	rCr	r	r
rEpsz-ProfileHookTestCase.test_exception.<locals>.fr#rrrFrGr	r	r
�test_exceptionos
�z"ProfileHookTestCase.test_exceptioncCs0dd�}t|�}|�|dd|fdd|fg�dS)NcSszddWnYnXdSrJr	rCr	r	r
rExsz4ProfileHookTestCase.test_caught_exception.<locals>.fr#rrrFrGr	r	r
�test_caught_exceptionws
�z)ProfileHookTestCase.test_caught_exceptioncCs0dd�}t|�}|�|dd|fdd|fg�dS)NcSszddWnYnXdSrJr	rCr	r	r
rE�sz;ProfileHookTestCase.test_caught_nested_exception.<locals>.fr#rrrFrGr	r	r
�test_caught_nested_exception�s
�z0ProfileHookTestCase.test_caught_nested_exceptioncCs0dd�}t|�}|�|dd|fdd|fg�dS)NcSsdddSrJr	rCr	r	r
rE�sz4ProfileHookTestCase.test_nested_exception.<locals>.fr#rrrFrGr	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dddSrJr	rCr	r	r
rE�sz>ProfileHookTestCase.test_exception_in_except_clause.<locals>.fc	s8z�|�Wn&z�|�WnYnXYnXdSrr	rC�rEr	r
�g�sz>ProfileHookTestCase.test_exception_in_except_clause.<locals>.gr#rr*r�rF�rrPrH�g_identr	rOr
�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dddSrJr	rCr	r	r
rE�sz9ProfileHookTestCase.test_exception_propagation.<locals>.fc	sz�|�W5|�d�XdS)N�falling throughrrCrOr	r
rP�sz9ProfileHookTestCase.test_exception_propagation.<locals>.gr#rr*rrUrFrRr	rOr
�test_exception_propagation�s�z.ProfileHookTestCase.test_exception_propagationcCs0dd�}t|�}|�|dd|fdd|fg�dS)NcSs&zddWnddYnXdSrJr	rCr	r	r
rE�sz/ProfileHookTestCase.test_raise_twice.<locals>.fr#rrrFrGr	r	r
�test_raise_twice�s
�z$ProfileHookTestCase.test_raise_twicecCs0dd�}t|�}|�|dd|fdd|fg�dS)NcSs zddWn�YnXdSrJr	rCr	r	r
rE�sz1ProfileHookTestCase.test_raise_reraise.<locals>.fr#rrrFrGr	r	r
�test_raise_reraise�s
�z&ProfileHookTestCase.test_raise_reraisecCs0dd�}t|�}|�|dd|fdd|fg�dS)NcSs
t��dSr)�	ExceptionrCr	r	r
rE�sz)ProfileHookTestCase.test_raise.<locals>.fr#rrrFrGr	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dddSrJr	r	r	r	r
rE�sz5ProfileHookTestCase.test_distant_exception.<locals>.fcs
��dSrr	r	rOr	r
rP�sz5ProfileHookTestCase.test_distant_exception.<locals>.gcs
��dSrr	r	�rPr	r
�h�sz5ProfileHookTestCase.test_distant_exception.<locals>.hcs
��dSrr	r	�r\r	r
�i�sz5ProfileHookTestCase.test_distant_exception.<locals>.ics
��dSrr	rC�r^r	r
�j�sz5ProfileHookTestCase.test_distant_exception.<locals>.jr#rr*rQ��rrF�rr`rHrSZh_identZi_identZj_identr	�rErPr\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
rE�sz-ProfileHookTestCase.test_generator.<locals>.fcs��D]}qdSrr	�rDr^rOr	r
rP�s
z-ProfileHookTestCase.test_generator.<locals>.gr#rr*rrFrRr	rOr
�test_generator�s�z"ProfileHookTestCase.test_generatorc
stdd���fdd�}t��}t|�}|�|dd|fdd|fdd|fdd|fdd|fdd|fdd|fdd|fg�dS)	Ncsstd�D]
}|VqdSrfrgr_r	r	r
rEsz2ProfileHookTestCase.test_stop_iteration.<locals>.fcs��D]}qdSrr	rirOr	r
rPs
z2ProfileHookTestCase.test_stop_iteration.<locals>.gr#rr*rrFrRr	rOr
�test_stop_iterations�z'ProfileHookTestCase.test_stop_iterationN)rrrr>rIrKrLrMrNrTrVrWrXrZrerjrkr	r	r	r
rBcs				rBc@s\eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�ZdS)�ProfileSimulatorTestCasecCst|�Sr)r1rr	r	r
r>sz$ProfileSimulatorTestCase.new_watchercCs0dd�}t|�}|�|dd|fdd|fg�dS)NcSsdSrr	rCr	r	r
rEsz/ProfileSimulatorTestCase.test_simple.<locals>.fr#rrrFrGr	r	r
rIs
�z$ProfileSimulatorTestCase.test_simplecCs0dd�}t|�}|�|dd|fdd|fg�dS)NcSsdddSrJr	rCr	r	r
rE%sz8ProfileSimulatorTestCase.test_basic_exception.<locals>.fr#rrrFrGr	r	r
�test_basic_exception$s
�z-ProfileSimulatorTestCase.test_basic_exceptioncCs0dd�}t|�}|�|dd|fdd|fg�dS)NcSszddWnYnXdSrJr	rCr	r	r
rE-sz9ProfileSimulatorTestCase.test_caught_exception.<locals>.fr#rrrFrGr	r	r
rL,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dddSrJr	r	r	r	r
rE6sz:ProfileSimulatorTestCase.test_distant_exception.<locals>.fcs
��dSrr	r	rOr	r
rP8sz: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	rCr_r	r
r`>sz:ProfileSimulatorTestCase.test_distant_exception.<locals>.jr#rr*rQrarbrrFrcr	rdr
re5s*�z/ProfileSimulatorTestCase.test_distant_exceptioncs8i��fdd�}t|�}|�|dd|fdd|fg�dS)Ncstjidf��dS�N�*��dict�getrC��kwargsr	r
rETsz7ProfileSimulatorTestCase.test_unbound_method.<locals>.fr#rrrFrGr	rsr
�test_unbound_methodRs�z,ProfileSimulatorTestCase.test_unbound_methodcCs0dd�}t|�}|�|dd|fdd|fg�dS)NcSst��dSrrprCr	r	r
rE\sz?ProfileSimulatorTestCase.test_unbound_method_no_args.<locals>.fr#rrrFrGr	r	r
�test_unbound_method_no_args[s
�z4ProfileSimulatorTestCase.test_unbound_method_no_argscCs0dd�}t|�}|�|dd|fdd|fg�dS)NcSst�td�dSrn�rqrr�printrCr	r	r
rEdszDProfileSimulatorTestCase.test_unbound_method_invalid_args.<locals>.fr#rrrFrGr	r	r
� test_unbound_method_invalid_argscs
�z9ProfileSimulatorTestCase.test_unbound_method_invalid_argscs8i��fdd�}t|�}|�|dd|fdd|fg�dS)Ncstjf��dSrrprCrsr	r
rEmszGProfileSimulatorTestCase.test_unbound_method_no_keyword_args.<locals>.fr#rrrFrGr	rsr
�#test_unbound_method_no_keyword_argsks�z<ProfileSimulatorTestCase.test_unbound_method_no_keyword_argscs8i��fdd�}t|�}|�|dd|fdd|fg�dS)Ncstjtdf��dSrnrwrCrsr	r
rEvszLProfileSimulatorTestCase.test_unbound_method_invalid_keyword_args.<locals>.fr#rrrFrGr	rsr
�(test_unbound_method_invalid_keyword_argsts�zAProfileSimulatorTestCase.test_unbound_method_invalid_keyword_argsN)
rrrr>rIrmrLrerurvryrzr{r	r	r	r
rls			rlcCs$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YnXdSrr	)rErDr	r	r
�protect�sr�cCsb|dkrt�}t��}t��z$t�|j�t||�t�d�W5|rPt��X|�	�dd�S)Nr#���)
r�gc�	isenabled�disable�enablerrr"r�r0)r@rDZold_gcr	r	r
r=�s

r=cCsddl}|�t|��dS)Nr)r?r=)r@r?r	r	r
�show_events�sr��__main__)N)r�r?rZunittestZTestCaserrr1r<rBrlr)r�Z
protect_identr=r�r�mainr	r	r	r
�<module>s" #6e


F1le Man4ger