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.opt-2.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$eZdZdd�Zdd�Zdd�ZdS)�tracecontextcCs||_||_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__r
rrrrrr	rsrc@s$eZdZdd�Zdd�Zdd�ZdS)�asynctracecontextcCs||_||_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)rrrr
rrrrrr	rsrcCsx|D]
}|VqWdS)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)rrcCsd}~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
r/)r+�	exception)rr0cCst�|�|t��j_dS)N)�sys�settrace�	_getframe�f_back�f_trace)�	tracefuncrrr	�_settrace_and_return�s
r7cCst|�dS)N)r7)r6rrr	�settrace_and_return�sr8cCst�|�|t��j_t�dS)N)r1r2r3r4r5�RuntimeError)r6rrr	�_settrace_and_raise�s
r:c
Cs4yt|�Wn"tk
r.}zWdd}~XYnXdS)N)r:r9)r6r.rrr	�settrace_and_raise�sr;cCsd}d}||kr|d}ndS)Nrrr)r#�brrr	�ireturn_example�s

r=)r%rcCsBtdd�}yd}x||}|d7}qWWntk
r<YnXdS)Nrr!r)r"�
IndexError)�items�ir<rrr	�tightloop_example�s
rA)rr0)�r)rBrcCs:tdd�}yd}x||}qWWntk
r4YnXdS)Nrr&r)r"r>)r?r@rrr	�tighterloop_example�s
rC)r&r0ccsz
dVWdXdS)NTrrrrr	�generator_function�srDcCs$tt��}xtd�D]}|}qWdS)N�
)�anyrDr")rr'rrr	�generator_example�s
rG)i����r)���r)���r)rIr)rIr)rIr0)���r)rJrrEc@s.eZdZd
dd�Zdd�Zdd�Zdd	�ZdS)�TracerNcCs||_||_g|_dS)N)�trace_line_events�trace_opcode_events�events)rrLrMrrr	r
szTracer.__init__cCs(|jdk	r|j|_|jdk	r$|j|_dS)N)rL�
f_trace_linesrM�f_trace_opcodes)r�framerrr	�_reconfigure_frames

zTracer._reconfigure_framecCs"|�|�|j�|j|f�|jS)N)rRrNr�f_lineno�trace)rrQ�event�argrrr	rTs
zTracer.tracecCs0|�|�dd�dD�|j�|j|f�|jS)Ncss|]
}|VqdS)Nr)�.0�orrr	�	<genexpr> sz)Tracer.traceWithGenexp.<locals>.<genexpr>)r)rRrNrrSrT)rrQrUrVrrr	�traceWithGenexps
zTracer.traceWithGenexp)NN)rrrr
rRrTrZrrrr	rK
s
rKc@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�
addCleanupr1r2�gettrace)rrrr	�setUp)s
zTraceTestCase.setUpcCs|jrt��dS)N)r]r\Zenable)rrrr	�tearDown.szTraceTestCase.tearDowncCst�S)N)rKrrrr	�make_tracer2szTraceTestCase.make_tracerc
sN�fdd�|D�}||krJ|�dd�t�dd�|D�dd�|D����dS)Ncsg|]\}}|�|f�qSrr)rW�l�e)�line_offsetrr	�
<listcomp>8sz0TraceTestCase.compare_events.<locals>.<listcomp>z"events did not match expectation:
�
cSsg|]}t|��qSr)�str)rWrrrr	rf<scSsg|]}t|��qSr)rh)rWrrrr	rf=s)�fail�join�difflibZndiff)rrerN�expected_eventsr)rer	�compare_events7szTraceTestCase.compare_eventscCs<|��}t�|j�|�t�d�|�|jj|j|�dS)N)rbr1r2rTrm�__code__�co_firstlinenorN)r�funcrN�tracerrrr	�run_and_compare?s

zTraceTestCase.run_and_comparecCs|�||j�dS)N)rrrN)rrprrr	�run_testGszTraceTestCase.run_testcCs6|��}||j�t�d�|�|jj|j|j�dS)N)rbrTr1r2rmrnrorN)rrprqrrr	�	run_test2Js



zTraceTestCase.run_test2cCst�d�dS)N)r1r2)rrrr	�test_set_and_retrieve_noneQs
z(TraceTestCase.test_set_and_retrieve_nonec	Cs(dd�}t�|�zWdt�d�XdS)NcWsdS)Nr)�argsrrr	�fnVsz4TraceTestCase.test_set_and_retrieve_func.<locals>.fn)r1r2)rrwrrr	�test_set_and_retrieve_funcUs

z(TraceTestCase.test_set_and_retrieve_funccCs|�t�dS)N)rsr)rrrr	�
test_01_basic_szTraceTestCase.test_01_basiccCs|�t�dS)N)rsr)rrrr	�
test_02_arigoaszTraceTestCase.test_02_arigocCs|�t�dS)N)rsr )rrrr	�test_03_one_instrcszTraceTestCase.test_03_one_instrcCs|�t�dS)N)rsr()rrrr	�test_04_no_pop_blocksesz#TraceTestCase.test_04_no_pop_blockscCs|�t�dS)N)rsr$)rrrr	�test_05_no_pop_topsgsz!TraceTestCase.test_05_no_pop_topscCs|�t�dS)N)rsr)rrrr	�test_06_calliszTraceTestCase.test_06_callcCs|�t�dS)N)rsr/)rrrr	�
test_07_raisekszTraceTestCase.test_07_raisecCs|�t�dS)N)rtr8)rrrr	�test_08_settrace_and_returnnsz)TraceTestCase.test_08_settrace_and_returncCs|�t�dS)N)rtr;)rrrr	�test_09_settrace_and_raisepsz(TraceTestCase.test_09_settrace_and_raisecCs|�t�dS)N)rsr=)rrrr	�test_10_ireturnrszTraceTestCase.test_10_ireturncCs|�t�dS)N)rsrA)rrrr	�test_11_tightlooptszTraceTestCase.test_11_tightloopcCs|�t�dS)N)rsrC)rrrr	�test_12_tighterloopvsz!TraceTestCase.test_12_tighterloopcCsH|�t�|��}t�|j�t�t�d�|�tjj|j	tj	�dS)N)
rsrGrbr1r2rZrmrnrorN)rrqrrr	�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)rr)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)rr)rr�r�rrr	�
test_15_loops�s*zTraceTestCase.test_15_loopscCs(i}td|�|�|ddddg�dS)Nadef f():
































































































































































































































































    pass�f)rr)ir)ir)�execrr)r�	namespacerrr	�test_16_blank_lines�s
z!TraceTestCase.test_16_blank_linescCsdd�}|�|ddg�dS)NcSsdt��_d}dS)Nr)r1r3r5)�linenorrr	rp�s
z0TraceTestCase.test_17_none_f_trace.<locals>.func)rr)rr)rr)rrprrr	�test_17_none_f_trace�sz"TraceTestCase.test_17_none_f_traceN)rrrr`ra�staticmethodrbrmrrrsrtrurxryrzr{r|r}r~rr�r�r�r�r�r�r�r�r�r�rrrr	r[%s4

	r[cs(eZdZ�fdd�Zedd��Z�ZS)�SkipLineEventsTraceTestCasecs"dd�|D�}t��|||�dS)NcSsg|]}|ddkr|�qS)rrr)rWrdrrr	rf�sz>SkipLineEventsTraceTestCase.compare_events.<locals>.<listcomp>)�superrm)rrerNrlZskip_line_events)�	__class__rr	rm�sz*SkipLineEventsTraceTestCase.compare_eventscCs
tdd�S)NF)rL)rKrrrr	rb�sz'SkipLineEventsTraceTestCase.make_tracer)rrrrmr�rb�
__classcell__rr)r�r	r��sr�cs(eZdZ�fdd�Zedd��Z�ZS)�TraceOpcodesTestCasecsFdd�|D�}t|�dkr2|jt|�t|�dd�t��|||�dS)NcSsg|]}|ddkr|�qS)rZopcoder)rWrdrrr	rf�sz7TraceOpcodesTestCase.compare_events.<locals>.<listcomp>rz)No 'opcode' events received by the tracer)�msg)�lenZ
assertLessr�rm)rrerNrlZskip_opcode_events)r�rr	rm�s
z#TraceOpcodesTestCase.compare_eventscCs
tdd�S)NT)rM)rKrrrr	rb�sz TraceOpcodesTestCase.make_tracer)rrrrmr�rbr�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^r1r2r_)rrrr	r`�szRaisingTraceFuncTestCase.setUpcCs||jkrt�n|jSdS)N)�raiseOnEvent�
ValueErrorrT)rrQrUrVrrr	rT�s
zRaisingTraceFuncTestCase.tracecCs |jdkrd}d|}ndSdS)Nr0rr)r�)rrr'rrr	r��s

zRaisingTraceFuncTestCase.fc	Cs�||_yVxPtt��d�D]<}t�|j�y|��Wntk
rJYqX|�d�qWWnt	k
rz|�d�YnXdS)Nrzexception not raised!zrecursion counter not reset)
r�r"r1�getrecursionlimitr2rTr�r�rir9)rrUr@rrr	�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)Nr0)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)r@rrr	r�sz4RaisingTraceFuncTestCase.test_trash_stack.<locals>.fcs&|dkr"|j�jjdkr"td���S)Nrrz
i am crashing)rSrnror9)rQZwhyZextra)r��grr	r�sz4RaisingTraceFuncTestCase.test_trash_stack.<locals>.grzexception not propagated)r1r2r9r\Zcollectri)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)Nr0)ZassertIsInstancer,)rQrUrV�typer0rT)r�rrr	r�*s
z<RaisingTraceFuncTestCase.test_exception_arguments.<locals>.g)r1r_r2�AttributeError)rr�Zexistingr)r�rr	�test_exception_arguments%s


z1RaisingTraceFuncTestCase.test_exception_argumentsN)
rrrr`rTr�r�r�r�r�r�r�r�rrrr	r��s	r�c@seZdZddd�Zdd�ZdS)	�
JumpTracerrFcCs6|j|_||_||_||_|r"dn|jj|_d|_dS)NF)rn�code�jumpFrom�jumpTorUro�	firstLine�done)rZfunctionr�r�rU�	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�rSrUr�r4r��	TypeErrorrT)rrQrUrVr�rrr	rTLs"
zJumpTracer.traceN)rF)rrrr
rTrrrr	r�@s
r�c
CsHy|�d�Wn4tk
rB}z|�dt|�k�Wdd}~XYnXdS)NrZinteger)rr�rh)rrdrrr	�no_jump_to_non_integersfsr�c
CsTyt��j}|j|_Wn0tk
rF}zdt|�kr6�Wdd}~XYn
Xtd��dS)NrTz'Trace-function-less jump failed to fail)r1r3r4rSr�rh�AssertionError)Zprevious_framerdrrr	�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^r1r2r_)rrrr	r`}szJumpTestCase.setUpcCs.||kr*|�dt|�ddt|��dS)NzOutputs don't match:
Expected: rgz
Received: )ri�repr)r�expectedZreceivedrrr	�compare_jump_output�sz JumpTestCase.compare_jump_outputNrFc
	Csjt|||||�}t�|j�g}	|dkr2||	�n|j|��||	�WdQRXt�d�|�||	�dS)N)r�r1r2rT�assertRaisesRegexr�)
rrpr�r�r��errorrUr�rqrrrr	rs�s

zJumpTestCase.run_testc
	Csvt|||||�}t�|j�g}	|dkr8t�||	��n$|j|��t�||	��WdQRXt�d�|�||	�dS)N)r�r1r2rT�asyncio�runr�r�)
rrpr�r�r�r�rUr�rqrrrr	�run_async_test�s
zJumpTestCase.run_async_testcs�����fdd�}|S)Ncs"t��������fdd��}|S)Nc	s|j������dd�dS)NT)r�rUr�)rs)r)r�rUr�rpr�r�rr	�test�sz7JumpTestCase.jump_test.<locals>.decorator.<locals>.test)r)rpr�)r�rUr�r�r�)rpr	�	decorator�sz)JumpTestCase.jump_test.<locals>.decoratorr)r�r�r�r�rUr�r)r�rUr�r�r�r	�	jump_test�szJumpTestCase.jump_testcs�����fdd�}|S)Ncs"t��������fdd��}|S)Nc	s|j������dd�dS)NT)r�rUr�)r�)r)r�rUr�rpr�r�rr	r��sz=JumpTestCase.async_jump_test.<locals>.decorator.<locals>.test)r)rpr�)r�rUr�r�r�)rpr	r��sz/JumpTestCase.async_jump_test.<locals>.decoratorr)r�r�r�r�rUr�r)r�rUr�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_backwardsrcCs>x.dD]&}|�d�xdD]}|�d�qWqW|�d�dS)N)rrr)r!r&r)r)rr@�jrrr	�test_jump_out_of_block_forwards�s



z,JumpTestCase.test_jump_out_of_block_forwardsr%rBcCsR|�d�x8dD]0}|�d�xdD]}|�d�q$W|�d�qW|�d�dS)Nr)rr!)rrr%rB)r)rr@r�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)rr@rrr	�)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&rr%)rrr�)rr@rrr	�*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%rBr�)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�rEr��)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&rrBr�)�ZeroDivisionErrorr�FloatingPointError)rrrr	�test_jump_between_except_blocks]s
z,JumpTestCase.test_jump_between_except_blockscCsFyddWn*|�d�|�d�|�d�YnX|�d�dS)Nrrr&rr%rB)r)rrrr	�test_jump_within_except_blockhs

z*JumpTestCase.test_jump_within_except_blockrIc	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&rr%)rr)rr@rrr	�,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&rr%)rr)rr@rrr	�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&rr%)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&rr%)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&rr%rB)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&rr%rB)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!)rrrr�rEr�r�)r)rr@r��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_blockrE�
c	Cs`|�d�xF|�d�z|�d�|s(P|�d�Wd|�d�X|�d�PqW|�d�dS)Nrr!rr�rEr�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%rBr�)r)rr@rrr	�$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%rBr�)rrr�)rr@rrr	�*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�)rrdrrr	�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�r9)rrdrrr	�test_no_jump_to_except_40s

z%JumpTestCase.test_no_jump_to_except_4ZintocCs&|�d�xdD]}|�d�qWdS)Nr)rrr!)r)rr@rrr	�$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�)rr@rrr	�*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)rr@rrr	�%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)rr@rrr	�+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)rr@rrr	�&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)rr@rrr	�'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_blockrJc	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&rrBr�)r�rr�)rrdrrr	�$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!rr%rB)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%rBr�)r)rr@rrr	�'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%rBr�)rrr�)rr@rrr	�-test_no_jump_into_async_for_block_before_else�s
$

z:JumpTestCase.test_no_jump_into_async_for_block_before_elsecCs|�tdddg�dS)NrZSpamT)rsr�)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�rs)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)rrrrnr)r�rr	�
fake_functionsrrrrr!r&)�compiler�r1r2rTr�r�)rrrqr�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)rUr�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_eventr0cCs|�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)Trrrr`r�rsr�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�r�rrrrrrrrr	r
rrr
rrrrrrrrrrrrr	r�|s�



$
 	  		
		 	 	

 
  	
 
   	r��__main__),r�rZunittestr1rkr\�	functoolsrr�rrrrrNrr r$r(r)rr-r/r7r8r:r;r=rArCrDrGrKZTestCaser[r�Zcpython_onlyr�r�r�r�r�r�r�mainrrrr	�<module>s
	" `&7