Your IP : 216.73.216.60


Current Path : /opt/alt/python39/lib64/python3.9/test/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/test/__pycache__/test_sys_settrace.cpython-39.opt-2.pyc

a

XC?h���@sJddlmZddlZddlZddlZddlZddlmZddlZGdd�d�Z	Gdd�d�Z
dd	�Zd
d�Zgd�e_
d
d�Zgd�e_
dd�Zgd�e_
dd�Zgd�e_
dd�Zgd�e_
dd�Zgd�e_
dd�Zgd�e_
dd�Zd d!�Zgd"�e_
d#d$�Zd%d&�Zgd'�e_
d(d)�Zd*d+�Zd,ge_
d-d.�Zd/d0�Zgd1�e_
d2d3�Zgd4�e_
d5d6�Zgd7�e_
d8d9�Zgd:�e_
d;d<�Zd=d>�Z gd?�d@dAgdBd@dCge _
GdDdE�dE�Z!GdFdG�dGej"�Z#GdHdI�dIe#�Z$ej%GdJdK�dKe#��Z&GdLdM�dMej"�Z'GdNdO�dO�Z(dPdQ�Z)dRdS�Z*GdTdU�dUej"�Z+e,dVk�rFe�-�dS)W�)�supportN��wrapsc@s$eZdZdd�Zdd�Zdd�ZdS)�tracecontextcCs||_||_dS�N��output�value��selfrr	�r�;/opt/alt/python39/lib64/python3.9/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__rrrrrrr
rsrc@s$eZdZdd�Zdd�Zdd�ZdS)�asynctracecontextcCs||_||_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)rrrrrrrrrr
rsrcCs|D]
}|VqdSrr)�iterable�xrrr
�	asynciter$srcCsdS�N�rrrrr
�basic+sr!)�r�call�r �line�r �returncCsd}~d}dSrr�rrrr
�arigo_example0;sr))r"r$��r%��r%�r-r'cCsd}~d}dSrrr(rrr
�arigo_example1Hsr/cCsd}~d}dSrrr(rrr
�arigo_example2Usr0)r"r$r*��r%��r%�r4r'cCsd}~d}dSrrr(rrr
�one_instr_linegsr6)r"r$r*��r%�r8r'cCs$d}td�D]}|rd}qd}qdS�Nr r+��range)r�arrr
�no_pop_topsrs
r>)
r"r$r*r7��r%r*r7r1r*)r+r'cCsd}|stqd}dSr)Zbla)�yrrrr
�
no_pop_blocks�srB)r"r$r*r1�r2r'cCsd}dSrrr(rrr
�called�srDcCs
t�dSr)rDrrrr
r#�sr#)r"r$����r#����r%�rHr'r&cCst�dSr��	Exceptionrrrr
�raises�srLcCs"z
t�WntyYn0dSr)rLrKrrrr
�
test_raise�s
rM)r"r$r*rErG�rH�	exceptionrI�r+rOr7r1rCcCst�|�|t��j_dSr)�sys�settrace�	_getframe�f_back�f_trace�Z	tracefuncrrr
�_settrace_and_return�s
rWcCst|�dSr)rWrVrrr
�settrace_and_return�srXr&cCst�|�|t��j_t�dSr)rQrRrSrTrU�RuntimeErrorrVrrr
�_settrace_and_raise�s
rZcCs$zt|�WntyYn0dSr)rZrYrVrrr
�settrace_and_raise�sr[)rPr7r1rCcCsd}d}||kr|d}ndS)Nr-r r)r=�brrr
�ireturn_example�s

r])r"r$r*r7r1r?�r@r'cCs<tdd�}zd}||}|d7}qWnty6Yn0dS)Nrr8r �r<�
IndexError)�items�ir\rrr
�tightloop_example�s
rc)r"r$r*r7r,r,r,r,)r-rOr?r3r5cCs4tdd�}zd}||}qWnty.Yn0dS)Nr r2rr_)rarbrrr
�tighterloop_example�s
rd)r"r$r*r7r1r1r1r1)r2rOr,r?r^ccsz
dVWn0dS)NTrrrrr
�generator_functionsrecCs tt��}td�D]}|}qdS)N�
)�anyrer<)rrArrr
�generator_examples
rh)
r"r*�i����r#����r%����r%�rmr')rmr#�rmrO)���r%)rpr'r,r?rfr.c@s.eZdZd
dd�Zdd�Zdd�Zdd	�ZdS)�TracerNcCs||_||_g|_dSr)�trace_line_events�trace_opcode_events�events)rrrrsrrr
r+szTracer.__init__cCs(|jdur|j|_|jdur$|j|_dSr)rr�
f_trace_linesrs�f_trace_opcodes)r�framerrr
�_reconfigure_frame0s

zTracer._reconfigure_framecCs"|�|�|j�|j|f�|jSr�rxrtr�f_lineno�trace�rrw�event�argrrr
r{6s
zTracer.tracecCs0|�|�dd�dD�|j�|j|f�|jS)Ncss|]
}|VqdSrr)�.0�orrr
�	<genexpr>=�z)Tracer.traceWithGenexp.<locals>.<genexpr>�r ryr|rrr
�traceWithGenexp;s
zTracer.traceWithGenexp)NN)rrrrrxr{r�rrrr
rq*s
rqc@seZdZdd�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�Zd9d:�Z d;d<�Z!d=d>�Z"d?d@�Z#dAS)B�
TraceTestCasecCs(t��|_t��|�tjt���dSr)�gcZ	isenabled�using_gcZdisable�
addCleanuprQrR�gettracerrrr
�setUpFs
zTraceTestCase.setUpcCs|jrt��dSr)r�r�Zenablerrrr
�tearDownKszTraceTestCase.tearDowncCst�Sr�rqrrrr
�make_tracerOszTraceTestCase.make_tracerc
sN�fdd�|D�}||krJ|�dd�t�dd�|D�dd�|D����dS)Ncsg|]\}}|�|f�qSrr)r�l�e��line_offsetrr
�
<listcomp>Ur�z0TraceTestCase.compare_events.<locals>.<listcomp>z"events did not match expectation:
�
cSsg|]}t|��qSr��str�rrrrr
r�Yr�cSsg|]}t|��qSrr�r�rrr
r�Zr�)�fail�join�difflibZndiff)rr�rt�expected_eventsrr�r
�compare_eventsTs���zTraceTestCase.compare_eventscCs<|��}t�|j�|�t�d�|�|jj|j|�dSr)r�rQrRr{r��__code__�co_firstlinenort)r�funcrt�tracerrrr
�run_and_compare\s

�zTraceTestCase.run_and_comparecCs|�||j�dSr)r�rt�rr�rrr
�run_testdszTraceTestCase.run_testcCs6|��}||j�t�d�|�|jj|j|j�dSr)r�r{rQrRr�r�r�rt)rr�r�rrr
�	run_test2gs


�zTraceTestCase.run_test2cCst�d�dSr�rQrRrrrr
�test_set_and_retrieve_nonens
z(TraceTestCase.test_set_and_retrieve_nonec	Cs2dd�}t�|�zWt�d�nt�d�0dS)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�r0rrrr
�test_02_arigo2�szTraceTestCase.test_02_arigo2cCs|�t�dSr)r�r6rrrr
�test_03_one_instr�szTraceTestCase.test_03_one_instrcCs|�t�dSr)r�rBrr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�rMrrrr
�
test_07_raise�szTraceTestCase.test_07_raisecCs|�t�dSr)r�rXrrrr
�test_08_settrace_and_return�sz)TraceTestCase.test_08_settrace_and_returncCs|�t�dSr)r�r[rrrr
�test_09_settrace_and_raise�sz(TraceTestCase.test_09_settrace_and_raisecCs|�t�dSr)r�r]rrrr
�test_10_ireturn�szTraceTestCase.test_10_ireturncCs|�t�dSr)r�rcrrrr
�test_11_tightloop�szTraceTestCase.test_11_tightloopcCs|�t�dSr)r�rdrrrr
�test_12_tighterloop�sz!TraceTestCase.test_12_tighterloopcCsH|�t�|��}t�|j�t�t�d�|�tjj|j	tj	�dSr)
r�rhr�rQrRr�r�r�r�rt)rr�rrr
�test_13_genexp�s


�zTraceTestCase.test_13_genexpcCsdd�}|�|gd��dS)NcSsd}dS)NFrrr(rrr
�onliners�sz2TraceTestCase.test_14_onliner_if.<locals>.onliners)r"r$r7r9�r�)rr�rrr
�test_14_onliner_if�s
�z TraceTestCase.test_14_onliner_ifcCs4dd�}|�|gd��dd�}|�|gd��dS)NcSstd�D]}qdS�Nr+r;r(rrr
�for_example�sz0TraceTestCase.test_15_loops.<locals>.for_example)r"r$r*r$r*r$r&cSsd}|dkr|d8}qdS)Nr+rr rr(rrr
�
while_example�sz2TraceTestCase.test_15_loops.<locals>.while_example)r"r*r7r1r7r1r7r9r�)rr�r�rrr
�
test_15_loops�s�
�zTraceTestCase.test_15_loopscCs&i}td|�|�|dgd��dS)Nadef f():
































































































































































































































































    pass�f)r")�r%)r�r')�execr�)r�	namespacerrr
�test_16_blank_lines�s
�z!TraceTestCase.test_16_blank_linescCsdd�}|�|ddg�dS)NcSsdt��_d}dSr�)rQrSrU)�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_tracecCsdd�}|�|gd��dS)Nc
SsTz<zt�Wn.ty8}z�d}d}WYd}~n
d}~00WntyNYn0dS)N�	SomethingrJ)r�rrArrr
r��sz4TraceTestCase.test_18_except_with_name.<locals>.func)
r"r$r*r7�r8rOr1r,)�r%)�	r%)r�r'r�r�rrr
�test_18_except_with_name�s�z&TraceTestCase.test_18_except_with_namecCsdd�}|�|gd��dS)NcSs4zzt�Wd}nd}0Wnty.d}Yn0dS)Nr��rJ)rAr\rrr
r��sz7TraceTestCase.test_19_except_with_finally.<locals>.func)	r"r$r*r7r�r,r?r3r5r�r�rrr
�test_19_except_with_finally�s	�z)TraceTestCase.test_19_except_with_finallycspGdd�d���fdd���fdd�}|��}gd�}z||j�WntyVYn0|��jj|j|�dS)Nc@s$eZdZdd�Zdd�Zdd�ZdS)zBTraceTestCase.test_20_async_for_loop.<locals>.AsyncIteratorWrappercSst|�|_dSr)�iter�_it)r�objrrr
rszKTraceTestCase.test_20_async_for_loop.<locals>.AsyncIteratorWrapper.__init__cSs|Srrrrrr
�	__aiter__szLTraceTestCase.test_20_async_for_loop.<locals>.AsyncIteratorWrapper.__aiter__c�s(zt|j�WSty"t�Yn0dSr)�nextr��
StopIteration�StopAsyncIterationrrrr
�	__anext__szLTraceTestCase.test_20_async_for_loop.<locals>.AsyncIteratorWrapper.__anext__N)rrrrr�r�rrrr
�AsyncIteratorWrappersr�c�s$�d�2z3dHW}|}q6d}dS)N�abc�*r)ZletterrrA)r�rr
�
doit_asyncsz8TraceTestCase.test_20_async_for_loop.<locals>.doit_asyncc	s:��}z"t�|�|�d�Wt�d�nt�d�0dSr�rQrR�send�r�r)r�rr
�run$s

z1TraceTestCase.test_20_async_for_loop.<locals>.run)(r"r$)i�r#)���r%)r�r')i����r#)���r%)r�r'rirjrlrn�r rOr*r$rirjrlrnr�r*r$rirjrlrnr�r*r$rirjrlro)rFr%rGrNrIr�r7r9�r�r{rKr�r�r�rt�rr�r�rtr)r�r�r
�test_20_async_for_loops
)
�z$TraceTestCase.test_20_async_for_loopcsjdd���fdd���fdd�}|��}gd�}z||j�WntyPYn0|��jj|j|�dS)NcSs
dVdS)NrHrrrrr
�	async_gen_sz7TraceTestCase.test_21_async_for_else.<locals>.async_genc�s&da��2z3dHW}daq
6dadS�Nr+r2r@)r=�rb)r�rr
�
async_testbsz8TraceTestCase.test_21_async_for_else.<locals>.async_testc	s:��}z"t�|�|�d�Wt�d�nt�d�0dSrr�r�)r�rr
r�js

z1TraceTestCase.test_21_async_for_else.<locals>.run)r"r*r7rErGrIr�r1r7)rHr#rIr�r?r^r�r�r)r�r�r
�test_21_async_for_else]s
�z$TraceTestCase.test_21_async_for_elseN)$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�rrrr
r�BsB


		Lr�cs(eZdZ�fdd�Zedd��Z�ZS)�SkipLineEventsTraceTestCasecs"dd�|D�}t��|||�dS)NcSsg|]}|ddkr|�qSr$r�rr�rrr
r��r�z>SkipLineEventsTraceTestCase.compare_events.<locals>.<listcomp>)�superr�)rr�rtr�Zskip_line_events��	__class__rr
r��sz*SkipLineEventsTraceTestCase.compare_eventscCs
tdd�S)NF)rrr�rrrr
r��sz'SkipLineEventsTraceTestCase.make_tracer�rrrr�r�r��
__classcell__rrr�r
r��sr�cs(eZdZ�fdd�Zedd��Z�ZS)�TraceOpcodesTestCasecsFdd�|D�}t|�dkr2|jt|�t|�dd�t��|||�dS)NcSsg|]}|ddkr|�qS)r Zopcoderr�rrr
r��r�z7TraceOpcodesTestCase.compare_events.<locals>.<listcomp>r z)No 'opcode' events received by the tracer)�msg)�lenZ
assertLessr�r�)rr�rtr�Zskip_opcode_eventsr�rr
r��s�z#TraceOpcodesTestCase.compare_eventscCs
tdd�S)NT)rsr�r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�r�rQrRr�rrrr
r��szRaisingTraceFuncTestCase.setUpcCs||jkrt�n|jSdSr)�raiseOnEvent�
ValueErrorr{r|rrr
r{�s
zRaisingTraceFuncTestCase.tracecCs |jdkrd}d|}ndSdS)NrOrr )r�)rrrArrr
r��s

zRaisingTraceFuncTestCase.fc	Csx||_zPtt��d�D]:}t�|j�z|��WntyFYq0|�d�qWnt	yr|�d�Yn0dS)Nr zexception not raised!zrecursion counter not reset)
r�r<rQ�getrecursionlimitrRr{r�r�r�rY)rr}rbrrr
�run_test_for_event�s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�NrOr�rrrr
�test_exception�sz'RaisingTraceFuncTestCase.test_exceptioncs\dd����fdd��t���z
��Wn"tyLddl}|��Yn0|�d�dS)NcSstd�D]}t|�qdS)Nr-)r<�printr�rrr
r��sz4RaisingTraceFuncTestCase.test_trash_stack.<locals>.fcs&|dkr"|j�jjdkr"td���S)Nr%r+z
i am crashing)rzr�r�rY)rwZwhyZextra�r��grr
r�s
�z4RaisingTraceFuncTestCase.test_trash_stack.<locals>.grzexception not propagated)rQrRrYr�Zcollectr�)rr�rrr
�test_trash_stack�s

z)RaisingTraceFuncTestCase.test_trash_stackc	sfdd�}��fdd��t��}z6t���z
|�WntyFYn0Wt�|�nt�|�0dS)NcSsd}|jdS)Nr)Zno_such_attrr(rrr
r��sz<RaisingTraceFuncTestCase.test_exception_arguments.<locals>.fcs"|dkr|\}}}��|t��Sr�)ZassertIsInstancerK)rwr}r~�typerOr{�rrrr
r�s
z<RaisingTraceFuncTestCase.test_exception_arguments.<locals>.g)rQr�rR�AttributeError)rr�Zexistingrrr
�test_exception_arguments�s

z1RaisingTraceFuncTestCase.test_exception_argumentsN)
rrrr�r{r�r�r�r�r�r�rrrrrr
r��s	r�c@seZdZddd�Zdd�ZdS)	�
JumpTracerr%FcCs6|j|_||_||_||_|r"dn|jj|_d|_dS)NF)r��code�jumpFrom�jumpTor}r��	firstLine�done)rZfunctionr	r
r}�	decoratedrrr
r	szJumpTracer.__init__cCs�|jr
dS|jdur4|j|jkr4|dkr4|jd|_||jkr�|jr�|j|j|jkr�|}|durv|j|jkrv|j}qZ|dur�z|j|j|_Wnt	y�|j|_Yn0d|_|j
S)Nr%r T)rr�f_coderrzr}r	rTr
�	TypeErrorr{)rrwr}r~r�rrr
r{s&��zJumpTracer.traceN)r%F)rrrrr{rrrr
rs�
	rc
CsJz|�d�Wn6tyD}z|�dt|�v�WYd}~n
d}~00dS)Nr+Zinteger)rr�r��rr�rrr
�no_jump_to_non_integers,src
CsVzt��j}|j|_Wn2tyH}zdt|�vr4�WYd}~nd}~00td��dS)Nr{z'Trace-function-less jump failed to fail)rQrSrTrzr�r��AssertionError)Zprevious_framer�rrr
�no_jump_without_trace_function4s
rc@s�eZdZdd�Zdd�Zd�dd	�Zd�d
d�Zd�dd
�Zd�dd�Zedddg�dd��Z	eddgd��dd��Z
eddddg�dd��Zeddgd��dd��Zeddddg�d d!��Z
eddgd"��d#d$��Zedddg�d%d&��Zeddgd'��d(d)��Zedd*dd*g�d+d,��Zedd-dd-ged.f�d/d0��Zedd1dd1ged.f�d2d3��Zedd1ddged4f�d5d6��Zedddged4f�d7d8��Zeddddg�d9d:��Zeddgd;��d<d=��Zeddddg�d>d?��Zeddddg�d@dA��ZeddgdB��dCdD��ZeddgdB��dEdF��Zedddg�dGdH��ZeddgdI��dJdK��Zedddg�dLdM��Z eddgdN��dOdP��Z!edd-gdQ��dRdS��Z"eddgdT��dUdV��Z#eddgdW��dXdY��Z$eddgdW��dZd[��Z%eddgd\��d]d^��Z&eddgd\��d_d`��Z'eddgda��dbdc��Z(eddgda��ddde��Z)eddgdf��dgdh��Z*eddgdf��didj��Z+edkd1gdl��dmdn��Z,eddgdo��dpdq��Z-eddgdo��drds��Z.eddgdt��dudv��Z/eddkgdw��dxdy��Z0edd-d-dkg�dzd{��Z1edd-d-dkg�d|d}��Z2edddged~f�dd���Z3edd�dged�f�d�d���Z4edddged�f�d�d���Z5edddged�f�d�d���Z6edddged�f�d�d���Z7edddged�f�d�d���Z8eddged�f�d�d���Z9eddged�f�d�d���Z:eddddged�f�d�d���Z;eddddged�f�d�d���Z<eddged�f�d�d���Z=eddged�f�d�d���Z>eddgd��ed�f�d�d���Z?eddgd��ed�f�d�d���Z@eddged�f�d�d���ZAeddddged�f�d�d���ZBeddged�f�d�d���ZCedddged�f�d�d���ZDedd-dged�f�d�d���ZEedddg�d�d���ZFeddgd���d�d���ZGeddgd���d�d���ZHeddged�f�d�d���ZIeddged�f�d�d���ZJeddgd��ed�f�d�d���ZKedddged�f�d�d���ZLed-dgd��ed�f�d�d���ZMed-dgd��ed�f�d�d���ZNeddgd¢�d�dĄ�ZOeddgd¢�d�dƄ�ZPedd-ddged4f�d�dȄ�ZQed-dddged�f�d�dʄ�ZRed-dddged�f�d�d̄�ZSd�d΄ZTd�dЄZUd�d҄ZVd�dԄZWedddgd�ed�fd׍d�dل�ZXedddgd�ed�fd׍d�d݄�ZYedddgd�ed�fd׍d�d��ZZeddddgd�d�d�d��Z[eddddg�d�d��Z\eddg�d�d��Z]edkdgd��d�d��Z^eddddg�d�d��Z_eddg�d�d��Z`edkdgd��d�d��ZadS)��JumpTestCasecCs |�tjt���t�d�dSrr�rrrr
r�CszJumpTestCase.setUpcCs.||kr*|�dt|�ddt|��dS)NzOutputs don't match:
Expected: r�z
Received: )r��repr)r�expectedZreceivedrrr
�compare_jump_outputGs����z JumpTestCase.compare_jump_outputNr%Fc
Cs~t|||||�}t�|j�g}	|dur2||	�n2|j|��||	�Wd�n1sZ0Yt�d�|�||	�dSr)rrQrRr{�assertRaisesRegexr�
rr�r	r
r�errorr}r
r�rrrr
r�Ms
&
zJumpTestCase.run_testc
Cs�t|||||�}t�|j�g}	|dur8t�||	��n8|j|��t�||	��Wd�n1sf0Yt�d�t�d�|�||	�dSr)	rrQrRr{�asyncior�rZset_event_loop_policyrrrrr
�run_async_testZs,

zJumpTestCase.run_async_testcs�����fdd�}|S)Ncs"t��������fdd��}|S)Nc	s|j������dd�dS�NT)rr}r
)r�r�rr}rr�r	r
rr
�testms�z7JumpTestCase.jump_test.<locals>.decorator.<locals>.testr�r�r�rr}rr	r
�r�r
�	decoratorlsz)JumpTestCase.jump_test.<locals>.decoratorr�r	r
rrr}r#rr!r
�	jump_testhszJumpTestCase.jump_testcs�����fdd�}|S)Ncs"t��������fdd��}|S)Nc	s|j������dd�dSr)rrrrr
rys�z=JumpTestCase.async_jump_test.<locals>.decorator.<locals>.testrr r!r"r
r#xsz/JumpTestCase.async_jump_test.<locals>.decoratorrr$rr!r
�async_jump_testtszJumpTestCase.async_jump_testr r8cCs"|�d�|�d�|�d�dS�Nr r+r8�r�rrrr
�test_jump_simple_forwards�s

z&JumpTestCase.test_jump_simple_forwardsr+)r r r+cCs|�d�|�d�dSr:r(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+�r8r2r-r(�rrb�jrrr
�test_jump_out_of_block_forwards�s

z,JumpTestCase.test_jump_out_of_block_forwardsr@)r r8r-r r8r-r@r4cCsJ|�d�dD],}|�d�dD]}|�d�q |�d�q|�d�dS)Nr r�r8)r+r-r@r4r(r.rrr
� test_jump_out_of_block_backwards�s

z-JumpTestCase.test_jump_out_of_block_backwardsr2c�sHdD]>}tddg�2z 3dHW}|�d�|�d�q6|�d�qdS)Nr�r r+r8r2r-�rr�rrbrrr
�)test_jump_out_of_async_for_block_forwards�s

z6JumpTestCase.test_jump_out_of_async_for_block_forwards)r+r2r+r2r-r@c�sPdD]F}|�d�tdg�2z 3dHW}|�d�|�d�q6|�d�qdS)Nr�r+r r2r-r@�rrr3rrr
�*test_jump_out_of_async_for_block_backwards�s

z7JumpTestCase.test_jump_out_of_async_for_block_backwardscCs|�d�|�d�dS)Nr r8r(r)rrr
�test_jump_to_codeless_line�s
z'JumpTestCase.test_jump_to_codeless_line)r r+r8cCs"|�d�|�d�|�d�dSr'r(r)rrr
�test_jump_to_same_line�s

z#JumpTestCase.test_jump_to_same_liner�cCs�zH|�d�W|�d�z|�d�W|�d�n|�d�0|�d�n<|�d�z|�d�W|�d�n|�d�0|�d�0dS)Nr+r2r@r�r�r(r)rrr
�test_jump_in_nested_finally�s
�
z(JumpTestCase.test_jump_in_nested_finallyr4�c	CsRz,|�d�ddW|�d�|�d�dS|�d�|�d�0|�d�dS)Nr+r rr@r4r�r(r)rrr
�test_jump_in_nested_finally_2�s


��
z*JumpTestCase.test_jump_in_nested_finally_2�cCs�z�|�d�ddW|�d�z|�d�W|�d�n|�d�0|�d�dSz|�d�W|�d�n|�d�0|�d�n<|�d�z|�d�W|�d�n|�d�0|�d�0|�d�dS)	Nr+r rr@r�rfr<�r(r)rrr
�test_jump_in_nested_finally_3�s*


��
z*JumpTestCase.test_jump_in_nested_finally_3Zunreachablec	Cs�zL|�d�W|�d�|�d�dSz|�d�W|�d�q�|�d�0nH|�d�|�d�YdSz|�d�W|�d�n|�d�00|�d�dS)Nr+r2r-r�rfr=r(r)rrr
�5test_no_jump_over_return_try_finally_in_finally_block�s"

�

zBJumpTestCase.test_no_jump_over_return_try_finally_in_finally_blockcCs$|�d�|�d�q
|�d�dS)Nr r8r2r(r)rrr
� test_no_jump_infinite_while_loop�s
z-JumpTestCase.test_no_jump_infinite_while_loopcCs.d}|�d�|dkr*|�d�|d7}qdS)Nr r+r2r(r3rrr
�#test_jump_forwards_into_while_block�s


z0JumpTestCase.test_jump_forwards_into_while_block)r8r8r8r-cCs.d}|dkr |�d�|d7}q|�d�dS)Nr r+r8r-r(r3rrr
�$test_jump_backwards_into_while_blocks


z1JumpTestCase.test_jump_backwards_into_while_blockcCsBt|d��|�d�Wd�n1s*0Y|�d�dSr'�rrr)rrr
�$test_jump_forwards_out_of_with_block	s(z1JumpTestCase.test_jump_forwards_out_of_with_blockc	�sVt|d�4IdH� |�d�Wd�IdHqH1IdHs>0Y|�d�dSr'�rrr)rrr
�*test_jump_forwards_out_of_async_with_blocks4z7JumpTestCase.test_jump_forwards_out_of_async_with_block)r r+r r+r8rHcCsB|�d�t|d��|�d�Wd�n1s40YdSr'�rrr)rrr
�%test_jump_backwards_out_of_with_blocks
z2JumpTestCase.test_jump_backwards_out_of_with_blockc	�sV|�d�t|d�4IdH� |�d�Wd�IdHqR1IdHsH0YdSr'�rrr)rrr
�+test_jump_backwards_out_of_async_with_blocks
z8JumpTestCase.test_jump_backwards_out_of_async_with_blockc	Cs4z|�d�W|�d�n|�d�0|�d�dS�Nr+r2r-r(r)rrr
�+test_jump_forwards_out_of_try_finally_block!sz8JumpTestCase.test_jump_forwards_out_of_try_finally_block)r r r8r-c	Cs4|�d�z|�d�W|�d�n|�d�0dS�Nr r8r-r(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��Yn0|�d�dSr�r(r)rrr
�*test_jump_forwards_out_of_try_except_block1s
z7JumpTestCase.test_jump_forwards_out_of_try_except_block)r r r8cCs6|�d�z|�d�Wn|�d��Yn0dSrMr(r)rrr
�+test_jump_backwards_out_of_try_except_block:s

z8JumpTestCase.test_jump_backwards_out_of_try_except_block)r2r4r�cCs\zddWn@ty2|�d�|�d�YntyL|�d�Yn0|�d�dS�Nr rr2r-r4r���ZeroDivisionErrorr�FloatingPointErrorr)rrr
�test_jump_between_except_blocksCs
z,JumpTestCase.test_jump_between_except_blocks)r2r@r4cCsFzddWn*|�d�|�d�|�d�Yn0|�d�dS)Nr rr2r-r@r4r(r)rrr
�test_jump_within_except_blockNs

z*JumpTestCase.test_jump_within_except_block)r r2r-rmcCsv|�d�t|d��|�d�Wd�n1s40Yt|d��|�d�Wd�n1sh0YdS�Nr r+r8r2r-rGr)rrr
�test_jump_across_withXs

(z"JumpTestCase.test_jump_across_withc	�s�|�d�t|d�4IdH� |�d�Wd�IdHqR1IdHsH0Yt|d�4IdH� |�d�Wd�IdHq�1IdHs�0YdSrWrIr)rrr
�test_jump_across_async_with`s

4z(JumpTestCase.test_jump_across_async_with)r r8r-r@c	Cs`|�d�dD]B}t|d��|�d�Wd�n1s<0Y|�d�q|�d�dS�Nr r�r8r2r-r@rGr3rrr
�,test_jump_out_of_with_block_within_for_blockhs
(z9JumpTestCase.test_jump_out_of_with_block_within_for_blockc
�st|�d�dD]V}t|d�4IdH� |�d�Wd�IdHqZ1IdHsP0Y|�d�q|�d�dSrZrIr3rrr
�2test_jump_out_of_async_with_block_within_for_blockqs
4z?JumpTestCase.test_jump_out_of_async_with_block_within_for_block)r r+r8r-rHr@c	Cs�|�d�t|d��Nt|d��|�d�Wd�n1s@0Y|�d�Wd�n1sh0Y|�d�dS�Nr r+r8r2r-r@rGr)rrr
�-test_jump_out_of_with_block_within_with_blockzs
((z:JumpTestCase.test_jump_out_of_with_block_within_with_blockc
�s�|�d�t|d��bt|d�4IdH� |�d�Wd�IdHq^1IdHsT0Y|�d�Wd�n1s|0Y|�d�dSr])rrrr)rrr
�3test_jump_out_of_async_with_block_within_with_block�s
4(z@JumpTestCase.test_jump_out_of_async_with_block_within_with_block)r+r2r@r4cCs�zL|�d�Wt|d��|�d�Wd�n1s80Y|�d�n@t|d��|�d�Wd�n1sx0Y|�d�0|�d�dS�Nr+r2r-r@r4rGr)rrr
�0test_jump_out_of_with_block_within_finally_block�s(�(z=JumpTestCase.test_jump_out_of_with_block_within_finally_blockc�s�z`|�d�Wt|d�4IdH� |�d�Wd�IdHqV1IdHsL0Y|�d�nTt|d�4IdH� |�d�Wd�IdHq�1IdHs�0Y|�d�0|�d�dSr`rIr)rrr
�6test_jump_out_of_async_with_block_within_finally_block�s4�4zCJumpTestCase.test_jump_out_of_async_with_block_within_finally_blockr�)r r8r-r<r=cCsz|�d�dD]\}|�d�dD]>}|�d�z"dD]}|�d�q4W|�d�q |�d�0q |�d�q|�d	�dS)
Nr r�r8r,r-r�rfr<r=r()rrbr/�krrr
�&test_jump_out_of_complex_nested_blocks�s


z3JumpTestCase.test_jump_out_of_complex_nested_blocks)r r+r-cCsL|�d�t|d��}|�d�Wd�n1s40Y|�d�dS�Nr r+r2r-rG�rrrrr
� test_jump_out_of_with_assignment�s


(z-JumpTestCase.test_jump_out_of_with_assignmentc	�s`|�d�t|d�4IdH� }|�d�Wd�IdHqR1IdHsH0Y|�d�dSrerIrfrrr
�&test_jump_out_of_async_with_assignment�s

4z3JumpTestCase.test_jump_out_of_async_with_assignment)r r@r�r�c	Cs\|�d�z6|�d�|s*W|�d�dS|�d�W|�d�n|�d�0|�d�dS)Nr r8r�r@r�r(r)rrr
�*test_jump_over_return_in_try_finally_block�s


�z7JumpTestCase.test_jump_over_return_in_try_finally_block)r r8r�rfr<�
c	Csr|�d�|�d�z4|�d�|s2W|�d�qd|�d�W|�d�n|�d�0|�d�qdq
|�d�dS)Nr r8r-rfr�r<rjr(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 r-r2r@r4r�r(r3rrr
�$test_jump_over_for_block_before_else�s


z1JumpTestCase.test_jump_over_for_block_before_elsec�sV|�d�|s4tdg�2z3dHW}|�d�q6n|�d�|�d�|�d�dS�Nr r8r2r@r4r�r5r3rrr
�*test_jump_over_async_for_block_before_else�s


z7JumpTestCase.test_jump_over_async_for_block_before_elseZaftercCs|�d�|�d�dSr:r(r)rrr
�test_no_jump_too_far_forwards�s
z*JumpTestCase.test_no_jump_too_far_forwardsrHZbeforecCs|�d�|�d�dSr:r(r)rrr
�test_no_jump_too_far_backwards�s
z+JumpTestCase.test_no_jump_too_far_backwards�exceptcCs,z|�d�Wn|�d��Yn0dS�Nr+r2r(r)rrr
�test_no_jump_to_except_1�s

z%JumpTestCase.test_no_jump_to_except_1cCs2z|�d�Wnty,|�d��Yn0dSrs�rr�r)rrr
�test_no_jump_to_except_2s

z%JumpTestCase.test_no_jump_to_except_2c
CsFz|�d�Wn2ty@}z|�d�|�WYd}~n
d}~00dSrsrurrrr
�test_no_jump_to_except_3s

z%JumpTestCase.test_no_jump_to_except_3c
CsJz|�d�Wn6ttfyD}z|�d�|�WYd}~n
d}~00dSrs)rr�rYrrrr
�test_no_jump_to_except_4s

z%JumpTestCase.test_no_jump_to_except_4ZintocCs"|�d�dD]}|�d�qdS)Nr r,r8r(r3rrr
�$test_no_jump_forwards_into_for_blocks
z1JumpTestCase.test_no_jump_forwards_into_for_blockc�s4|�d�tddg�2z3dHW}|�d�q6dSr'r5r3rrr
�*test_no_jump_forwards_into_async_for_block$s
z7JumpTestCase.test_no_jump_forwards_into_async_for_blockcCs"dD]}|�d�q|�d�dS)Nr,r+r8r(r3r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'r2r3rrr
�+test_no_jump_backwards_into_async_for_block0sz8JumpTestCase.test_no_jump_backwards_into_async_for_blockcCsB|�d�t|d��|�d�Wd�n1s40YdSr'rGr)rrr
�%test_no_jump_forwards_into_with_block6s
z2JumpTestCase.test_no_jump_forwards_into_with_blockc	�sV|�d�t|d�4IdH� |�d�Wd�IdHqR1IdHsH0YdSr'rIr)rrr
�+test_no_jump_forwards_into_async_with_block<s
z8JumpTestCase.test_no_jump_forwards_into_async_with_block)r r+rpcCsBt|d��|�d�Wd�n1s*0Y|�d�dSr'rCr)rrr
�&test_no_jump_backwards_into_with_blockBs(z3JumpTestCase.test_no_jump_backwards_into_with_blockc	�sVt|d�4IdH� |�d�Wd�IdHqH1IdHs>0Y|�d�dSr'rEr)rrr
�,test_no_jump_backwards_into_async_with_blockHs4z9JumpTestCase.test_no_jump_backwards_into_async_with_blockc	Cs4|�d�z|�d�W|�d�n|�d�0dSrMr(r)rrr
�,test_no_jump_forwards_into_try_finally_blockNs
z9JumpTestCase.test_no_jump_forwards_into_try_finally_blockc	Cs4z|�d�W|�d�n|�d�0|�d�dSrKr(r)rrr
�-test_no_jump_backwards_into_try_finally_blockVsz:JumpTestCase.test_no_jump_backwards_into_try_finally_blockcCs6|�d�z|�d�Wn|�d��Yn0dSrMr(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��Yn0|�d�dSr�r(r)rrr
�,test_no_jump_backwards_into_try_except_blockgs
z9JumpTestCase.test_no_jump_backwards_into_try_except_blockc
CsnzddWnRty2|�d�|�d�Yn.ty^}z|�d�WYd}~n
d}~00|�d�dSrQrRrrrr
�$test_no_jump_between_except_blocks_2qs
 z1JumpTestCase.test_no_jump_between_except_blocks_2c	Cs4|�d�z|�d�W|�d�n|�d�0dSrMr(r)rrr
�test_jump_into_finally_block|s
z)JumpTestCase.test_jump_into_finally_block)r+r@r4c	CsRz,|�d�|�d�W|�d�|�d�n|�d�|�d�0|�d�dS)Nr+r8r-r@r4r(r)rrr
�+test_jump_into_finally_block_from_try_block�s

�
z8JumpTestCase.test_jump_into_finally_block_from_try_block)r r8r r8r-c	Cs4|�d�z|�d�W|�d�n|�d�0dSrMr(r)rrr
�test_jump_out_of_finally_block�s
z+JumpTestCase.test_jump_out_of_finally_blockzinto an 'except'cCs4|�d�z|�d�Wn|�d�Yn0dSrMr(r)rrr
�#test_no_jump_into_bare_except_block�s

z0JumpTestCase.test_no_jump_into_bare_except_blockcCs:|�d�z|�d�Wnty4|�d�Yn0dSrM�rrKr)rrr
�(test_no_jump_into_qualified_except_block�s

z5JumpTestCase.test_no_jump_into_qualified_except_block)r+r-r@cCsJz|�d�|�d�Wn"|�d�|�d��Yn0|�d�dS�Nr+r8r-r@r�r(r)rrr
�2test_no_jump_into_bare_except_block_from_try_block�s


z?JumpTestCase.test_no_jump_into_bare_except_block_from_try_blockcCsPz|�d�|�d�Wn(ty@|�d�|�d��Yn0|�d�dSr�)rrSr)rrr
�7test_no_jump_into_qualified_except_block_from_try_block�s


zDJumpTestCase.test_no_jump_into_qualified_except_block_from_try_block)r r8r@zout of an 'except'cCsF|�d�z|�d�ddWn |�d�|�d�Yn0dS�Nr r8rr@r4r(r)rrr
�%test_no_jump_out_of_bare_except_block�s


z2JumpTestCase.test_no_jump_out_of_bare_except_blockcCsL|�d�z|�d�ddWn&tyF|�d�|�d�Yn0dSr�r�r)rrr
�*test_no_jump_out_of_qualified_except_block�s


z7JumpTestCase.test_no_jump_out_of_qualified_except_block)r r+r-rHcCsv|�d�t|d��|�d�Wd�n1s40Yt|d��|�d�Wd�n1sh0YdSrWrGr)rrr
�test_jump_between_with_blocks�s

(z*JumpTestCase.test_jump_between_with_blocksc	�s�|�d�t|d�4IdH� |�d�Wd�IdHqR1IdHsH0Yt|d�4IdH� |�d�Wd�IdHq�1IdHs�0YdSrWrIr)rrr
�#test_jump_between_async_with_blocks�s

4z0JumpTestCase.test_jump_between_async_with_blocksc	CsVz$|�d�W|�d�|�d�dS|�d�|�d�YdS0|�d�dS)Nr+r2r-r4r(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�dSrlr(r3rrr
�'test_no_jump_into_for_block_before_else�s


z4JumpTestCase.test_no_jump_into_for_block_before_elsec�sV|�d�|s4tdg�2z3dHW}|�d�q6n|�d�|�d�|�d�dSrnr5r3rrr
�-test_no_jump_into_async_for_block_before_else�s


z:JumpTestCase.test_no_jump_into_async_for_block_before_elsecCs|�tdddg�dS)Nr+ZSpamT)r�rrrrr
�test_no_jump_to_non_integerssz)JumpTestCase.test_no_jump_to_non_integerscCs
t�dSr)rrrrr
�#test_no_jump_without_trace_functionsz0JumpTestCase.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_functions��	z JumpTestCase.test_large_functioncsjtddd��G�fdd�d�}t|dd�}t�|j�dgi}t�|�t�d�|�gd	�|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�rrr
�
fake_function sr�r+rr)r+r8r+r8r2)�compilerrQrRr{r�r)rr�r�r�rr�r
�test_jump_to_firstlinenos�

z%JumpTestCase.test_jump_to_firstlinenor#z5can't jump from the 'call' trace event of a new frame)r}rcs*��d��fdd�}|���d�dS)Nr cs��d�dS)Nr8r(rr)rr
�nested-sz3JumpTestCase.test_no_jump_from_call.<locals>.nestedr-r()rr�r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�dSrr(r)rrr
�test_no_jump_from_return_event2s
z+JumpTestCase.test_no_jump_from_return_eventrOcCs|�d�dddS)Nr rr(r)rrr
�!test_no_jump_from_exception_event8s
z.JumpTestCase.test_no_jump_from_exception_event)r}cs$�fdd�}t|����d�dS)Nc3s��d�dVdS)Nr+r8r(rr)rr
�gen@s
z.JumpTestCase.test_jump_from_yield.<locals>.genr-)r�r)rr�rr)r
�test_jump_from_yield>s
z!JumpTestCase.test_jump_from_yieldcCs*|�d�dd�td�D�}|�d�dS)Nr cSsg|]}|�qSrr�rrbrrr
r�Ir�z@JumpTestCase.test_jump_forward_over_listcomp.<locals>.<listcomp>rfr8�rr<rfrrr
�test_jump_forward_over_listcompFs
z,JumpTestCase.test_jump_forward_over_listcompcCsd}dd�td�D�}d}dS)Nr cSsg|]}|�qSrrr�rrr
r�Qr�zAJumpTestCase.test_jump_backward_over_listcomp.<locals>.<listcomp>rfr8r;�rr=r�crrr
� test_jump_backward_over_listcompNsz-JumpTestCase.test_jump_backward_over_listcomp)r+r4r+cCsDd}|�d�|rdSdd�td�D�}d}|�d�|�d�dS)	NFr+cSsg|]}|�qSrrr�rrr
r�Zr�zDJumpTestCase.test_jump_backward_over_listcomp_v2.<locals>.<listcomp>r-r@r4r�r��r�flagrrrr
�#test_jump_backward_over_listcomp_v2Ts

z0JumpTestCase.test_jump_backward_over_listcomp_v2c�s4|�d�dd�ttd��2�IdH}|�d�dS)Nr c�sg|z3dHW}|�q6Srrr�rrr
r�br�zFJumpTestCase.test_jump_forward_over_async_listcomp.<locals>.<listcomp>rfr8�rrr<rfrrr
�%test_jump_forward_over_async_listcomp_s
z2JumpTestCase.test_jump_forward_over_async_listcompc�s(d}dd�ttd��2�IdH}d}dS)Nr c�sg|z3dHW}|�q6Srrr�rrr
r�hr�zGJumpTestCase.test_jump_backward_over_async_listcomp.<locals>.<listcomp>rfr8)rr<r�rrr
�&test_jump_backward_over_async_listcompesz3JumpTestCase.test_jump_backward_over_async_listcompc�sNd}|�d�|rdSdd�ttd��2�IdH}d}|�d�|�d�dS)	NFr+c�sg|z3dHW}|�q6Srrr�rrr
r�qr�zJJumpTestCase.test_jump_backward_over_async_listcomp_v2.<locals>.<listcomp>r-r@r4r�r�r�rrr
�)test_jump_backward_over_async_listcomp_v2ks

z6JumpTestCase.test_jump_backward_over_async_listcomp_v2)Nr%F)Nr%F)Nr%)Nr%)brrrr�rr�rr%r&r*r+r0r1r4r6r7r8r9rSr;r>r�r?r@rArBrDrFrHrJrLrNrOrPrUrVrXrYr[r\r^r_rarbrdrgrhrirkrmrorprqrtrvrwrxryrzr{r|r}r~rr�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
rBsp�

�






	






















	






	
	

























	



	







	
	


	




�
�









r�__main__).rrZunittestrQr�r��	functoolsrrrrrr!rtr)r/r0r6r>rBrDr#rLrMrWrXrZr[r]rcrdrerhrqZTestCaser�r�Zcpython_onlyr�r�rrrrr�mainrrrr
�<module>s�



	
	







		





��J`&;