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_settrace.cpython-38.pyc
U

>��gW��@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
ddddge_
dd�Zdd
dddge_
dd �Zdd
ddd!ddddd"g
e_
d#d$�Zdd
ddd%ge_
d&d'�Zd(d)�Zdd
d*d+d,dge_
d-d.�Zd/d0�Zdd
dd*d+d1d,d2ddd%ge_
d3d4�Zd5d6�Zdge_
d7d8�Zd9d:�Zd2ddd%ge_
d;d<�Zdd
dddd!d=ge_
d>d?�Zdd
ddddddd@d!ddge_
dAdB�Zdd
dddddddCdd!d=ge_
dDdE�ZdFdG�Z dddHdIdJdKdLdMdNdOg
dd!gdPddge _
GdQdR�dR�Z!GdSdT�dTej"�Z#GdUdV�dVe#�Z$ej%GdWdX�dXe#��Z&GdYdZ�dZej"�Z'Gd[d\�d\�Z(d]d^�Z)d_d`�Z*Gdadb�dbej"�Z+e,dck�r�e�-�dS)d�)�supportN��wrapsc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�tracecontextz/Context manager that traces its enter and exit.cCs||_||_dS�N��output�value��selfrr	�r�5/opt/cppython/lib/python3.8/test/test_sys_settrace.py�__init__sztracecontext.__init__cCs|j�|j�dSr�r�appendr	�rrrr
�	__enter__sztracecontext.__enter__cGs|j�|j�dSrr�r�exc_inforrr
�__exit__sztracecontext.__exit__N)�__name__�
__module__�__qualname__�__doc__rrrrrrr
rsrc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�asynctracecontextz>Asynchronous context manager that traces its aenter and aexit.cCs||_||_dSrrr
rrr
rszasynctracecontext.__init__c�s|j�|j�dSrrrrrr
�
__aenter__szasynctracecontext.__aenter__c�s|j�|j�dSrrrrrr
�	__aexit__!szasynctracecontext.__aexit__N)rrrrrrrrrrr
rsrcCs|D]
}|VqdS)z0Convert an iterable to an asynchronous iterator.Nr)�iterable�xrrr
�	asynciter$srcCsdS�N�rrrrr
�basic+sr"�r�call�r!�line�r!�returncCsd}~d}dSr r�rrrr
�arigo_example0;sr*��r&)�r&)r-r(cCsd}~d}dSr rr)rrr
�arigo_example1Hsr.cCsd}~d}dSr rr)rrr
�arigo_example2Usr/��r&)�r&)r2r(cCsd}~d}dSr rr)rrr
�one_instr_linegsr3��r&�r5r(cCs$d}td�D]}|rd}qd}qdS�Nr!r,��range)r�arrr
�no_pop_topsrs
r;)�r&)r,r(cCsd}|stqd}dSr )Zbla)�yrrrr
�
no_pop_blocks�sr>)r1r(cCsd}dSr rr)rrr
�called�sr?cCs
t�dSr)r?rrrr
r$�sr$)���r$)���r&)rAr(cCst�dSr)�	Exceptionrrrr
�raises�srCc
Cs6z
t�Wn&tk
r0}zd}W5d}~XYnXdSr )rCrB)�excrrrr
�
test_raise�s
rE)rA�	exception)r,rFcCst�|�|t��j_dSr)�sys�settrace�	_getframe�f_back�f_trace��	tracefuncrrr
�_settrace_and_return�s
rNcCst|�dSr)rNrLrrr
�settrace_and_return�srOcCst�|�|t��j_t�dSr)rGrHrIrJrK�RuntimeErrorrLrrr
�_settrace_and_raise�s
rQc
Cs4zt|�Wn"tk
r.}zW5d}~XYnXdSr)rQrP)rMrDrrr
�settrace_and_raise�srRcCsd}d}||kr|d}ndS)Nr-r!r)r:�brrr
�ireturn_example�s

rT)r<r(cCs>tdd�}zd}||}|d7}qWntk
r8YnXdS)Nrr5r!�r9�
IndexError)�items�irSrrr
�tightloop_example�s
rY)r-rFcCs6tdd�}zd}||}qWntk
r0YnXdS)Nr!r1rrU)rWrXrrr
�tighterloop_example�s
rZ)r1rFccsz
dVW5XdS)NTrrrrr
�generator_functionsr[cCs tt��}td�D]}|}qdS)N�
)�anyr[r9)rr=rrr
�generator_examples
r^)i����r$)���r&)���r&)r`r()r`r$)r`rF)���r&)rar(r\c@s.eZdZd
dd�Zdd�Zdd�Zdd	�ZdS)�TracerNcCs||_||_g|_dSr)�trace_line_events�trace_opcode_events�events)rrcrdrrr
r+szTracer.__init__cCs(|jdk	r|j|_|jdk	r$|j|_dSr)rc�
f_trace_linesrd�f_trace_opcodes)r�framerrr
�_reconfigure_frame0s

zTracer._reconfigure_framecCs"|�|�|j�|j|f�|jSr�rirer�f_lineno�trace�rrh�event�argrrr
rl6s
zTracer.tracecCs0|�|�dd�dD�|j�|j|f�|jS)Ncss|]
}|VqdSrr)�.0�orrr
�	<genexpr>=sz)Tracer.traceWithGenexp.<locals>.<genexpr>�r!rjrmrrr
�traceWithGenexp;s
zTracer.traceWithGenexp)NN)rrrrrirlrtrrrr
rb*s
rbc@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�Zd5d6�Zd7d8�Zd9S):�
TraceTestCasecCs(t��|_t��|�tjt���dSr)�gc�	isenabled�using_gc�disable�
addCleanuprGrH�gettracerrrr
�setUpFs
zTraceTestCase.setUpcCs|jrt��dSr)rxrv�enablerrrr
�tearDownKszTraceTestCase.tearDowncCst�S)z@Helper to allow test subclasses to configure tracers differently�rbrrrr
�make_tracerOszTraceTestCase.make_tracerc
sN�fdd�|D�}||krJ|�dd�t�dd�|D�dd�|D����dS)Ncsg|]\}}|�|f�qSrr)rp�l�e��line_offsetrr
�
<listcomp>Usz0TraceTestCase.compare_events.<locals>.<listcomp>z"events did not match expectation:
�
cSsg|]}t|��qSr��str�rprrrr
r�YscSsg|]}t|��qSrr�r�rrr
r�Zs)�fail�join�difflibZndiff)rr�re�expected_eventsrr�r
�compare_eventsTs���zTraceTestCase.compare_eventscCs<|��}t�|j�|�t�d�|�|jj|j|�dSr)r�rGrHrlr��__code__�co_firstlinenore)r�funcre�tracerrrr
�run_and_compare\s

�zTraceTestCase.run_and_comparecCs|�||j�dSr)r�re�rr�rrr
�run_testdszTraceTestCase.run_testcCs6|��}||j�t�d�|�|jj|j|j�dSr)r�rlrGrHr�r�r�re)rr�r�rrr
�	run_test2gs


�zTraceTestCase.run_test2cCst�d�t��dkst�dSr�rGrHr{�AssertionErrorrrrr
�test_set_and_retrieve_nonens
z(TraceTestCase.test_set_and_retrieve_nonec	Cs8dd�}t�|�zt��|ks$t�W5t�d�XdS)NcWsdSrr)�argsrrr
�fnssz4TraceTestCase.test_set_and_retrieve_func.<locals>.fnr�)rr�rrr
�test_set_and_retrieve_funcrs

z(TraceTestCase.test_set_and_retrieve_funccCs|�t�dSr)r�r"rrrr
�
test_01_basic|szTraceTestCase.test_01_basiccCs|�t�dSr)r�r*rrrr
�test_02_arigo0~szTraceTestCase.test_02_arigo0cCs|�t�dSr)r�r.rrrr
�test_02_arigo1�szTraceTestCase.test_02_arigo1cCs|�t�dSr)r�r/rrrr
�test_02_arigo2�szTraceTestCase.test_02_arigo2cCs|�t�dSr)r�r3rrrr
�test_03_one_instr�szTraceTestCase.test_03_one_instrcCs|�t�dSr)r�r>rrrr
�test_04_no_pop_blocks�sz#TraceTestCase.test_04_no_pop_blockscCs|�t�dSr)r�r;rrrr
�test_05_no_pop_tops�sz!TraceTestCase.test_05_no_pop_topscCs|�t�dSr)r�r$rrrr
�test_06_call�szTraceTestCase.test_06_callcCs|�t�dSr)r�rErrrr
�
test_07_raise�szTraceTestCase.test_07_raisecCs|�t�dSr)r�rOrrrr
�test_08_settrace_and_return�sz)TraceTestCase.test_08_settrace_and_returncCs|�t�dSr)r�rRrrrr
�test_09_settrace_and_raise�sz(TraceTestCase.test_09_settrace_and_raisecCs|�t�dSr)r�rTrrrr
�test_10_ireturn�szTraceTestCase.test_10_ireturncCs|�t�dSr)r�rYrrrr
�test_11_tightloop�szTraceTestCase.test_11_tightloopcCs|�t�dSr)r�rZrrrr
�test_12_tighterloop�sz!TraceTestCase.test_12_tighterloopcCsH|�t�|��}t�|j�t�t�d�|�tjj|j	tj	�dSr)
r�r^r�rGrHrtr�r�r�re)rr�rrr
�test_13_genexp�s


�zTraceTestCase.test_13_genexpcCs dd�}|�|ddddg�dS)NcSsd}dS)NFrrr)rrr
�onliners�sz2TraceTestCase.test_14_onliner_if.<locals>.onlinersr#r%r4r6�r�)rr�rrr
�test_14_onliner_if�s��z TraceTestCase.test_14_onliner_ifcCsJdd�}|�|dddddddg�dd�}|�|ddd	d
d	d
d	dg�dS)NcSstd�D]}qdS�Nr,r8r)rrr
�for_example�sz0TraceTestCase.test_15_loops.<locals>.for_exampler#r%r+r'cSsd}|dkr|d8}qdS)Nr,rr!rr)rrr
�
while_example�sz2TraceTestCase.test_15_loops.<locals>.while_exampler4r0r6r�)rr�r�rrr
�
test_15_loops�s2��
��zTraceTestCase.test_15_loopscCs(i}td|�|�|ddddg�dS)Nadef f():
































































































































































































































































    pass�fr#)�r&)r�r()�execr�)r�	namespacerrr
�test_16_blank_lines�s
��z!TraceTestCase.test_16_blank_linescCsdd�}|�|ddg�dS)NcSsdt��_d}dSr�)rGrIrK)�linenorrr
r��s
z0TraceTestCase.test_17_none_f_trace.<locals>.funcr#r%r�r�rrr
�test_17_none_f_trace�s��z"TraceTestCase.test_17_none_f_traceN) rrrr|r~�staticmethodr�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
ruBs:


	rucs,eZdZdZ�fdd�Zedd��Z�ZS)�SkipLineEventsTraceTestCasez8Repeat the trace tests, but with per-line events skippedcs"dd�|D�}t��|||�dS)NcSsg|]}|ddkr|�qSr%r�rpr�rrr
r��sz>SkipLineEventsTraceTestCase.compare_events.<locals>.<listcomp>)�superr�)rr�rer�Zskip_line_events��	__class__rr
r��sz*SkipLineEventsTraceTestCase.compare_eventscCs
tdd�S)NF)rcrrrrr
r��sz'SkipLineEventsTraceTestCase.make_tracer�rrrrr�r�r��
__classcell__rr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)r!Zopcoderr�rrr
r��sz7TraceOpcodesTestCase.compare_events.<locals>.<listcomp>r!z)No 'opcode' events received by the tracer)�msg)�lenZ
assertLessr�r�)rr�rer�Zskip_opcode_eventsr�rr
r��s�z#TraceOpcodesTestCase.compare_eventscCs
tdd�S)NT)rdrrrrr
r��sz TraceOpcodesTestCase.make_tracerr�rr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���dSr�rzrGrHr{rrrr
r|szRaisingTraceFuncTestCase.setUpcCs||jkrt�n|jSdS)zXA trace function that raises an exception in response to a
        specific trace event.N)�raiseOnEvent�
ValueErrorrlrmrrr
rls
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.rFrr!N)r�)rrr=rrr
r�
s

zRaisingTraceFuncTestCase.fc	Cs|||_zRtt��d�D]<}t�|j�z|��Wntk
rHYqX|�d�qWnt	k
rv|�d�YnXdS)zTTests that an exception raised in response to the given event is
        handled OK.r!zexception not raised!zrecursion counter not resetN)
r�r9rG�getrecursionlimitrHrlr�r�r�rP)rrnrXrrr
�run_test_for_eventsz+RaisingTraceFuncTestCase.run_test_for_eventcCs|�d�dS)Nr$�r�rrrr
�	test_call'sz"RaisingTraceFuncTestCase.test_callcCs|�d�dS)Nr&r�rrrr
�	test_line)sz"RaisingTraceFuncTestCase.test_linecCs|�d�dS)Nr(r�rrrr
�test_return+sz$RaisingTraceFuncTestCase.test_returncCs|�d�dS�NrFr�rrrr
�test_exception-sz'RaisingTraceFuncTestCase.test_exceptioncs^dd����fdd��t���z
��Wn$tk
rNddl}|��YnX|�d�dS)NcSstd�D]}t|�qdS)Nr-)r9�print)rXrrr
r�1sz4RaisingTraceFuncTestCase.test_trash_stack.<locals>.fcs&|dkr"|j�jjdkr"td���S)Nr&r,z
i am crashing)rkr�r�rP)rh�why�extra�r��grr
r�5s
�z4RaisingTraceFuncTestCase.test_trash_stack.<locals>.grzexception not propagated)rGrHrPrvZcollectr�)rrvrr�r
�test_trash_stack0s

z)RaisingTraceFuncTestCase.test_trash_stackc	s^dd�}��fdd��t��}z.t���z
|�Wntk
rHYnXW5t�|�XdS)NcSsd}|jdS)Nr)Zno_such_attrr)rrr
r�Gsz<RaisingTraceFuncTestCase.test_exception_arguments.<locals>.fcs"|dkr|\}}}��|t��Sr�)ZassertIsInstancerB)rhrnro�typerFrl�r�rrr
r�Ks
z<RaisingTraceFuncTestCase.test_exception_arguments.<locals>.g)rGr{rH�AttributeError)rr�Zexistingrr�r
�test_exception_argumentsFs


z1RaisingTraceFuncTestCase.test_exception_argumentsN)
rrrr|rlr�r�r�r�r�r�r�r�rrrr
r�s	r�c@s"eZdZdZd	dd�Zdd�ZdS)
�
JumpTracerz>Defines a trace function that jumps from one place to another.r&FcCs6|j|_||_||_||_|r"dn|jj|_d|_dS)NF)r��code�jumpFrom�jumpTornr��	firstLine�done)r�functionr�r�rn�	decoratedrrr
rdszJumpTracer.__init__cCs�|jr
dS|jdkr4|j|jkr4|dkr4|jd|_||jkr�|jr�|j|j|jkr�|}|dk	rv|j|jkrv|j}qZ|dk	r�z|j|j|_Wnt	k
r�|j|_YnXd|_|j
S)Nr&r!T)r�r��f_coder�rkrnr�rJr��	TypeErrorrl)rrhrnror�rrr
rlms&��zJumpTracer.traceN)r&F)rrrrrrlrrrr
r�as
�
	r�c
CsHz|�d�Wn4tk
rB}z|�dt|�k�W5d}~XYnXdS)Nr,Zinteger)rr�r��rr�rrr
�no_jump_to_non_integers�sr�c
CsTzt��j}|j|_Wn0tk
rF}zdt|�kr6�W5d}~XYn
Xtd��dS)Nrlz'Trace-function-less jump failed to fail)rGrIrJrkr�r�r�)Zprevious_framer�rrr
�no_jump_without_trace_function�s
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/��Zedd-ddd0g�d1d2��Zeddddg�d3d4��Zeddddg�d5d6��Zeddddddg�d7d8��Zeddddg�d9d:��Zeddddg�d;d<��Zedddddddd=g�d>d?��Zedddddddd=g�d@dA��Zedddg�dBdC��Zeddddddg�dDdE��Zedddg�dFdG��Zedddddg�dHdI��Z edddddJg�dKdL��Z!edddddg�dMdN��Z"eddddddOg�dPdQ��Z#eddddddOg�dRdS��Z$eddddddg�dTdU��Z%eddddddg�dVdW��Z&eddddddd=dg�dXdY��Z'eddddddd=dg�dZd[��Z(eddddddg�d\d]��Z)eddddddg�d^d_��Z*edJd-dddd-d0g�d`da��Z+edddddg�dbdc��Z,edddddg�ddde��Z-edddddJd'g�dfdg��Z.eddJdddJdhd-dig�djdk��Z/eddddJg�dldm��Z0eddddJg�dndo��Z1edddge2dpf�dqdr��Z3edd=dge2dsf�dtdu��Z4edddge2dvf�dwdx��Z5edddge2dvf�dydz��Z6edddge2dvf�d{d|��Z7edddge2dvf�d}d~��Z8eddge2df�d�d���Z9eddge2df�d�d���Z:eddddge2df�d�d���Z;eddddge2df�d�d���Z<eddge2df�d�d���Z=eddge2df�d�d���Z>eddddd�ge2df�d�d���Z?eddddd�ge2df�d�d���Z@eddge2df�d�d���ZAeddddge2df�d�d���ZBeddge2df�d�d���ZCedddge2df�d�d���ZDedddge2df�d�d���ZEeddge2d�f�d�d���ZFedddddge2d�f�d�d���ZGeddddge2d�f�d�d���ZHeddge2d�f�d�d���ZIeddge2d�f�d�d���ZJedddddge2d�f�d�d���ZKedddge2d�f�d�d���ZLedddddge2d�f�d�d���ZMedddddge2d�f�d�d���ZNeddddd=ge2df�d�d���ZOeddddd=ge2df�d�d���ZPeddddge2d�f�d�d���ZQeddddge2df�d�d���ZReddddge2df�d�d���ZSd�d��ZTd�d��ZUd�d��ZVd�dÄZWedddgd�e2d�fdƍd�dȄ�ZXedddgd�e2d�fdƍd�d̄�ZYedddgd�e2d�fdƍd�dτ�ZZedddgd�e2d�fdƍd�d҄�Z[dS)��JumpTestCasecCs |�tjt���t�d�dSrr�rrrr
r|�szJumpTestCase.setUpcCs.||kr*|�dt|�ddt|��dS)NzOutputs don't match:
Expected: r�z
Received: )r��repr)r�expectedZreceivedrrr
�compare_jump_output�s����z JumpTestCase.compare_jump_outputNr&Fc
	Csjt|||||�}t�|j�g}	|dkr2||	�n|j|��||	�W5QRXt�d�|�||	�dSr)r�rGrHrl�assertRaisesRegexr��
rr�r�r�r��errorrnr�r�rrrr
r��s

zJumpTestCase.run_testc
	Cs�t|||||�}t�|j�g}	|dkr8t�||	��n$|j|��t�||	��W5QRXt�d�t�d�|�||	�dSr)	r�rGrHrl�asyncio�runr�Zset_event_loop_policyr�r�rrr
�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�rnr�)r�r�r�rnr�r�r�r�rr
�test�s
�z7JumpTestCase.jump_test.<locals>.decorator.<locals>.testr�r�r��r�rnr�r�r��r�r
�	decorator�sz)JumpTestCase.jump_test.<locals>.decoratorr�r�r�r�r�rnr�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�dSr�)r�rr�rr
r��s
�z=JumpTestCase.async_jump_test.<locals>.decorator.<locals>.testrr�r�r�r
r��sz/JumpTestCase.async_jump_test.<locals>.decoratorrr�rr�r
�async_jump_test�szJumpTestCase.async_jump_testr!r5cCs"|�d�|�d�|�d�dS�Nr!r,r5�r�rrrr
�test_jump_simple_forwards�s

z&JumpTestCase.test_jump_simple_forwardsr,cCs|�d�|�d�dSr7r�r�rrr
�test_jump_simple_backwards�s
z'JumpTestCase.test_jump_simple_backwardsr-cCs6dD]"}|�d�dD]}|�d�qq|�d�dS)N�r!r,r,�r5r1r-r��rrX�jrrr
�test_jump_out_of_block_forwards�s

z,JumpTestCase.test_jump_out_of_block_forwardsr<r2cCsJ|�d�dD],}|�d�dD]}|�d�q |�d�q|�d�dS)Nr!rsr5)r,r-r<r2r�rrrr
� test_jump_out_of_block_backwards�s

z-JumpTestCase.test_jump_out_of_block_backwardsr1c�sHdD]>}tddg�2z 3dHW}|�d�|�d�q6|�d�qdS)Nrsr!r,r5r1r-�rr�rrXrrr
�)test_jump_out_of_async_for_block_forwards�s

z6JumpTestCase.test_jump_out_of_async_for_block_forwardsc�sPdD]F}|�d�tdg�2z 3dHW}|�d�|�d�q6|�d�qdS)Nrsr,r!r1r-r<�rrrrrr
�*test_jump_out_of_async_for_block_backwardss

z7JumpTestCase.test_jump_out_of_async_for_block_backwardscCs|�d�|�d�dS)Nr!r5r�r�rrr
�test_jump_to_codeless_lines
z'JumpTestCase.test_jump_to_codeless_linecCs"|�d�|�d�|�d�dSr�r�r�rrr
�test_jump_to_same_lines

z#JumpTestCase.test_jump_to_same_line�	cCsFz|�d�W5|�d�z|�d�W5|�d�X|�d�XdS)Nr1�r<rr,r�r�rrr
�test_jump_in_nested_finallys
z(JumpTestCase.test_jump_in_nested_finally�c	Cs@z|�d�ddW�dS|�d�|�d�X|�d�dS)Nr<r2r,r!rrr�r�rrr
�test_jump_in_nested_finally_2$s

z*JumpTestCase.test_jump_in_nested_finally_2�cCs\z|�d�ddW�dS|�d�z|�d�W5|�d�X|�d�X|�d�dS)	Nr<r\rrr,r!r�r�r�rrr
�test_jump_in_nested_finally_3/s

z*JumpTestCase.test_jump_in_nested_finally_3rc
Cs\dz|�d�W5|�d�|�d��dSz|�d�W5|�d�XX|�d�dS)Nr1r-r\rr,rr�r�rrr
�2test_jump_over_return_try_finally_in_finally_block>s

z?JumpTestCase.test_jump_over_return_try_finally_in_finally_blockcCs$|�d�|�d�q
|�d�dS)Nr!r5r1r�r�rrr
�test_jump_infinite_while_loopMs
z*JumpTestCase.test_jump_infinite_while_loopcCs.d}|�d�|dkr*|�d�|d7}qdS)Nr!r,r1r�rrrr
�#test_jump_forwards_into_while_blockTs


z0JumpTestCase.test_jump_forwards_into_while_blockcCs.d}|dkr |�d�|d7}q|�d�dS)Nr!r,r5r-r�rrrr
�$test_jump_backwards_into_while_block\s


z1JumpTestCase.test_jump_backwards_into_while_blockc	Cs.t|d��|�d�W5QRX|�d�dSr��rrr�rrr
�$test_jump_forwards_out_of_with_blockdsz1JumpTestCase.test_jump_forwards_out_of_with_blockc
�s<t|d�4IdH�|�d�W5QIdHRX|�d�dSr��rrr�rrr
�*test_jump_forwards_out_of_async_with_blockjsz7JumpTestCase.test_jump_forwards_out_of_async_with_blockrAc	Cs.|�d�t|d��|�d�W5QRXdSr��rrr�rrr
�%test_jump_backwards_out_of_with_blockps
z2JumpTestCase.test_jump_backwards_out_of_with_blockc
�s<|�d�t|d�4IdH�|�d�W5QIdHRXdSr��rrr�rrr
�+test_jump_backwards_out_of_async_with_blockvs
z8JumpTestCase.test_jump_backwards_out_of_async_with_blockc	Cs*z|�d�W5|�d�X|�d�dS�Nr1r,r-r�r�rrr
�+test_jump_forwards_out_of_try_finally_block|sz8JumpTestCase.test_jump_forwards_out_of_try_finally_blockc	Cs*|�d�z|�d�W5|�d�XdS�Nr!r-r5r�r�rrr
�,test_jump_backwards_out_of_try_finally_block�s
z9JumpTestCase.test_jump_backwards_out_of_try_finally_blockcCs6z|�d�Wn|�d��YnX|�d�dS�Nr,r1r<r�r�rrr
�*test_jump_forwards_out_of_try_except_block�s
z7JumpTestCase.test_jump_forwards_out_of_try_except_blockcCs6|�d�z|�d�Wn|�d��YnXdS�Nr!r5r-r�r�rrr
�+test_jump_backwards_out_of_try_except_block�s

z8JumpTestCase.test_jump_backwards_out_of_try_except_blockrcCs`zddWnDtk
r4|�d�|�d�Yntk
rP|�d�YnX|�d�dS�Nr!rr1r-r2r��ZeroDivisionErrorr�FloatingPointErrorr�rrr
�test_jump_between_except_blocks�s
z,JumpTestCase.test_jump_between_except_blockscCsFzddWn*|�d�|�d�|�d�YnX|�d�dS)Nr!rr1r-r<r2r�r�rrr
�test_jump_within_except_block�s

z*JumpTestCase.test_jump_within_except_blockr`c	CsN|�d�t|d��|�d�W5QRXt|d��|�d�W5QRXdS�Nr!r,r5r1r-rr�rrr
�test_jump_across_with�s

z"JumpTestCase.test_jump_across_withc
�sj|�d�t|d�4IdH�|�d�W5QIdHRXt|d�4IdH�|�d�W5QIdHRXdSr0r r�rrr
�test_jump_across_async_with�s

z(JumpTestCase.test_jump_across_async_withc
CsL|�d�dD].}t|d��|�d�W5QRX|�d�q|�d�dS�Nr!rsr5r1r-r<rrrrr
�,test_jump_out_of_with_block_within_for_block�s
z9JumpTestCase.test_jump_out_of_with_block_within_for_blockc�sZ|�d�dD]<}t|d�4IdH�|�d�W5QIdHRX|�d�q|�d�dSr3r rrrr
�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�W5QRX|�d�W5QRX|�d�dS�Nr!r,r5r1r-r<rr�rrr
�-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�W5QIdHRX|�d�W5QRX|�d�dSr6)rrrr�rrr
�3test_jump_out_of_async_with_block_within_with_block�s
z@JumpTestCase.test_jump_out_of_async_with_block_within_with_blockcCsJz|�d�W5t|d��|�d�W5QRX|�d�X|�d�dS�Nr1r-r<r,r2rr�rrr
�0test_jump_out_of_with_block_within_finally_block�sz=JumpTestCase.test_jump_out_of_with_block_within_finally_blockc�sXz|�d�W5t|d�4IdH�|�d�W5QIdHRX|�d�X|�d�dSr9rr�rrr
�6test_jump_out_of_async_with_block_within_finally_block�szCJumpTestCase.test_jump_out_of_async_with_block_within_finally_blockcCsp|�d�dD]R}|�d�dD]4}|�d�zdD]}|�d�q4W5|�d�Xq |�d�q|�d	�dS)
Nr!rsr5rr-r\rrrr�)rrXr�krrr
�&test_jump_out_of_complex_nested_blocks�s


z3JumpTestCase.test_jump_out_of_complex_nested_blocksc	Cs8|�d�t|d��}|�d�W5QRX|�d�dS�Nr!r,r1r-r�rrrrr
� test_jump_out_of_with_assignment
s


z-JumpTestCase.test_jump_out_of_with_assignmentc
�sF|�d�t|d�4IdH�}|�d�W5QIdHRX|�d�dSr>r r?rrr
�&test_jump_out_of_async_with_assignments

z3JumpTestCase.test_jump_out_of_async_with_assignmentc	CsJ|�d�z$|�d�|s"W�dS|�d�W5|�d�X|�d�dS)Nr!rr5r<rr�r�rrr
�*test_jump_over_return_in_try_finally_blocks

z7JumpTestCase.test_jump_over_return_in_try_finally_blockr\�
c	Cs`|�d�|�d�z"|�d�|s*W�qR|�d�W5|�d�X|�d�qRq
|�d�dS)Nr!r5r\r-rrrCr�r�rrr
�)test_jump_over_break_in_try_finally_block&s



z6JumpTestCase.test_jump_over_break_in_try_finally_blockcCsF|�d�|s$dD]}|�d�qn|�d�|�d�|�d�dS�Nr!rr1r<r2rr�rrrr
�$test_jump_over_for_block_before_else6s


z1JumpTestCase.test_jump_over_for_block_before_elsec�sV|�d�|s4tdg�2z3dHW}|�d�q6n|�d�|�d�|�d�dS�Nr!r5r1r<r2rr
rrrr
�*test_jump_over_async_for_block_before_elseAs


z7JumpTestCase.test_jump_over_async_for_block_before_elseZaftercCs|�d�|�d�dSr7r�r�rrr
�test_no_jump_too_far_forwardsNs
z*JumpTestCase.test_no_jump_too_far_forwards�beforecCs|�d�|�d�dSr7r�r�rrr
�test_no_jump_too_far_backwardsSs
z+JumpTestCase.test_no_jump_too_far_backwards�exceptcCs,z|�d�Wn|�d��YnXdS�Nr,r1r�r�rrr
�test_no_jump_to_except_1Ys

z%JumpTestCase.test_no_jump_to_except_1cCs4z|�d�Wn tk
r.|�d��YnXdSrM�rr�r�rrr
�test_no_jump_to_except_2as

z%JumpTestCase.test_no_jump_to_except_2c
CsDz|�d�Wn0tk
r>}z|�d�|�W5d}~XYnXdSrMrOr�rrr
�test_no_jump_to_except_3is

z%JumpTestCase.test_no_jump_to_except_3c
CsHz|�d�Wn4ttfk
rB}z|�d�|�W5d}~XYnXdSrM)rr�rPr�rrr
�test_no_jump_to_except_4qs

z%JumpTestCase.test_no_jump_to_except_4ZintocCs"|�d�dD]}|�d�qdS)Nr!rr5r�rrrr
�$test_no_jump_forwards_into_for_blockys
z1JumpTestCase.test_no_jump_forwards_into_for_blockc�s4|�d�tddg�2z3dHW}|�d�q6dSr�r
rrrr
�*test_no_jump_forwards_into_async_for_blocks
z7JumpTestCase.test_no_jump_forwards_into_async_for_blockcCs"dD]}|�d�q|�d�dS)Nrr,r5r�rrrr
�%test_no_jump_backwards_into_for_block�sz2JumpTestCase.test_no_jump_backwards_into_for_blockc�s4tddg�2z3dHW}|�d�q6|�d�dSr�rrrrr
�+test_no_jump_backwards_into_async_for_block�sz8JumpTestCase.test_no_jump_backwards_into_async_for_blockc	Cs.|�d�t|d��|�d�W5QRXdSr�rr�rrr
�%test_no_jump_forwards_into_with_block�s
z2JumpTestCase.test_no_jump_forwards_into_with_blockc
�s<|�d�t|d�4IdH�|�d�W5QIdHRXdSr�r r�rrr
�+test_no_jump_forwards_into_async_with_block�s
z8JumpTestCase.test_no_jump_forwards_into_async_with_blockrac	Cs.t|d��|�d�W5QRX|�d�dSr�rr�rrr
�&test_no_jump_backwards_into_with_block�sz3JumpTestCase.test_no_jump_backwards_into_with_blockc
�s<t|d�4IdH�|�d�W5QIdHRX|�d�dSr�rr�rrr
�,test_no_jump_backwards_into_async_with_block�sz9JumpTestCase.test_no_jump_backwards_into_async_with_blockc	Cs*|�d�z|�d�W5|�d�XdSr$r�r�rrr
�,test_no_jump_forwards_into_try_finally_block�s
z9JumpTestCase.test_no_jump_forwards_into_try_finally_blockc	Cs*z|�d�W5|�d�X|�d�dSr"r�r�rrr
�-test_no_jump_backwards_into_try_finally_block�sz:JumpTestCase.test_no_jump_backwards_into_try_finally_blockcCs6|�d�z|�d�Wn|�d��YnXdSr(r�r�rrr
�+test_no_jump_forwards_into_try_except_block�s

z8JumpTestCase.test_no_jump_forwards_into_try_except_blockcCs6z|�d�Wn|�d��YnX|�d�dSr&r�r�rrr
�,test_no_jump_backwards_into_try_except_block�s
z9JumpTestCase.test_no_jump_backwards_into_try_except_blockc
CsnzddWnRtk
r4|�d�|�d�Yn,tk
r^}z|�d�W5d}~XYnX|�d�dSr*r+r�rrr
�$test_no_jump_between_except_blocks_2�s
z1JumpTestCase.test_no_jump_between_except_blocks_2zinto a 'finally'c	Cs*|�d�z|�d�W5|�d�XdSr$r�r�rrr
�test_no_jump_into_finally_block�s
z,JumpTestCase.test_no_jump_into_finally_blockc	Cs>z|�d�|�d�W5|�d�|�d�X|�d�dS)Nr-r<r,r5r2r�r�rrr
�.test_no_jump_into_finally_block_from_try_block�s

z;JumpTestCase.test_no_jump_into_finally_block_from_try_blockzout of a 'finally'c	Cs*|�d�z|�d�W5|�d�XdSr$r�r�rrr
�!test_no_jump_out_of_finally_block�s
z.JumpTestCase.test_no_jump_out_of_finally_blockzinto an 'except'cCs4|�d�z|�d�Wn|�d�YnXdSr(r�r�rrr
�#test_no_jump_into_bare_except_block�s

z0JumpTestCase.test_no_jump_into_bare_except_blockcCs<|�d�z|�d�Wntk
r6|�d�YnXdSr(�rrBr�rrr
�(test_no_jump_into_qualified_except_block�s

z5JumpTestCase.test_no_jump_into_qualified_except_blockcCsJz|�d�|�d�Wn"|�d�|�d��YnX|�d�dS�Nr,r5r-r<rr�r�rrr
�2test_no_jump_into_bare_except_block_from_try_blocks


z?JumpTestCase.test_no_jump_into_bare_except_block_from_try_blockcCsRz|�d�|�d�Wn*tk
rB|�d�|�d��YnX|�d�dSrf)rr,r�rrr
�7test_no_jump_into_qualified_except_block_from_try_blocks


zDJumpTestCase.test_no_jump_into_qualified_except_block_from_try_blockzout of an 'except'cCsF|�d�z|�d�ddWn |�d�|�d�YnXdS�Nr!r5rr<r2r�r�rrr
�%test_no_jump_out_of_bare_except_blocks


z2JumpTestCase.test_no_jump_out_of_bare_except_blockcCsN|�d�z|�d�ddWn(tk
rH|�d�|�d�YnXdSrirdr�rrr
�*test_no_jump_out_of_qualified_except_block!s


z7JumpTestCase.test_no_jump_out_of_qualified_except_blockc	CsN|�d�t|d��|�d�W5QRXt|d��|�d�W5QRXdSr0rr�rrr
� test_no_jump_between_with_blocks+s

z-JumpTestCase.test_no_jump_between_with_blocksc
�sj|�d�t|d�4IdH�|�d�W5QIdHRXt|d�4IdH�|�d�W5QIdHRXdSr0r r�rrr
�&test_no_jump_between_async_with_blocks3s

z3JumpTestCase.test_no_jump_between_async_with_blocks�finallyc
Cs<dz|�d�W5|�d�|�d��dSX|�d�)Nr1r-r,r2r�r�rrr
�-test_no_jump_over_return_out_of_finally_block;s

z:JumpTestCase.test_no_jump_over_return_out_of_finally_blockcCsF|�d�|s$dD]}|�d�qn|�d�|�d�|�d�dSrEr�rrrr
�'test_no_jump_into_for_block_before_elseEs


z4JumpTestCase.test_no_jump_into_for_block_before_elsec�sV|�d�|s4tdg�2z3dHW}|�d�q6n|�d�|�d�|�d�dSrGr
rrrr
�-test_no_jump_into_async_for_block_before_elsePs


z:JumpTestCase.test_no_jump_into_async_for_block_before_elsecCs|�tdddg�dS)Nr,ZSpamT)r�r�rrrr
�test_no_jump_to_non_integers[sz)JumpTestCase.test_no_jump_to_non_integerscCs
t�dSr)r�rrrr
�#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�r,i�r)r�r�)r�dr�rrr
�test_large_functioncs��	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)rrrr�r�r�rr
�
fake_function{srwr,rrr5r1)�compiler�rGrHrlr�r�)rrwr�r�rrvr
�test_jump_to_firstlinenoqs�

z%JumpTestCase.test_jump_to_firstlinenor$z5can't jump from the 'call' trace event of a new frame)rnr�cs*��d��fdd�}|���d�dS)Nr!cs��d�dS)Nr5r�rr�rr
�nested�sz3JumpTestCase.test_no_jump_from_call.<locals>.nestedr-r�)rrzrr�r
�test_no_jump_from_call�s
z#JumpTestCase.test_no_jump_from_callr(z'can only jump from a 'line' trace eventcCs|�d�dSr r�r�rrr
�test_no_jump_from_return_event�s
z+JumpTestCase.test_no_jump_from_return_eventrFcCs|�d�dddS)Nr!rr�r�rrr
�!test_no_jump_from_exception_event�s
z.JumpTestCase.test_no_jump_from_exception_eventz!can't jump from a yield statementcs$�fdd�}t|����d�dS)Nc3s��d�dVdS)Nr,r5r�rr�rr
�gen�s
z1JumpTestCase.test_no_jump_from_yield.<locals>.genr-)�nextr)rr~rr�r
�test_no_jump_from_yield�s
z$JumpTestCase.test_no_jump_from_yield)Nr&F)Nr&F)Nr&)Nr&)\rrrr|r�r�r�r�r�r�rrrr	rrr
rr,rrrrrrrrrr!r#r%r'r)r.r/r1r2r4r5r7r8r:r;r=r@rArBrDrFrHr�rIrKrNrPrQrRrSrTrUrVrWrXrYrZr[r\r]r^r_r`rarbrcrergrhrjrkrlrmrorprqrrrsruryr{r|r}r�rrrr
r��s`�

�






	






















	






	
	

























	



	







	
	


	




�
�
�r��__main__).r�rZunittestrGr�rv�	functoolsrr�rrrr"rer*r.r/r3r;r>r?r$rCrErNrOrQrRrTrYrZr[r^rbZTestCaserur�Zcpython_onlyr�r�r�r�r�r�r�mainrrrr
�<module>sP�
��	�	������
�		�
�
�

��$`&


F1le Man4ger