python (3.11.7)

(root)/
lib/
python3.11/
test/
__pycache__/
test_sys_setprofile.cpython-311.opt-1.pyc

e4pddlZddlZddlZddlZddlmZGddejZGddZGddeZ	Gd	d
ejZ
Gdde
ZGd
de
ZdZ
dZe
eZddZdZGddejZedkrejdSdS)N)supportc&eZdZdZdZdZdZdS)TestGetProfilec.tjddSNsys
setprofileselfs L/BuggyBox/python/3.11.7/bootstrap/lib/python3.11/test/test_sys_setprofile.pysetUpzTestGetProfile.setUp	tc.tjddSrrrs r
tearDownzTestGetProfile.tearDownrrcR|tjdSr)assertIsNoner	
getprofilers r

test_emptyzTestGetProfile.test_emptys$#.**+++++rcd}tj||tj|dS)NcdSrargss r
fnz&TestGetProfile.test_setget.<locals>.fnDr)r	r
assertIsr)rrs  r
test_setgetzTestGetProfile.test_setgetsE				r

cn&&+++++rN)__name__
__module____qualname__rrrrrrr
rrsP,,,,,,,,rrc(eZdZdZdZddZdZdS)HookWatcherc"g|_g|_dSr)frameseventsrs r
__init__zHookWatcher.__init__srcZ|dks|dks|dkr|||dSdS)Ncallreturn	exception	add_eventrframeeventargs    r
callbackzHookWatcher.callbacksCVOO  ##NN5%((((($#rNc:|tjd}	|j|}n>#t$r1t|j}|j|YnwxYw|j||t|fdS)zAdd an event to the log.N)	r		_getframer&index
ValueErrorlenappendr'ident)rr1r0framenos    r
r.zHookWatcher.add_event$s=M!$$E	&k''..GG	&	&	&$+&&GKu%%%%%	&	
GUE%LL9:::::s38A.-A.ct|jjttgd|_fd|jDS)zRemove calls to add_event().Nc(g|]}|dv|S)r).0item
disalloweds  r

<listcomp>z*HookWatcher.get_events.<locals>.<listcomp>6s'JJJQz0I0I0I0I0Ir)r;r.__func__r&r')rrBs @r

get_eventszHookWatcher.get_events1sCDN344eEllC
JJJJJJJJrr)r r!r"r(r3r.rErrr
r$r$sZ)));;;;KKKKKrr$cDeZdZdZdZdZdZdZdZeeeeeedZ	dS)	ProfileSimulatorcV||_g|_t|dSr)testcasestackr$r()rrIs  r
r(zProfileSimulator.__init__:s* 

T"""""rc4|j|||dSr)dispatchr/s    r
r3zProfileSimulator.callback?s!
eT5)))))rcf|d||j|dS)Nr*)r.rJr:rr0s  r

trace_callzProfileSimulator.trace_callCs2vu%%%
%     rcd|d||jdS)Nr+)r.rJpoprNs  r
trace_returnzProfileSimulator.trace_returnGs.x'''
rc:|jddS)Nz2the profiler should never receive exception events)rIfailrNs  r
trace_exceptionz ProfileSimulator.trace_exceptionKs.
@	B	B	B	B	BrcdSrrrNs  r

trace_passzProfileSimulator.trace_passOsr)r*r,r+c_callc_returnc_exceptionN)
r r!r"r(r3rOrRrUrWrLrrr
rGrG9s###
***!!!BBB


$!


HHHrrGceZdZdZdS)TestCaseBasect||}||krA|dtj|dtj|dSdS)NzExpected events:
z
Received events:
)capture_eventsnew_watcherrTpprintpformat)rcallableexpectedr's    r
check_eventszTestCaseBase.check_events]s$*:*:*<*<==XIII11116>&3I3I3IK
L
L
L
L
LrN)r r!r"rdrrr
r\r\\s(LLLLLrr\cbeZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdS)ProfileHookTestCasectSr)r$rs r
r_zProfileHookTestCase.new_watcheres}}rcfd}t|}||dd|fdd|fgdS)NcdSrrps r
fz*ProfileHookTestCase.test_simple.<locals>.firrr5r*r+r;rdrrlf_idents   r
test_simplezProfileHookTestCase.test_simplehX			((!q&'2 (G4 	!	!	!	!	!rcfd}t|}||dd|fdd|fgdS)NcddzdSNr5rrrjs r
rlz-ProfileHookTestCase.test_exception.<locals>.fq
aCCCCrr5r*r+rmrns   r
test_exceptionz"ProfileHookTestCase.test_exceptionpX			((!q&'2 (G4 	!	!	!	!	!rcfd}t|}||dd|fdd|fgdS)Nc ddzdS#YdSxYwrtrrjs r
rlz4ProfileHookTestCase.test_caught_exception.<locals>.fy1DDD
r5r*r+rmrns   r
test_caught_exceptionz)ProfileHookTestCase.test_caught_exceptionxZ			((!q&'2 (G4 	!	!	!	!	!rcfd}t|}||dd|fdd|fgdS)Nc ddzdS#YdSxYwrtrrjs r
rlz;ProfileHookTestCase.test_caught_nested_exception.<locals>.frzr{r5r*r+rmrns   r
test_caught_nested_exceptionz0ProfileHookTestCase.test_caught_nested_exceptionr}rcfd}t|}||dd|fdd|fgdS)NcddzdSrtrrjs r
rlz4ProfileHookTestCase.test_nested_exception.<locals>.frurr5r*r+rmrns   r
test_nested_exceptionz)ProfileHookTestCase.test_nested_exceptionsZ			((!q&'2 !(G4	 	!	!	!	!	!rcdfd}t}t|}||dd|fdd|fdd|fdd|fdd|fdd|fgdS)NcddzdSrtrrjs r
rlz>ProfileHookTestCase.test_exception_in_except_clause.<locals>.frurcX	|dS#|YdS#YYdSxYwxYwrrrkrls r
gz>ProfileHookTestCase.test_exception_in_except_clause.<locals>.gsD
!
QqTTTTTTs) &))r5r*r?r+rmrrrog_identrls    @r
test_exception_in_except_clausez3ProfileHookTestCase.test_exception_in_except_clauses								((((!q&'2 &'2 (G4 &'2 (G4 (G4 	!	!	!	!	!rc
dfd}t}t|}||dd|fdd|fdd|fdd|fdd|fgdS)NcddzdSrtrrjs r
rlz9ProfileHookTestCase.test_exception_propagation.<locals>.frurc|||ddS#|dwxYw)Nfalling throughr-rs r
rz9ProfileHookTestCase.test_exception_propagation.<locals>.gsB1[[!233333Q[[!23333s$;r5r*r?r+rrmrs    @r
test_exception_propagationz.ProfileHookTestCase.test_exception_propagations				4	4	4	4	4((((!q&'2 &'2 (G4 "3W= (G4	 	!	!	!	!	!rcfd}t|}||dd|fdd|fgdS)Nc*ddzdS#ddzYdSxYwrtrrjs r
rlz/ProfileHookTestCase.test_raise_twice.<locals>.fs$1AaCCCCCsr5r*r+rmrns   r
test_raise_twicez$ProfileHookTestCase.test_raise_twicesZ			((!q&'2 (G4 	!	!	!	!	!rcfd}t|}||dd|fdd|fgdS)NcddzdS#xYwrtrrjs r
rlz1ProfileHookTestCase.test_raise_reraise.<locals>.fs1Esr5r*r+rmrns   r
test_raise_reraisez&ProfileHookTestCase.test_raise_reraisesZ			((!q&'2 (G4 	!	!	!	!	!rcfd}t|}||dd|fdd|fgdS)Nctr)	Exceptionrjs r
rlz)ProfileHookTestCase.test_raise.<locals>.fs++rr5r*r+rmrns   r

test_raisezProfileHookTestCase.test_raisesX			((!q&'2 (G4 	!	!	!	!	!rcN	
dfdfd		fd

fd}t}t}t	}t
}t|}||dd|fdd|fd	d|fd
d|fdd|fdd|fd
d|fd	d|fdd|fdd|fg
dS)
NcddzdSrtrrrr
rlz5ProfileHookTestCase.test_distant_exception.<locals>.frurcdSrrrlsr
rz5ProfileHookTestCase.test_distant_exception.<locals>.g
ACCCCCrcdSrrrsr
hz5ProfileHookTestCase.test_distant_exception.<locals>.hrrcdSrrrsr
iz5ProfileHookTestCase.test_distant_exception.<locals>.irrcdSrrrkrs r
jz5ProfileHookTestCase.test_distant_exception.<locals>.jrrr5r*r?rr+rmrrrorh_identi_identj_identrlrrrs       @@@@r
test_distant_exceptionz*ProfileHookTestCase.test_distant_exception<																							((((((((((!q&'2 &'2 &'2 &'2 &'2 (G4 (G4 (G4 (G4 (G4
 
	!
	!
	!
	!
	!rc
dfd}t}t|}||dd|fdd|fdd|fdd|fdd|fdd|fdd|fdd|fgdS)Nc36KtdD]}|VdSNr?rangers r
rlz-ProfileHookTestCase.test_generator.<locals>.f01XX



rc"D]}dSrrrkrrls  r
rz-ProfileHookTestCase.test_generator.<locals>.g%QSS



rr5r*r?r+rmrs    @r
test_generatorz"ProfileHookTestCase.test_generators								((((!q&'2 &'2 (G4 &'2 (G4 !&'2 (G4 (G4 	!	!	!	!	!rc
dfd}t}t|}||dd|fdd|fdd|fdd|fdd|fdd|fdd|fdd|fgdS)Nc36KtdD]}|VdSrrrs r
rlz2ProfileHookTestCase.test_stop_iteration.<locals>.frrc"D]}dSrrrs  r
rz2ProfileHookTestCase.test_stop_iteration.<locals>.grrr5r*r?r+rmrs    @r
test_stop_iterationz'ProfileHookTestCase.test_stop_iterations								((((!q&'2 &'2 (G4 &'2 (G4 &'2 (G4 (G4
 
	!
	!
	!
	!
	!rN)r r!r"r_rprvr|rrrrrrrrrrrrr
rfrfds!!!!!!!!!!!!	!	!	!!!!&
!
!
!!!!!!!!!!!!!8!!!,!!!!!rrfcJeZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdS)ProfileSimulatorTestCasec t|Sr)rGrs r
r_z$ProfileSimulatorTestCase.new_watchers%%%rcfd}t|}||dd|fdd|fgdS)NcdSrrrjs r
rlz/ProfileSimulatorTestCase.test_simple.<locals>.frrr5r*r+rmrns   r
rpz$ProfileSimulatorTestCase.test_simplerqrcfd}t|}||dd|fdd|fgdS)NcddzdSrtrrjs r
rlz8ProfileSimulatorTestCase.test_basic_exception.<locals>.f&rurr5r*r+rmrns   r
test_basic_exceptionz-ProfileSimulatorTestCase.test_basic_exception%rwrcfd}t|}||dd|fdd|fgdS)Nc ddzdS#YdSxYwrtrrjs r
rlz9ProfileSimulatorTestCase.test_caught_exception.<locals>.f.rzr{r5r*r+rmrns   r
r|z.ProfileSimulatorTestCase.test_caught_exception-r}rcN	
dfdfd		fd

fd}t}t}t	}t
}t|}||dd|fdd|fd	d|fd
d|fdd|fdd|fd
d|fd	d|fdd|fdd|fg
dS)
NcddzdSrtrrrr
rlz:ProfileSimulatorTestCase.test_distant_exception.<locals>.f7rurcdSrrrsr
rz:ProfileSimulatorTestCase.test_distant_exception.<locals>.g9rrcdSrrrsr
rz:ProfileSimulatorTestCase.test_distant_exception.<locals>.h;rrcdSrrrsr
rz:ProfileSimulatorTestCase.test_distant_exception.<locals>.i=rrcdSrrrs r
rz:ProfileSimulatorTestCase.test_distant_exception.<locals>.j?rrr5r*r?rrrr+rmrs       @@@@r
rz/ProfileSimulatorTestCase.test_distant_exception6rrcpifd}t|}||dd|fdd|fgdS)Nc.tjidfidSN*dictgetrkkwargss r
rlz7ProfileSimulatorTestCase.test_unbound_method.<locals>.fUs#HR&&v&&&&&rr5r*r+rmrrlrors   @r
test_unbound_methodz,ProfileSimulatorTestCase.test_unbound_methodSsh	'	'	'	'	'((!q&'2 (G46	7	7	7	7	7rcfd}t|}||dd|fdd|fgdS)Nc8tdSrrrjs r
rlz?ProfileSimulatorTestCase.test_unbound_method_no_args.<locals>.f]sHHJJJJJrr5r*r+rmrns   r
test_unbound_method_no_argsz4ProfileSimulatorTestCase.test_unbound_method_no_args\sX			((!q&'2 (G46	7	7	7	7	7rcfd}t|}||dd|fdd|fgdS)NcFttddSrrrprintrjs r
rlzDProfileSimulatorTestCase.test_unbound_method_invalid_args.<locals>.fesHHUBrr5r*r+rmrns   r
 test_unbound_method_invalid_argsz9ProfileSimulatorTestCase.test_unbound_method_invalid_argsdsX	 	 	 ((!q&'2 (G46	7	7	7	7	7rcpifd}t|}||dd|fdd|fgdS)Nc*tjdidS)Nrrrs r
rlzGProfileSimulatorTestCase.test_unbound_method_no_keyword_args.<locals>.fnsHvrr5r*r+rmrs   @r
#test_unbound_method_no_keyword_argsz<ProfileSimulatorTestCase.test_unbound_method_no_keyword_argslsh					((!q&'2 (G46	7	7	7	7	7rcpifd}t|}||dd|fdd|fgdS)Nc8tjtdfidSrrrs r
rlzLProfileSimulatorTestCase.test_unbound_method_invalid_keyword_args.<locals>.fws#HUB))&)))))rr5r*r+rmrs   @r
(test_unbound_method_invalid_keyword_argszAProfileSimulatorTestCase.test_unbound_method_invalid_keyword_argsush	*	*	*	*	*((!q&'2 (G46	7	7	7	7	7rN)
r r!r"r_rprr|rrrrrrrrr
rrs&&&!!!!!!!!!!!!:77777777777777777rrc\t|dr|j}n|j}|j|jfS)Nf_code)hasattrr__code__co_firstlinenoco_name)functioncodes  r
r;r;~s5x""! ,,rc,||dS#YdSxYwrr)rlrks  r
protectrs 	
1DDDsc|t}tj}tj	t	j|jt||t	jd|rtjn#|rtjwwxYw|	ddS)Nr5)
r$gc	isenableddisabler	r
r3renablerE)rbrkold_gcs   r
r^r^syMM\^^FJLLLqz"""!t	IKKK	IKKKK	<<>>!B$s=BB#cHddl}|jt|dS)Nr)r`r^)rbr`s  r
show_eventsrs+MMMFM.**+++++rc eZdZdZdZdZdS)
TestEdgeCasesc|tjtjtjddSr)
addCleanupr	r
rrs r
rzTestEdgeCases.setUps6(8(8999trcd}dGfdd}tj|tj5}tj|||jj|j||jj	tdddn#1swxYwY|tj|dS)NcdSrrrs r
fooz*TestEdgeCases.test_reentrancy.<locals>.fooCrcdSrrrs r
barz*TestEdgeCases.test_reentrancy.<locals>.barrrc eZdZdZfdZdS)(TestEdgeCases.test_reentrancy.<locals>.AcdSrr)rrs  r
__call__z1TestEdgeCases.test_reentrancy.<locals>.A.__call__src0tjdSrr)rrs r
__del__z0TestEdgeCases.test_reentrancy.<locals>.A.__del__ss#####rN)r r!r"r
r)rsr
Ars=



$
$
$
$
$
$
$rr
)r	r
rcatch_unraisable_exceptionassertEqual
unraisableobjectrassertIsInstance	exc_valueRuntimeErrorr)rrr
cmrs    @r
test_reentrancyzTestEdgeCases.test_reentrancysJ							$	$	$	$	$	$	$	$	$	$	qqss

/
1
1	IRN3R]119===!!"-"9<HHH	I	I	I	I	I	I	I	I	I	I	I	I	I	I	I
	
))3/////sAB11B58B5cd}tj|~tjtjdS)NcdSrrrs r
rz+TestEdgeCases.test_same_object.<locals>.foorr)r	r
r)rrs  r
test_same_objectzTestEdgeCases.test_same_objectsD				ss~''(((((rN)r r!r"rrrrrr
rrsA000.)))))rr__main__r)rr`r	unittesttestrTestCaserr$rGr\rfrr;r
protect_identr^rrr mainrrr
<module>r s				







,,,,,X&,,,"KKKKKKKK@ 
 
 
 
 
{ 
 
 
FLLLLL8$LLLr!r!r!r!r!,r!r!r!jb7b7b7b7b7|b7b7b7J---g
    ",,,
#)#)#)#)#)H%#)#)#)LzHMOOOOOr