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_settrace.cpython-37.pyc
B

��g��
@s�ddlmZddlZddlZddlZddlZddlmZddlZGdd�d�Z	Gdd�d�Z
dd	�Zd
d�Zdd
dge_
dd�Zdd
dddge_
dd�Zdd
dddge_
dd�Zdd
ddddddddg
e_
dd�Zdd
dddge_
d d!�Zd"d#�Zdd
d$d%d&dge_
d'd(�Zd)d*�Zdd
dd$d%d+d&d,dddge_
d-d.�Zd/d0�Zdge_
d1d2�Zd3d4�Zd,dddge_
d5d6�Zdd
ddddd7ge_
d8d9�Zdd
dddddddd:dd;d<g
e_
d=d>�Zdd
ddddddd?ddd7ge_
d@dA�ZdBdC�ZdddDdEdFdGdHdIdJdKg
ddgdLddge_
GdMdN�dN�ZGdOdP�dPej �Z!GdQdR�dRe!�Z"ej#GdSdT�dTe!��Z$GdUdV�dVej �Z%GdWdX�dX�Z&dYdZ�Z'd[d\�Z(Gd]d^�d^ej �Z)e*d_k�r�e�+�dS)`�)�supportN)�wrapsc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�tracecontextz/Context manager that traces its enter and exit.cCs||_||_dS)N)�output�value)�selfrr�r�2/usr/local/lib/python3.7/test/test_sys_settrace.py�__init__sztracecontext.__init__cCs|j�|j�dS)N)r�appendr)rrrr	�	__enter__sztracecontext.__enter__cGs|j�|j�dS)N)rrr)r�exc_inforrr	�__exit__sztracecontext.__exit__N)�__name__�
__module__�__qualname__�__doc__r
rrrrrr	rsrc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�asynctracecontextz>Asynchronous context manager that traces its aenter and aexit.cCs||_||_dS)N)rr)rrrrrr	r
szasynctracecontext.__init__c�s|j�|j�dS)N)rrr)rrrr	�
__aenter__szasynctracecontext.__aenter__c�s|j�|j�dS)N)rrr)rr
rrr	�	__aexit__!szasynctracecontext.__aexit__N)rrrrr
rrrrrr	rsrcCsx|D]
}|VqWdS)z0Convert an iterable to an asynchronous iterator.Nr)�iterable�xrrr	�	asynciter$s
rcCsdS)N�rrrrr	�basic+sr)r�call)r�line)r�returncCsd}~d}dS)Nrr)rrrr	�
arigo_example;sr)�r)�r)r rcCsd}~d}dS)Nrr)rrrr	�one_instr_lineIsr!)�r)r"rcCs(d}xtd�D]}|rd}qd}qWdS)Nrr)�range)r�arrr	�no_pop_topsTs
r%)�r)�r)rrcCsd}x|stqWd}dS)Nr)Zbla)�yrrrr	�
no_pop_blocksgsr))r'rcCsd}dS)Nrr)rrrr	�calledssr*cCs
t�dS)N)r*rrrr	rvsr)���r)���r)r,rcCst�dS)N)�	Exceptionrrrr	�raises�sr.c
Cs6y
t�Wn&tk
r0}zd}Wdd}~XYnXdS)Nr)r.r-)�excrrrr	�
test_raise�s
r0)r,�	exception)rr1cCst�|�|t��j_dS)N)�sys�settrace�	_getframe�f_back�f_trace)�	tracefuncrrr	�_settrace_and_return�s
r8cCst|�dS)N)r8)r7rrr	�settrace_and_return�sr9cCst�|�|t��j_t�dS)N)r2r3r4r5r6�RuntimeError)r7rrr	�_settrace_and_raise�s
r;c
Cs4yt|�Wn"tk
r.}zWdd}~XYnXdS)N)r;r:)r7r/rrr	�settrace_and_raise�sr<cCsd}d}||kr|d}ndS)Nr rr)r$�brrr	�ireturn_example�s

r>)r&rcCsBtdd�}yd}x||}|d7}qWWntk
r<YnXdS)Nrr"r)r#�
IndexError)�items�ir=rrr	�tightloop_example�s
rB)r r1)�r)rCrcCs:tdd�}yd}x||}qWWntk
r4YnXdS)Nrr'r)r#r?)r@rArrr	�tighterloop_example�s
rD)r'r1ccsz
dVWdXdS)NTrrrrr	�generator_function�srEcCs$tt��}xtd�D]}|}qWdS)N�
)�anyrEr#)rr(rrr	�generator_example�s
rH)i����r)���r)���r)rJr)rJr)rJr1)���r)rKrrFc@s.eZdZd
dd�Zdd�Zdd�Zdd	�ZdS)�TracerNcCs||_||_g|_dS)N)�trace_line_events�trace_opcode_events�events)rrMrNrrr	r
szTracer.__init__cCs(|jdk	r|j|_|jdk	r$|j|_dS)N)rM�
f_trace_linesrN�f_trace_opcodes)r�framerrr	�_reconfigure_frames

zTracer._reconfigure_framecCs"|�|�|j�|j|f�|jS)N)rSrOr�f_lineno�trace)rrR�event�argrrr	rUs
zTracer.tracecCs0|�|�dd�dD�|j�|j|f�|jS)Ncss|]
}|VqdS)Nr)�.0�orrr	�	<genexpr> sz)Tracer.traceWithGenexp.<locals>.<genexpr>)r)rSrOrrTrU)rrRrVrWrrr	�traceWithGenexps
zTracer.traceWithGenexp)NN)rrrr
rSrUr[rrrr	rL
s
rLc@s�eZdZdd�Zdd�Zedd��Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5S)6�
TraceTestCasecCs(t��|_t��|�tjt���dS)N)�gcZ	isenabled�using_gcZdisable�
addCleanupr2r3�gettrace)rrrr	�setUp)s
zTraceTestCase.setUpcCs|jrt��dS)N)r^r]Zenable)rrrr	�tearDown.szTraceTestCase.tearDowncCst�S)z@Helper to allow test subclasses to configure tracers differently)rLrrrr	�make_tracer2szTraceTestCase.make_tracerc
sN�fdd�|D�}||krJ|�dd�t�dd�|D�dd�|D����dS)Ncsg|]\}}|�|f�qSrr)rX�l�e)�line_offsetrr	�
<listcomp>8sz0TraceTestCase.compare_events.<locals>.<listcomp>z"events did not match expectation:
�
cSsg|]}t|��qSr)�str)rXrrrr	rg<scSsg|]}t|��qSr)ri)rXrrrr	rg=s)�fail�join�difflibZndiff)rrfrO�expected_eventsr)rfr	�compare_events7szTraceTestCase.compare_eventscCs<|��}t�|j�|�t�d�|�|jj|j|�dS)N)rcr2r3rUrn�__code__�co_firstlinenorO)r�funcrO�tracerrrr	�run_and_compare?s

zTraceTestCase.run_and_comparecCs|�||j�dS)N)rsrO)rrqrrr	�run_testGszTraceTestCase.run_testcCs6|��}||j�t�d�|�|jj|j|j�dS)N)rcrUr2r3rnrorprO)rrqrrrrr	�	run_test2Js



zTraceTestCase.run_test2cCst�d�t��dkst�dS)N)r2r3r`�AssertionError)rrrr	�test_set_and_retrieve_noneQs
z(TraceTestCase.test_set_and_retrieve_nonec	Cs8dd�}t�|�zt��|ks$t�Wdt�d�XdS)NcWsdS)Nr)�argsrrr	�fnVsz4TraceTestCase.test_set_and_retrieve_func.<locals>.fn)r2r3r`rv)rryrrr	�test_set_and_retrieve_funcUs

z(TraceTestCase.test_set_and_retrieve_funccCs|�t�dS)N)rtr)rrrr	�
test_01_basic_szTraceTestCase.test_01_basiccCs|�t�dS)N)rtr)rrrr	�
test_02_arigoaszTraceTestCase.test_02_arigocCs|�t�dS)N)rtr!)rrrr	�test_03_one_instrcszTraceTestCase.test_03_one_instrcCs|�t�dS)N)rtr))rrrr	�test_04_no_pop_blocksesz#TraceTestCase.test_04_no_pop_blockscCs|�t�dS)N)rtr%)rrrr	�test_05_no_pop_topsgsz!TraceTestCase.test_05_no_pop_topscCs|�t�dS)N)rtr)rrrr	�test_06_calliszTraceTestCase.test_06_callcCs|�t�dS)N)rtr0)rrrr	�
test_07_raisekszTraceTestCase.test_07_raisecCs|�t�dS)N)rur9)rrrr	�test_08_settrace_and_returnnsz)TraceTestCase.test_08_settrace_and_returncCs|�t�dS)N)rur<)rrrr	�test_09_settrace_and_raisepsz(TraceTestCase.test_09_settrace_and_raisecCs|�t�dS)N)rtr>)rrrr	�test_10_ireturnrszTraceTestCase.test_10_ireturncCs|�t�dS)N)rtrB)rrrr	�test_11_tightlooptszTraceTestCase.test_11_tightloopcCs|�t�dS)N)rtrD)rrrr	�test_12_tighterloopvsz!TraceTestCase.test_12_tighterloopcCsH|�t�|��}t�|j�t�t�d�|�tjj|j	tj	�dS)N)
rtrHrcr2r3r[rnrorprO)rrrrrr	�test_13_genexpys


zTraceTestCase.test_13_genexpcCs dd�}|�|ddddg�dS)NcSsd}dS)NFrr)rrrr	�onliners�sz2TraceTestCase.test_14_onliner_if.<locals>.onliners)rr)rr)r"r)r"r)rs)rr�rrr	�test_14_onliner_if�sz TraceTestCase.test_14_onliner_ifcCsJdd�}|�|dddddddg�dd�}|�|ddd	d
d	d
d	dg�dS)NcSsxtd�D]}q
WdS)Nr)r#)rrrr	�for_example�sz0TraceTestCase.test_15_loops.<locals>.for_example)rr)rr)rr)rrcSsd}x|dkr|d8}qWdS)Nrrrr)rrrr	�
while_example�s
z2TraceTestCase.test_15_loops.<locals>.while_example)r"r)r'r)r"r)rs)rr�r�rrr	�
test_15_loops�s*zTraceTestCase.test_15_loopscCs(i}td|�|�|ddddg�dS)Nadef f():
































































































































































































































































    pass�f)rr)ir)ir)�execrs)r�	namespacerrr	�test_16_blank_lines�s
z!TraceTestCase.test_16_blank_linescCsdd�}|�|ddg�dS)NcSsdt��_d}dS)Nr)r2r4r6)�linenorrr	rq�s
z0TraceTestCase.test_17_none_f_trace.<locals>.func)rr)rr)rs)rrqrrr	�test_17_none_f_trace�sz"TraceTestCase.test_17_none_f_traceN)rrrrarb�staticmethodrcrnrsrtrurwrzr{r|r}r~rr�r�r�r�r�r�r�r�r�r�r�r�rrrr	r\%s4

	r\cs,eZdZdZ�fdd�Zedd��Z�ZS)�SkipLineEventsTraceTestCasez8Repeat the trace tests, but with per-line events skippedcs"dd�|D�}t��|||�dS)NcSsg|]}|ddkr|�qS)rrr)rXrerrr	rg�sz>SkipLineEventsTraceTestCase.compare_events.<locals>.<listcomp>)�superrn)rrfrOrmZskip_line_events)�	__class__rr	rn�sz*SkipLineEventsTraceTestCase.compare_eventscCs
tdd�S)NF)rM)rLrrrr	rc�sz'SkipLineEventsTraceTestCase.make_tracer)rrrrrnr�rc�
__classcell__rr)r�r	r��sr�cs,eZdZdZ�fdd�Zedd��Z�ZS)�TraceOpcodesTestCasez;Repeat the trace tests, but with per-opcodes events enabledcsFdd�|D�}t|�dkr2|jt|�t|�dd�t��|||�dS)NcSsg|]}|ddkr|�qS)rZopcoder)rXrerrr	rg�sz7TraceOpcodesTestCase.compare_events.<locals>.<listcomp>rz)No 'opcode' events received by the tracer)�msg)�lenZ
assertLessr�rn)rrfrOrmZskip_opcode_events)r�rr	rn�s
z#TraceOpcodesTestCase.compare_eventscCs
tdd�S)NT)rN)rLrrrr	rc�sz TraceOpcodesTestCase.make_tracer)rrrrrnr�rcr�rr)r�r	r��sr�c@s\eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�ZdS)�RaisingTraceFuncTestCasecCs|�tjt���dS)N)r_r2r3r`)rrrr	ra�szRaisingTraceFuncTestCase.setUpcCs||jkrt�n|jSdS)zXA trace function that raises an exception in response to a
        specific trace event.N)�raiseOnEvent�
ValueErrorrU)rrRrVrWrrr	rU�s
zRaisingTraceFuncTestCase.tracecCs |jdkrd}d|}ndSdS)zThe function to trace; raises an exception if that's the case
        we're testing, so that the 'exception' trace event fires.r1rrN)r�)rrr(rrr	r��s

zRaisingTraceFuncTestCase.fc	Cs�||_yVxPtt��d�D]<}t�|j�y|��Wntk
rJYqX|�d�qWWnt	k
rz|�d�YnXdS)zTTests that an exception raised in response to the given event is
        handled OK.rzexception not raised!zrecursion counter not resetN)
r�r#r2�getrecursionlimitr3rUr�r�rjr:)rrVrArrr	�run_test_for_event�sz+RaisingTraceFuncTestCase.run_test_for_eventcCs|�d�dS)Nr)r�)rrrr	�	test_callsz"RaisingTraceFuncTestCase.test_callcCs|�d�dS)Nr)r�)rrrr	�	test_linesz"RaisingTraceFuncTestCase.test_linecCs|�d�dS)Nr)r�)rrrr	�test_return
sz$RaisingTraceFuncTestCase.test_returncCs|�d�dS)Nr1)r�)rrrr	�test_exceptionsz'RaisingTraceFuncTestCase.test_exceptioncs^dd����fdd��t���y
��Wn$tk
rNddl}|��YnX|�d�dS)NcSsxtd�D]}t|�q
WdS)Nr )r#�print)rArrr	r�sz4RaisingTraceFuncTestCase.test_trash_stack.<locals>.fcs&|dkr"|j�jjdkr"td���S)Nrrz
i am crashing)rTrorpr:)rRZwhyZextra)r��grr	r�sz4RaisingTraceFuncTestCase.test_trash_stack.<locals>.grzexception not propagated)r2r3r:r]Zcollectrj)rr]r)r�r�r	�test_trash_stacks

z)RaisingTraceFuncTestCase.test_trash_stackc	s^dd�}��fdd��t��}z.t���y
|�Wntk
rHYnXWdt�|�XdS)NcSsd}|jdS)Nr)Zno_such_attr)rrrr	r�&sz<RaisingTraceFuncTestCase.test_exception_arguments.<locals>.fcs"|dkr|\}}}��|t��S)Nr1)ZassertIsInstancer-)rRrVrW�typer1rU)r�rrr	r�*s
z<RaisingTraceFuncTestCase.test_exception_arguments.<locals>.g)r2r`r3�AttributeError)rr�Zexistingr)r�rr	�test_exception_arguments%s


z1RaisingTraceFuncTestCase.test_exception_argumentsN)
rrrrarUr�r�r�r�r�r�r�r�rrrr	r��s	r�c@s"eZdZdZd	dd�Zdd�ZdS)
�
JumpTracerz>Defines a trace function that jumps from one place to another.rFcCs6|j|_||_||_||_|r"dn|jj|_d|_dS)NF)ro�code�jumpFrom�jumpTorVrp�	firstLine�done)rZfunctionr�r�rV�	decoratedrrr	r
CszJumpTracer.__init__cCs�|jr
dS|jdkr4|j|jkr4|dkr4|jd|_||jkr�|jr�|j|j|jkr�|}x|dk	rx|j|jkrx|j}q\W|dk	r�y|j|j|_Wnt	k
r�|j|_YnXd|_|j
S)NrrT)r�r��f_coder�rTrVr�r5r��	TypeErrorrU)rrRrVrWr�rrr	rULs"
zJumpTracer.traceN)rF)rrrrr
rUrrrr	r�@s
r�c
CsHy|�d�Wn4tk
rB}z|�dt|�k�Wdd}~XYnXdS)NrZinteger)rr�ri)rrerrr	�no_jump_to_non_integersfsr�c
CsTyt��j}|j|_Wn0tk
rF}zdt|�kr6�Wdd}~XYn
Xtd��dS)NrUz'Trace-function-less jump failed to fail)r2r4r5rTr�rirv)Zprevious_framererrr	�no_jump_without_trace_functionns
r�c@s�eZdZdd�Zdd�Zd�dd	�Zd�d
d�Zd�dd
�Zd�dd�Zedddg�dd��Z	edddddg�dd��Z
eddddg�dd��Zeddddddddddg�dd��Zeddddg�dd ��Z
eddddddddg�d!d"��Zedddg�d#d$��Zedddddg�d%d&��Zedd'dd'g�d(d)��Zeddddged*f�d+d,��Zedd-dd-ged*f�d.d/��Zeddddg�d0d1��Zeddddg�d2d3��Zeddddg�d4d5��Zedddddddd6g�d7d8��Zedddddddd6g�d9d:��Zedddg�d;d<��Zeddddddg�d=d>��Zedddg�d?d@��Zedddddg�dAdB��ZedddddCg�dDdE��Zedddddg�dFdG��ZeddddddHg�dIdJ��Z eddddddHg�dKdL��Z!eddddddg�dMdN��Z"eddddddg�dOdP��Z#eddddddd6dg�dQdR��Z$eddddddd6dg�dSdT��Z%eddddddg�dUdV��Z&eddddddg�dWdX��Z'edCd-dddd-dYg�dZd[��Z(edddddg�d\d]��Z)edddddg�d^d_��Z*edddddCd'g�d`da��Z+eddCdddCdbd-dcg�ddde��Z,eddddCg�dfdg��Z-eddddCg�dhdi��Z.edddge/djf�dkdl��Z0edd6dge/dmf�dndo��Z1edddge/dpf�dqdr��Z2edddge/dpf�dsdt��Z3edddge/dpf�dudv��Z4edddge/dpf�dwdx��Z5eddge/dyf�dzd{��Z6eddge/dyf�d|d}��Z7eddddge/dyf�d~d��Z8eddddge/dyf�d�d���Z9eddge/dyf�d�d���Z:eddddge/dyf�d�d���Z;eddge/dyf�d�d���Z<eddge/dyf�d�d���Z=eddddd�ge/dyf�d�d���Z>eddddd�ge/dyf�d�d���Z?eddge/dyf�d�d���Z@eddddge/dyf�d�d���ZAeddge/dyf�d�d���ZBedddge/dyf�d�d���ZCedddge/dyf�d�d���ZDedddddge/d�f�d�d���ZEeddge/d�f�d�d���ZFeddddge/d�f�d�d���ZGeddddd6ge/dyf�d�d���ZHeddddd6ge/dyf�d�d���ZIeddddge/dyf�d�d���ZJeddddge/dyf�d�d���ZKd�d��ZLd�d��ZMd�d��ZNd�d��ZOedddgd�e/d�fd��d�d���ZPedddgd�e/d�fd��d�d���ZQedddgd�e/d�fd��d�d���ZRedddgd�e/d�fd��d�d���ZSdS)��JumpTestCasecCs |�tjt���t�d�dS)N)r_r2r3r`)rrrr	ra}szJumpTestCase.setUpcCs.||kr*|�dt|�ddt|��dS)NzOutputs don't match:
Expected: rhz
Received: )rj�repr)r�expectedZreceivedrrr	�compare_jump_output�sz JumpTestCase.compare_jump_outputNrFc
	Csjt|||||�}t�|j�g}	|dkr2||	�n|j|��||	�WdQRXt�d�|�||	�dS)N)r�r2r3rU�assertRaisesRegexr�)
rrqr�r�r��errorrVr�rrrrrr	rt�s

zJumpTestCase.run_testc
	Csvt|||||�}t�|j�g}	|dkr8t�||	��n$|j|��t�||	��WdQRXt�d�|�||	�dS)N)r�r2r3rU�asyncio�runr�r�)
rrqr�r�r�r�rVr�rrrrrr	�run_async_test�s
zJumpTestCase.run_async_testcs�����fdd�}|S)zqDecorator that creates a test that makes a jump
        from one place to another in the following code.
        cs"t��������fdd��}|S)Nc	s|j������dd�dS)NT)r�rVr�)rt)r)r�rVr�rqr�r�rr	�test�sz7JumpTestCase.jump_test.<locals>.decorator.<locals>.test)r)rqr�)r�rVr�r�r�)rqr	�	decorator�sz)JumpTestCase.jump_test.<locals>.decoratorr)r�r�r�r�rVr�r)r�rVr�r�r�r	�	jump_test�szJumpTestCase.jump_testcs�����fdd�}|S)z~Decorator that creates a test that makes a jump
        from one place to another in the following asynchronous code.
        cs"t��������fdd��}|S)Nc	s|j������dd�dS)NT)r�rVr�)r�)r)r�rVr�rqr�r�rr	r��sz=JumpTestCase.async_jump_test.<locals>.decorator.<locals>.test)r)rqr�)r�rVr�r�r�)rqr	r��sz/JumpTestCase.async_jump_test.<locals>.decoratorr)r�r�r�r�rVr�r)r�rVr�r�r�r	�async_jump_test�szJumpTestCase.async_jump_testrr"cCs"|�d�|�d�|�d�dS)Nrrr")r)rrrr	�test_jump_simple_forwards�s

z&JumpTestCase.test_jump_simple_forwardsrcCs|�d�|�d�dS)Nrr)r)rrrr	�test_jump_simple_backwards�s
z'JumpTestCase.test_jump_simple_backwardsr cCs>x.dD]&}|�d�xdD]}|�d�qWqW|�d�dS)N)rrr)r"r'r )r)rrA�jrrr	�test_jump_out_of_block_forwards�s



z,JumpTestCase.test_jump_out_of_block_forwardsr&rCcCsR|�d�x8dD]0}|�d�xdD]}|�d�q$W|�d�qW|�d�dS)Nr)rr")rr r&rC)r)rrAr�rrr	� test_jump_out_of_block_backwards�s



z-JumpTestCase.test_jump_out_of_block_backwardsr'c
�sdx^dD]V}xFtddg�2y3dH}Wn
tk
sFX|�d�|�d�qYW|�d�qWdS)N)rrrr"r'r )r�StopAsyncIterationr)rrArrr	�)test_jump_out_of_async_for_block_forwards�s

&
z6JumpTestCase.test_jump_out_of_async_for_block_forwardsc
�slxfdD]^}|�d�xDtdg�2y3dH}Wn
tk
sNX|�d�|�d�q YW|�d�qWdS)N)rrrr'r r&)rrr�)rrArrr	�*test_jump_out_of_async_for_block_backwards�s

$
z7JumpTestCase.test_jump_out_of_async_for_block_backwardscCs|�d�|�d�dS)Nrr")r)rrrr	�test_jump_to_codeless_line�s
z'JumpTestCase.test_jump_to_codeless_linecCs"|�d�|�d�|�d�dS)Nrrr")r)rrrr	�test_jump_to_same_line�s

z#JumpTestCase.test_jump_to_same_line�	cCsFz|�d�Wd|�d�z|�d�Wd|�d�X|�d�XdS)Nrr'r&�r�)r)rrrr	�test_jump_in_nested_finally�s
z(JumpTestCase.test_jump_in_nested_finally�c	Cs<z|�d�dddS|�d�|�d�X|�d�dS)Nrrrr&rCr�)r)rrrr	�test_jump_in_nested_finally_2s

z*JumpTestCase.test_jump_in_nested_finally_2�cCsXz|�d�dddS|�d�z|�d�Wd|�d�X|�d�X|�d�dS)	Nrrrr&r�rFr��)r)rrrr	�test_jump_in_nested_finally_3
s

z*JumpTestCase.test_jump_in_nested_finally_3cCs(|�d�x|�d�qW|�d�dS)Nrr"r')r)rrrr	�test_jump_infinite_while_loops
z*JumpTestCase.test_jump_infinite_while_loopc	Cs.t|d��|�d�WdQRX|�d�dS)Nrrr")rr)rrrr	�$test_jump_forwards_out_of_with_block#sz1JumpTestCase.test_jump_forwards_out_of_with_blockc
�s<t|d�4IdH�|�d�WdQIdHRX|�d�dS)Nrrr")rr)rrrr	�*test_jump_forwards_out_of_async_with_block)sz7JumpTestCase.test_jump_forwards_out_of_async_with_blockr,c	Cs.|�d�t|d��|�d�WdQRXdS)Nrrr")rr)rrrr	�%test_jump_backwards_out_of_with_block/s
z2JumpTestCase.test_jump_backwards_out_of_with_blockc
�s<|�d�t|d�4IdH�|�d�WdQIdHRXdS)Nrrr")rr)rrrr	�+test_jump_backwards_out_of_async_with_block5s
z8JumpTestCase.test_jump_backwards_out_of_async_with_blockc	Cs*z|�d�Wd|�d�X|�d�dS)Nrr'r )r)rrrr	�+test_jump_forwards_out_of_try_finally_block;sz8JumpTestCase.test_jump_forwards_out_of_try_finally_blockc	Cs*|�d�z|�d�Wd|�d�XdS)Nrr"r )r)rrrr	�,test_jump_backwards_out_of_try_finally_blockCs
z9JumpTestCase.test_jump_backwards_out_of_try_finally_blockcCs6y|�d�Wn|�d��YnX|�d�dS)Nrr'r&)r)rrrr	�*test_jump_forwards_out_of_try_except_blockKs
z7JumpTestCase.test_jump_forwards_out_of_try_except_blockcCs6|�d�y|�d�Wn|�d��YnXdS)Nrr"r )r)rrrr	�+test_jump_backwards_out_of_try_except_blockTs

z8JumpTestCase.test_jump_backwards_out_of_try_except_blockr�cCs`yddWnDtk
r4|�d�|�d�Yntk
rP|�d�YnX|�d�dS)Nrrr'r rCr�)�ZeroDivisionErrorr�FloatingPointError)rrrr	�test_jump_between_except_blocks]s
z,JumpTestCase.test_jump_between_except_blockscCsFyddWn*|�d�|�d�|�d�YnX|�d�dS)Nrrr'r r&rC)r)rrrr	�test_jump_within_except_blockhs

z*JumpTestCase.test_jump_within_except_blockrJc	CsN|�d�t|d��|�d�WdQRXt|d��|�d�WdQRXdS)Nrrr"r'r )rr)rrrr	�test_jump_across_withrs

z"JumpTestCase.test_jump_across_withc
�sj|�d�t|d�4IdH�|�d�WdQIdHRXt|d�4IdH�|�d�WdQIdHRXdS)Nrrr"r'r )rr)rrrr	�test_jump_across_async_withzs

z(JumpTestCase.test_jump_across_async_withc
CsP|�d�x6dD].}t|d��|�d�WdQRX|�d�qW|�d�dS)Nr)rr"r'r r&)rr)rrArrr	�,test_jump_out_of_with_block_within_for_block�s

z9JumpTestCase.test_jump_out_of_with_block_within_for_blockc�s^|�d�xDdD]<}t|d�4IdH�|�d�WdQIdHRX|�d�qW|�d�dS)Nr)rr"r'r r&)rr)rrArrr	�2test_jump_out_of_async_with_block_within_for_block�s

z?JumpTestCase.test_jump_out_of_async_with_block_within_for_blockc
CsX|�d�t|d��0t|d��|�d�WdQRX|�d�WdQRX|�d�dS)Nrrr"r'r r&)rr)rrrr	�-test_jump_out_of_with_block_within_with_block�s
z:JumpTestCase.test_jump_out_of_with_block_within_with_blockc�sf|�d�t|d��>t|d�4IdH�|�d�WdQIdHRX|�d�WdQRX|�d�dS)Nrrr"r'r r&)rrr)rrrr	�3test_jump_out_of_async_with_block_within_with_block�s
z@JumpTestCase.test_jump_out_of_async_with_block_within_with_blockcCsJz|�d�Wdt|d��|�d�WdQRX|�d�X|�d�dS)Nrr'r r&rC)rr)rrrr	�0test_jump_out_of_with_block_within_finally_block�sz=JumpTestCase.test_jump_out_of_with_block_within_finally_blockc�sXz|�d�Wdt|d�4IdH�|�d�WdQIdHRX|�d�X|�d�dS)Nrr'r r&rC)rr)rrrr	�6test_jump_out_of_async_with_block_within_finally_block�szCJumpTestCase.test_jump_out_of_async_with_block_within_finally_blockr�cCs||�d�xbdD]Z}|�d�x@dD]8}|�d�zxdD]}|�d�q:WWd|�d�Xq$W|�d�qW|�d	�dS)
Nr)rr")rrr r�rFr�r�)r)rrAr��krrr	�&test_jump_out_of_complex_nested_blocks�s





z3JumpTestCase.test_jump_out_of_complex_nested_blocksc	Cs8|�d�t|d��}|�d�WdQRX|�d�dS)Nrrr'r )rr)rrrrr	� test_jump_out_of_with_assignment�s


z-JumpTestCase.test_jump_out_of_with_assignmentc
�sF|�d�t|d�4IdH�}|�d�WdQIdHRX|�d�dS)Nrrr'r )rr)rrrrr	�&test_jump_out_of_async_with_assignment�s

z3JumpTestCase.test_jump_out_of_async_with_assignmentc	CsF|�d�z |�d�|sdS|�d�Wd|�d�X|�d�dS)Nrr"r&r�r�)r)rrrr	�*test_jump_over_return_in_try_finally_block�s

z7JumpTestCase.test_jump_over_return_in_try_finally_blockrF�
c	Cs`|�d�xF|�d�z|�d�|s(P|�d�Wd|�d�X|�d�PqW|�d�dS)Nrr"r r�rFr�r�)r)rrrr	�)test_jump_over_break_in_try_finally_block�s



z6JumpTestCase.test_jump_over_break_in_try_finally_blockcCsJ|�d�|s(x,dD]}|�d�qWn|�d�|�d�|�d�dS)Nr)r"r'r&rCr�)r)rrArrr	�$test_jump_over_for_block_before_else�s



z1JumpTestCase.test_jump_over_for_block_before_elsec	�sn|�d�|sLxPtdg�2y3dH}Wn
tk
s>X|�d�qYWn|�d�|�d�|�d�dS)Nrr"r'r&rCr�)rrr�)rrArrr	�*test_jump_over_async_for_block_before_elses
$

z7JumpTestCase.test_jump_over_async_for_block_before_elseZaftercCs|�d�|�d�dS)Nrr)r)rrrr	�test_no_jump_too_far_forwards
s
z*JumpTestCase.test_no_jump_too_far_forwardsZbeforecCs|�d�|�d�dS)Nrr)r)rrrr	�test_no_jump_too_far_backwardss
z+JumpTestCase.test_no_jump_too_far_backwards�exceptcCs,y|�d�Wn|�d��YnXdS)Nrr')r)rrrr	�test_no_jump_to_except_1s

z%JumpTestCase.test_no_jump_to_except_1cCs4y|�d�Wn tk
r.|�d��YnXdS)Nrr')rr�)rrrr	�test_no_jump_to_except_2 s

z%JumpTestCase.test_no_jump_to_except_2c
CsDy|�d�Wn0tk
r>}z|�d�|�Wdd}~XYnXdS)Nrr')rr�)rrerrr	�test_no_jump_to_except_3(s

z%JumpTestCase.test_no_jump_to_except_3c
CsHy|�d�Wn4ttfk
rB}z|�d�|�Wdd}~XYnXdS)Nrr')rr�r:)rrerrr	�test_no_jump_to_except_40s

z%JumpTestCase.test_no_jump_to_except_4ZintocCs&|�d�xdD]}|�d�qWdS)Nr)rrr")r)rrArrr	�$test_no_jump_forwards_into_for_block8s

z1JumpTestCase.test_no_jump_forwards_into_for_blockc	�sL|�d�x<tddg�2y3dH}Wn
tk
s<X|�d�qYWdS)Nrrr")rrr�)rrArrr	�*test_no_jump_forwards_into_async_for_block>s
&z7JumpTestCase.test_no_jump_forwards_into_async_for_blockcCs&xdD]}|�d�qW|�d�dS)N)rrrr")r)rrArrr	�%test_no_jump_backwards_into_for_blockDs
z2JumpTestCase.test_no_jump_backwards_into_for_blockc	�sLx<tddg�2y3dH}Wn
tk
s2X|�d�qYW|�d�dS)Nrrr")rr�r)rrArrr	�+test_no_jump_backwards_into_async_for_blockJs&z8JumpTestCase.test_no_jump_backwards_into_async_for_blockcCs2d}|�d�x|dkr,|�d�|d7}qWdS)Nrrr')r)rrArrr	�&test_no_jump_forwards_into_while_blockPs



z3JumpTestCase.test_no_jump_forwards_into_while_blockcCs2d}x|dkr"|�d�|d7}qW|�d�dS)Nrrr"r )r)rrArrr	�'test_no_jump_backwards_into_while_blockXs


z4JumpTestCase.test_no_jump_backwards_into_while_blockc	Cs.|�d�t|d��|�d�WdQRXdS)Nrrr")rr)rrrr	�%test_no_jump_forwards_into_with_block`s
z2JumpTestCase.test_no_jump_forwards_into_with_blockc
�s<|�d�t|d�4IdH�|�d�WdQIdHRXdS)Nrrr")rr)rrrr	�+test_no_jump_forwards_into_async_with_blockfs
z8JumpTestCase.test_no_jump_forwards_into_async_with_blockrKc	Cs.t|d��|�d�WdQRX|�d�dS)Nrrr")rr)rrrr	�&test_no_jump_backwards_into_with_blocklsz3JumpTestCase.test_no_jump_backwards_into_with_blockc
�s<t|d�4IdH�|�d�WdQIdHRX|�d�dS)Nrrr")rr)rrrr	�,test_no_jump_backwards_into_async_with_blockrsz9JumpTestCase.test_no_jump_backwards_into_async_with_blockc	Cs*|�d�z|�d�Wd|�d�XdS)Nrr"r )r)rrrr	�,test_no_jump_forwards_into_try_finally_blockxs
z9JumpTestCase.test_no_jump_forwards_into_try_finally_blockc	Cs*z|�d�Wd|�d�X|�d�dS)Nrr'r )r)rrrr	�-test_no_jump_backwards_into_try_finally_block�sz:JumpTestCase.test_no_jump_backwards_into_try_finally_blockcCs6|�d�y|�d�Wn|�d��YnXdS)Nrr"r )r)rrrr	�+test_no_jump_forwards_into_try_except_block�s

z8JumpTestCase.test_no_jump_forwards_into_try_except_blockcCs6y|�d�Wn|�d��YnX|�d�dS)Nrr'r&)r)rrrr	�,test_no_jump_backwards_into_try_except_block�s
z9JumpTestCase.test_no_jump_backwards_into_try_except_blockc
CsnyddWnRtk
r4|�d�|�d�Yn,tk
r^}z|�d�Wdd}~XYnX|�d�dS)Nrrr'r rCr�)r�rr�)rrerrr	�$test_no_jump_between_except_blocks_2�s
z1JumpTestCase.test_no_jump_between_except_blocks_2�finallyc	Cs>z|�d�|�d�Wd|�d�|�d�X|�d�dS)Nrr"r r&rC)r)rrrr	�test_no_jump_into_finally_block�s

z,JumpTestCase.test_no_jump_into_finally_blockc	Cs*|�d�z|�d�Wd|�d�XdS)Nrr"r )r)rrrr	�!test_no_jump_into_finally_block_2�s
z.JumpTestCase.test_no_jump_into_finally_block_2c	Cs*|�d�z|�d�Wd|�d�XdS)Nrr"r )r)rrrr	�!test_no_jump_out_of_finally_block�s
z.JumpTestCase.test_no_jump_out_of_finally_blockc	CsN|�d�t|d��|�d�WdQRXt|d��|�d�WdQRXdS)Nrrr"r'r )rr)rrrr	� test_no_jump_between_with_blocks�s

z-JumpTestCase.test_no_jump_between_with_blocksc
�sj|�d�t|d�4IdH�|�d�WdQIdHRXt|d�4IdH�|�d�WdQIdHRXdS)Nrrr"r'r )rr)rrrr	�&test_no_jump_between_async_with_blocks�s

z3JumpTestCase.test_no_jump_between_async_with_blockscCsJ|�d�|s(x,dD]}|�d�qWn|�d�|�d�|�d�dS)Nr)r"r'r&rCr�)r)rrArrr	�'test_no_jump_into_for_block_before_else�s



z4JumpTestCase.test_no_jump_into_for_block_before_elsec	�sn|�d�|sLxPtdg�2y3dH}Wn
tk
s>X|�d�qYWn|�d�|�d�|�d�dS)Nrr"r'r&rCr�)rrr�)rrArrr	�-test_no_jump_into_async_for_block_before_else�s
$

z:JumpTestCase.test_no_jump_into_async_for_block_before_elsecCs|�tdddg�dS)NrZSpamT)rtr�)rrrr	�test_no_jump_to_non_integers�sz)JumpTestCase.test_no_jump_to_non_integerscCs
t�dS)N)r�)rrrr	�#test_no_jump_without_trace_function�sz0JumpTestCase.test_no_jump_without_trace_functioncCs0i}tdd|�|d}|�|dddg�dS)Na�def f(output):        # line 0
            x = 0                     # line 1
            y = 1                     # line 2
            '''                       # line 3
            %s                        # lines 4-1004
            '''                       # line 1005
            x += 1                    # line 1006
            output.append(x)          # line 1007
            return)a�







































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































r�ri�r)r�rt)r�dr�rrr	�test_large_function�s
z JumpTestCase.test_large_functioncsptddd��G�fdd�d�}t|dd�}t�|j�dgi}t�|�t�d�|�dd	dd	d
g|d�dS)Nzd
# Comments don't count.
output.append(2)  # firstlineno is here.
output.append(3)
output.append(4)
z
<fake module>r�cseZdZ�ZdS)z<JumpTestCase.test_jump_to_firstlineno.<locals>.fake_functionN)rrrror)r�rr	�
fake_functionsrrrrr"r')�compiler�r2r3rUr�r�)rrrrr�r)r�r	�test_jump_to_firstlineno�s


z%JumpTestCase.test_jump_to_firstlinenorz5can't jump from the 'call' trace event of a new frame)rVr�cs*��d��fdd�}|���d�dS)Nrcs��d�dS)Nr")rr)rrr	�nestedsz3JumpTestCase.test_no_jump_from_call.<locals>.nestedr )r)rrr)rr	�test_no_jump_from_calls
z#JumpTestCase.test_no_jump_from_callrz'can only jump from a 'line' trace eventcCs|�d�dS)Nr)r)rrrr	�test_no_jump_from_return_events
z+JumpTestCase.test_no_jump_from_return_eventr1cCs|�d�dddS)Nrr)r)rrrr	�!test_no_jump_from_exception_events
z.JumpTestCase.test_no_jump_from_exception_eventz!can't jump from a yield statementcs$�fdd�}t|����d�dS)Nc3s��d�dVdS)Nrr")rr)rrr	�gen's
z1JumpTestCase.test_no_jump_from_yield.<locals>.genr )�nextr)rrr)rr	�test_no_jump_from_yield$s
z$JumpTestCase.test_no_jump_from_yield)NrF)NrF)Nr)Nr)Trrrrar�rtr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrrrrr	r
rrr
rrrrrrrrrrrrrr	r�|s�



$
 	  		
		 	 	

 
  	
 
   	r��__main__),r�rZunittestr2rlr]�	functoolsrr�rrrrrOrr!r%r)r*rr.r0r8r9r;r<r>rBrDrErHrLZTestCaser\r�Zcpython_onlyr�r�r�r�r�r�r�mainrrrr	�<module>s
	" `&7