+
    Bi                     v   R t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	H
t
 ^ RIHtHt ^ RIHt ^ RIHt ^ RIHt  ! R R]4      t ! R	 R
]4      t ! R R]4      t ! R R]4      t^ tR tR t ! R R]P4                  4      t ! R R]4      t ! R R4      tR.R lt]
R 4       t]RR3R lt Rt!]!R,           t"R t#R t$R t%R  t& ! R! R"]PN                  4      t( ! R# R$](4      t) ! R% R&](4      t* ! R' R(](4      t+ ! R) R*](4      t, ! R+ R,]PN                  4      t-].R-8X  d   ]P^                  ! 4        R# R# )/a8  Test the bdb module.

A test defines a list of tuples that may be seen as paired tuples, each
pair being defined by 'expect_tuple, set_tuple' as follows:

    ([event, [lineno[, co_name[, eargs]]]]), (set_type, [sargs])

* 'expect_tuple' describes the expected current state of the Bdb instance.
  It may be the empty tuple and no check is done in that case.
* 'set_tuple' defines the set_*() method to be invoked when the Bdb
  instance reaches this state.

Example of an 'expect_tuple, set_tuple' pair:

    ('line', 2, 'tfunc_main'), ('step', )

Definitions of the members of the 'expect_tuple':
    event:
        Name of the trace event. The set methods that do not give back
        control to the tracer [1] do not trigger a tracer event and in
        that case the next 'event' may be 'None' by convention, its value
        is not checked.
        [1] Methods that trigger a trace event are set_step(), set_next(),
        set_return(), set_until() and set_continue().
    lineno:
        Line number. Line numbers are relative to the start of the
        function when tracing a function in the test_bdb module (i.e. this
        module).
    co_name:
        Name of the function being currently traced.
    eargs:
        A tuple:
        * On an 'exception' event the tuple holds a class object, the
          current exception must be an instance of this class.
        * On a 'line' event, the tuple holds a dictionary and a list. The
          dictionary maps each breakpoint number that has been hit on this
          line to its hits count. The list holds the list of breakpoint
          number temporaries that are being deleted.

Definitions of the members of the 'set_tuple':
    set_type:
        The type of the set method to be invoked. This may
        be the type of one of the Bdb set methods: 'step', 'next',
        'until', 'return', 'continue', 'break', 'quit', or the type of one
        of the set methods added by test_bdb.Bdb: 'ignore', 'enable',
        'disable', 'clear', 'up', 'down'.
    sargs:
        The arguments of the set method if any, packed in a tuple.
N)contextmanager)islicerepeat)import_helper)	os_helper)
patch_listc                       ] tR t^AtRtR# )BdbException N)__name__
__module____qualname____firstlineno____static_attributes__r
       $/usr/lib/python3.14/test/test_bdb.pyr	   r	   A   s    tr   r	   c                       ] tR t^BtRtRtR# )BdbErrorz!Error raised by the Bdb instance.r
   Nr   r   r   r   __doc__r   r
   r   r   r   r   B   s    Er   r   c                       ] tR t^CtRtRtR# )BdbSyntaxErrorzSyntax error in the test case.r
   Nr   r
   r   r   r   r   C   s    $Hr   r   c                       ] tR t^DtRtRtR# )BdbNotExpectedErrorzUnexpected result.r
   Nr   r
   r   r   r   r   D   s    )Ar   r   c                  B    \         P                  P                  4        R # N)_bdb
BreakpointclearBreakpointsr
   r   r   reset_Breakpointr   L   s    OO$$&r   c                  <   \         P                  P                   U u. uF  q '       g   K  V NK  	  pp V'       g   R # RpV F  p V'       g   RpRpV P                  '       d   RMRpV P                  '       d   RMRpXRV P
                  WEV P                  V P                  \        P                  P                  V P                  4      V P                  3,          ,          pV P                  '       d   VR	V P                  : 2,          pVR
,          pK  	  X# u up i ) Fz!BpNum Temp Enb Hits Ignore Where
Tzyes zno  yeszno z%-5d %s %s %-4d %-6d at %s:%dz
	stop only if 
)r   r   
bpbynumber	temporaryenablednumberhitsignoreospathbasenamefilelinecond)bpbp_listheader_addedinfodispenabs         r   info_breakpointsr6   O   s    !__77>7r2rr7G>L7DLv6


u0YYBGGRYYWW%%bgg.99 	: 777RWW66D  K% ?s
   	DDc                   v   a a ] tR t^dt oRtV 3R ltRV 3R lltV 3R ltR tR t	R t
R tR	 tR
 tRtVtV ;t# )Bdbz$Extend Bdb to enhance test coverage.c                2   < R V n         \        SV `	  WV4      # r   )	currentbpsupertrace_dispatch)selfframeeventarg	__class__s   &&&&r   r<   Bdb.trace_dispatchg   s    w%eC88r   c                  < \        V\        4      '       dw   V\        8X  d   \        4       pM%\        P
                  ! VR R 4      pVP                  p\        WV4      pVP                  p	V	P                  pV	P                  pV	P                  p\        SV `5  WVWER7      p
\        V
\        4      '       d   \        V
4      hV
# )N)r%   r/   funcname)
isinstancestr__file__globals	importlibimport_module__dict__eval__code__co_filenameco_firstlinenoco_namer;   	set_breakr   )r=   filenamelinenor%   r/   rD   globals_modulefunccoderesrA   s   &&&&&&     r   rR   Bdb.set_breakk   s    h$$8#"9"00#2?!??+D==D''H((F||HgI&*   ?c33-
r   c                   < \         SV `  W4      w  V n        V n        V P                  V P                  ,          ^ ,          V n        V P                  V P                  3# )    )r;   	get_stackstackindexr>   )r=   ftrA   s   &&&r   r]   Bdb.get_stack   sG    !&!21!8
DJZZ

+A.
zz4::%%r   c                Z    V P                  V4      pV;P                  ^,          un        R# )z8Increment the ignore count of Breakpoint number 'bpnum'.N)get_bpbynumberr)   r=   bpnumr0   s   && r   
set_ignoreBdb.set_ignore   s      '
		Q	r   c                6    V P                  V4      pR Vn        R# )TNrd   r&   re   s   && r   
set_enableBdb.set_enable   s      '
r   c                6    V P                  V4      pR Vn        R# )FNrj   re   s   && r   set_disableBdb.set_disable   s      '
r   c                N    V P                  W4      pV'       d   \        V4      hR # r   )clear_breakr   )r=   fnamerT   errs   &&& r   	set_clearBdb.set_clear   s$    u-3- r   c                    V P                   '       g   \        R4      hV ;P                   ^,          un         V P                  V P                   ,          ^ ,          V n        R# )zMove up in the frame stack.zOldest frameN)r_   r   r^   r>   r=   s   &r   set_up
Bdb.set_up   s<    zzz>**

a
ZZ

+A.
r   c                    V P                   ^,           \        V P                  4      8X  d   \        R4      hV ;P                   ^,          un         V P                  V P                   ,          ^ ,          V n        R# )zMove down in the frame stack.zNewest frameN)r_   lenr^   r   r>   rw   s   &r   set_downBdb.set_down   sK    ::>S_,>**

a
ZZ

+A.
r   )r:   r>   r_   r^   )FNN)r   r   r   r   r   r<   rR   r]   rg   rk   rn   rt   rx   r|   r   __classdictcell____classcell__rA   __classdict__s   @@r   r8   r8   d   s:     .9(&

 
// /r   r8   c                      a a ] tR t^t oRtRV 3R lltR tV 3R ltR tR t	R t
R tR	 tR
 tR tR tR tR tR tR tR tR tR tRR ltR tR tRtVtV ;t# )Tracerz$A tracer for testing the bdb module.c                   < \         SV `  VR 7       Wn        W0n        Ve
   RV,          MRV n        V P                  4        R# )skipNzDry-run results for %s:)r;   __init__
expect_setdry_runheader	init_test)r=   r   r   r   	test_caserA   s   &&&&&r   r   Tracer.__init__   sA    d#$ , 19<26 	r   c                    R V n         ^ V n        R V n        \        \	        V P
                  ^ R ^4      4      V n        \        \	        V P
                  ^R ^4      4      V n        R # r   )
cur_exceptexpect_set_nobreakpoint_hitslistr   r   expected_listset_listrw   s   &r   r   Tracer.init_test   sP    #!&!T1"EFVDOOQa@Ar   c                   < V P                   e   V P                   hVR8X  d    \        SV `	  WV4      pV# \        SV `	  WV4      #   \         d   pYPn         T P                  u R p?# R p?ii ; i)N	exception)r   r;   r<   r	   )r=   r>   r?   r@   rY   erA   s   &&&&  r   r<   Tracer.trace_dispatch   ss    
 ??&//!K+g,U3?

 7)%<<	   +"#***+s   A A-A("A-(A-c                |    V P                  V4      '       g   R # V P                  RW4       V P                  4        R # )Ncall)	stop_hereprocess_eventnext_set_method)r=   r>   argument_lists   &&&r   	user_callTracer.user_call   s2     ~~e$$658r   c                F   V P                  R V4       V P                  '       dV   V P                  '       dD   \        4       P	                  R4      pVP                  R4       F  p\        RV,           4       K  	  V P                  4        RV n        V P                  4        R# )r.   r#   z  N)	r   r   r   r6   stripsplitprintdelete_temporariesr   )r=   r>   r3   r.   s   &&  r   	user_lineTracer.user_line   sx    65)<<<D000#%++D1D

4(dTk" )!#r   c                J    V P                  R W4       V P                  4        R# )returnNr   r   )r=   r>   return_values   &&&r   user_returnTracer.user_return   s    8U9r   c                V    W n         V P                  R V4       V P                  4        R# )r   N)exc_infor   r   )r=   r>   r   s   &&&r   user_exceptionTracer.user_exception   s#     ;.r   c                J    V P                  R V4       V P                  4        R# )opcodeNr   )r=   r>   s   &&r   user_opcodeTracer.user_opcode   s    8U+r   c                0    V P                   .pW"3V n        R # r   )r:   r   )r=   r@   r1   s   && r   do_clearTracer.do_clear   s    >>" '1r   c                    V P                   '       d.   V P                   ^,           F  pV P                  V4       K  	  R# R#    N)r   clear_bpbynumber)r=   ns   & r   r   Tracer.delete_temporaries   s9    ))!,,%%a( -  r   c                   V ;P                   ^,          un          V P                  P                  ^ 4      V n        T P                  P                  ^ 4      T n        R#   \         d    \        RT P                   ,          4      hi ; i)r   z-expect_set list exhausted, cannot pop item %dN)r   r   popexpect
IndexErrorr   r   	set_tuplerw   s   &r   pop_nextTracer.pop_next   sw    a	$,,003DK
 **1-	  	$%?""#$ $	$s    A (Bc           	     |   R pVR8X  d   V P                   ^,          pV P                  W$4       V P                  e)   V P                  '       g   V P                  .pV. 3V n        Wn        V P                  4        V P                  '       d   V P                  V P                  4       R # V P                  '       d5   V P                  V P                  ^ ,          VR4       V P                  4        VR	9   d   V P                  ^4       R # \        V P                  4      ^8  Ed   VR8X  Ed   V P                  ^,          w  rg\        VP                  4       4      pV P                  '       g#   V P!                  RV P"                  ,          4       V P                  WP                  ^ ,          R4       T P                  V U	u. uF  qV	,          NK  	  up	V P                  ^ ,           U	u. uF  p	V P%                  V	4      P&                  NK   	  up	R4       V P                  \        V4      V P                  ^,          R4       R # VR8X  dg   \)        V P                   ^,          V P                  ^,          4      '       g1   V P!                  RV P"                  V P                   3,          4       R # R # R # R # u up	i u up	i )
Nr   zWrong event typer.   z(No breakpoints hit at expect_set item %dzBreakpoint numbers do not matchzWrong breakpoint hit countzWrong temporary breakpointsz/Wrong exception at expect_set item %d, got '%s')r   r   )r   r]   r:   r   r?   r   r   print_stater   r   check_equalcheck_lno_namecheck_expect_max_sizer{   sortedkeysraise_not_expectedr   rd   r(   rF   )
r=   r?   r>   argstbr1   bpstemporariesbpnumsr   s
   &&&*      r   r   Tracer.process_event   sB    Kq!Bu! >>%d.B.B.B~~&G$+R=D  
<<<T[[) ;;;T[[^U4FG!&&&&q)!#';;q> 
++++++B**+,   )=)=a)@57  &!9&Qa&&&!9!11!464 ((+004602   !4d6J6J16M13 +%!$--"2DKKNCC++I++T]];<= D &# " ":6s    J4($J9
c                ^    W8X  d   R # V P                  RW0P                  V3,          4       R # )Nz"%s at expect_set item %d, got '%s')r   r   )r=   expectedresultmsgs   &&&&r   r   Tracer.check_equal1  s1     D!$&8&8& A!B 	Cr   c                <   \        V P                  4      pV^8  d5   V P                  4       pV P                  V P                  ^,          VR4       V^8  dE   V P                  V P                  ^,          V P                  P
                  P                  R4       R# R# )z+Check the line number and function co_name.zWrong line numberzWrong function nameN)r{   r   lno_abs2relr   r>   f_coderQ   )r=   srT   s   &  r   r   Tracer.check_lno_name7  sz    q5%%'FT[[^V5HIq5T[[^TZZ->->-F-F0EG r   c                    \        V P                  4      V8  d(   \        R V P                  : RV P                  : 24      hR# )zInvalid size of the z expect tuple: N)r{   r   r   r?   )r=   sizes   &&r   r   Tracer.check_expect_max_sizeA  s7    t{{d" "&**dkk"; < < #r   c                   V P                  V P                  P                  P                  4      pV P                  P                  pWP                  \
        4      8X  d.   W P                  P                  P                  ,
          ^,           # T# r   )canonicr>   r   rO   f_linenorH   rP   r=   rr   rT   s   &  r   r   Tracer.lno_abs2relF  sh    TZZ..::;$$X.. **++:::Q> 	<4:	<r   c                    V'       dX   V P                  V4      V P                  \        4      8X  d/   V P                  P                  P                  V,           ^,
          # T# r   )r   rH   r>   r   rP   r   s   &&&r   lno_rel2absTracer.lno_rel2absL  sJ    4<<.$,,x2HH 

!!0069A= 		r   c                   V P                  4       pV P                  P                  P                  pR V P                  W3,          pV P
                  '       d   RpV P
                  ^ ,           F;  pVR8w  d
   VR,          pWE: RV P                  V4      P                  : 2,          pK=  	  VR,          pRV,           R,           \        V P
                  ^,          4      ,           R,           pVRV,           ,          pM<V P                  R8X  d,   VRV P                  ^ ,          P                  ,           ,          pVR,          pVP                  ^ 4      \        V P                  4      ,           R	,           # )
z('%s', %d, '%s'{z, z: }()r   z), ,)r   r>   r   rQ   r?   r   rd   r(   rG   r   r   ljustr   )r=   rT   rQ   stater   r   s   &     r   	get_stateTracer.get_stateQ  s&   !!#**##++!TZZ$AAC))!,,#:4KC1d&9&9!&<&A&ABB - 3JC)d"S)=)=a)@%AACGCTCZEZZ;&TDMM!,5555E{{2T^^!44s::r   c                    Ve'   V P                   ^8X  d   \        4        \        V4       \        RV P                   V P                  4       3,          4       R # )Nz%d: %s)r   r   r   )r=   r   s   &&r   r   Tracer.print_statec  s@    $"4"4"9G&Mh$,,dnn.>??@r   c                    VR ,          pVR\        V P                  4      ,          ,          pVRV P                  4       ,           ,          p\        V4      h)r#   z  Expected: %s
z  Got:      )rG   r   r   r   r=   r   s   &&r   r   Tracer.raise_not_expectedi  sE    t!C$444~ 000!#&&r   c                   V P                   ^ ,          p\        V P                   4      ^8X  d   V P                   ^,          MRp\        V RV,           4      pVR9   d
   V! 4        R# VR9   d   V! V P                  4       R# VR8X  dW   RpV'       d8   V P	                  V P                  P
                  P                  V^ ,          4      pV! V P                  V4       R# V'       d   VR9   g   VR9   d   VR	9   d1   VvrTpV P	                  WT4      pWT.pVP                  V4       V! V!   MVR
9   d   V! V!   MVR9   d   V! 4        RV n        V P                  4        V P                  '       d   V P                  4        M3V P                  '       d   V P                  4        V P                  ^4       V P                  4        R# \!        RV P                   ,          4      h)r\   Nset_untilz"%s" is an invalid set_tuple)step	stepinstrcontinuequit)nextr   )breakclearr)   enabledisable)updown)r  r  )r)   r  r  )r   r{   getattrr>   r   r   rO   extendr?   r   r   r   r   r   r   r   r   )r=   set_typer   
set_methodrT   rr   remains   &      r   r   Tracer.next_set_methodo  s   >>!$$'$71$<t~~a $T6H#45
 @@L++tzz" F))$***;*;*G*G*.q'3tzz6* X "/ /3;~3M--)-&))%8F#D!<<D!^+ DJMMO|||  ";;;'')**1-  " !?!%"0 1 1r   )r   r   r   r?   r   r   r   r   r   r   r   r   )NFNr   )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   s   @@r   r   r      s{     .B=$
2
)
.0=dCG<
<
;$A'01 01r   r   c                   >   a  ] tR tRt o RtRR ltR tR	R ltRtV t	R# )
	TracerRuni  zAProvide a context for running a Tracer instance with a test case.Nc                    Wn         VP                  V n        \        VP                  VV P                  VP	                  4       R 7      V n        RV n        R# ))r   r   r   N)r   r   r   r   idtracer_original_tracer)r=   r   r   s   &&&r   r   TracerRun.__init__  sB    " ((Y11%)\\Y\\^M $r   c                b    \        4        \        P                  ! 4       V n        V P                  # r   )r   sysgettracer  r  rw   s   &r   	__enter__TracerRun.__enter__  s      #{{r   c                "   \        4        \        P                  ! V P                  4       R pV P                  P
                  '       dT   VR,          pVRV P                  P                  ,          ,          pV\        V P                  P
                  4      ,          pVe   \        \        V4      '       d   \        V\        4      '       dy   VP                  '       dg   VP                  ^ ,          pV'       d   VRV,           ,          pV P                  '       d   \        V4       R# V P                  P!                  V4       MQ R4       hV'       d=   V P                  '       d   \        V4       R# V P                  P!                  V4       R# R# )r!   z+All paired tuples have not been processed, zthe last one was number %d
Nr#   Tz#BdbNotExpectedError with empty args)r   r  settracer  r  r   r   repr
issubclassr   rF   BaseExceptionr   r   r   r   fail)r=   type_value	traceback	not_emptyerr_msgs   &&&&  r   __exit__TracerRun.__exit__  s   T**+	;;FFI8++334 5Idkk2233I ,?!G!G%//EJJJ**Q-ti//G<<<'NNN''0CCCu|||i ##I.	 r   )r  r   r   r  r   )NNN)
r   r   r   r   r   r   r  r%  r   r~   r   s   @r   r  r    s     K%/ /r   r  c           	        R pRR.pVP                  V4       \        4       pRVn        R Vn        \	        V! \        R4      \        V4      4      4      Vn        \        V 4      ;_uu_ 4        \        WRR7      ;_uu_ 4       pVP                  \        4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)	a  Run a test and print the dry-run results.

'modules':  A dictionary mapping module names to their source code as a
            string. The dictionary MUST include one module named
            'test_module' with a main() function.
'set_list': A list of set_type tuples to be run on the module.

For example, running the following script outputs the following results:

*****************************   SCRIPT   ********************************

from test.test_bdb import run_test, break_in_func

code = '''
    def func():
        lno = 3

    def main():
        func()
        lno = 7
'''

set_list = [
            break_in_func('func', 'test_module.py'),
            ('continue', ),
            ('step', ),
            ('step', ),
            ('step', ),
            ('quit', ),
        ]

modules = { 'test_module': code }
run_test(modules, set_list)

****************************   results   ********************************

1: ('line', 2, 'tfunc_import'),    ('next',),
2: ('line', 3, 'tfunc_import'),    ('step',),
3: ('call', 5, 'main'),            ('break', ('test_module.py', None, False, None, 'func')),
4: ('None', 5, 'main'),            ('continue',),
5: ('line', 3, 'func', ({1: 1}, [])), ('step',),
  BpNum Temp Enb Hits Ignore Where
  1     no   yes 1    0      at test_module.py:2
6: ('return', 3, 'func'),          ('step',),
7: ('line', 7, 'main'),            ('step',),
8: ('return', 7, 'main'),          ('quit',),

*************************************************************************

c              3   r   "     \        V 4      p\        V4      pVx  Vx  K!    \         d     R# i ; i5ir   )r  StopIteration)abxys   &&  r   genrun_test.<locals>.gen  s:     	GG 		s   7!% 4747Tc                      R # r   r
   r
   r   r   <lambda>run_test.<locals>.<lambda>  s    tr   r   Nr  r   r
   )r	  BaseTestCaser   r  r   r   iterr   create_modulesr  runcalltfunc_import)modulesr   r   r/  sltestr  s   &&&    r   run_testr>    s    f j	!BIIh>DDLDG3vbz4845DO		 	 t''6NN<( ( 
!	 '' 
!	 	 s$   .B>B+	B>+B;6B>>C	c              #   $  "   \         P                  ! 4       ;_uu_ 4        \        P                  P	                  \
        P                  ! 4       4        V  Fl  pVR ,           p\        VRRR7      ;_uu_ 4       pVP                  \        P                  ! W,          4      4       RRR4       \        P                  ! V4       Kn  	  \        P                  ! 4        Rx  V  F  p\        P                   ! V4       K  	  \        P                  P#                  4         RRR4       R#   + '       g   i     L; i  T  F  p\        P                   ! T4       K  	  \        P                  P#                  4        i ; i  + '       g   i     R# ; i5i).pywzutf-8)encodingN)r   temp_cwdr  r+   appendr*   getcwdopenwritetextwrapdedent	linecache
checkcacherJ   invalidate_cachesr   forgetr   )r;  mrr   r`   s   &   r   r8  r8    s     							$	E	%w771GGHOOGJ78 8$$U+	 
 '')$$Q' HHLLN 
	
 87 $$Q' HHLLN 
		sL   F3E<$D:8,D'$;D:=E<
F'D72D::?E99E<<F		FFc                     R VRW#V 33# )r  Nr
   )rD   rr   r%   r/   s   &&&&r   break_in_funcrP  +  s    UD)8<<<r   test_module_for_bdbr@  c                  .    ^ RI p V P                  4        R# )r\   N)rQ  main)rQ  s    r   r:  r:  0  s    r   c                  >    ^p \        4        \        4        ^p ^p ^p R#    N)tfunc_firsttfunc_secondlnos    r   
tfunc_mainr[  4  s     
CMN
C
C
Cr   c                      ^p ^p ^p R# rU  r
   rY  s    r   rW  rW  <  s    
C
C
Cr   c                  
    ^p R# rU  r
   rY  s    r   rX  rX  A  s    
Cr   c                   2   a  ] tR tRt o Rt]tRR ltRtV tR# )r6  iD  zBase class for all tests.Nc                &    V P                  V4      R hr   )failureExceptionr   s   &&r   r  BaseTestCase.failI  s     ##C(d2r   r
   r   )	r   r   r   r   r   r   r  r   r~   r'  s   @r   r6  r6  D  s     #G3 3r   r6  c                      a  ] tR tRt o RtR tR tR tR tR t	R t
R	 tR
 tR tR tR tR t]! ]P&                  4      R 4       tR tR tR tRtV tR# )StateTestCaseiN  z;Test the step, next, return, until and quit 'set_' methods.c                    . ROV n         \        V 4      ;_uu_ 4       pVP                  \        4       RRR4       R#   + '       g   i     R# ; i)r.   N)r.   rV  r[  r5  r.      r[  r5  r   r   rW  r5  r.   rV  rW  r   r   r  r9  r[  r=   r  s   & r   	test_stepStateTestCase.test_stepQ  0    
 t__NN:& ___	   =A	c                V   R F{  pV P                  VR7      ;_uu_ 4        RRR	RR
R\        ^33RRR^R^^/. 33V3RR.V n        \        V 4      ;_uu_ 4       pVP	                  \
        4       RRR4       RRR4       K}  	  R#   + '       g   i     L; i  + '       g   i     K  ; i)r   r
  r.   rW  r  N)r   r  re  r5  rf  rh  )Noner   rW  r   r.      rW  rj  )subTestrH   r   r  r9  r[  )r=   r
  r  s   &  r    test_step_next_on_last_statement.StateTestCase.test_step_next_on_last_statement[  s    (Hx00-Z-Z.gRS}=U.^Q1r{;h\.Z# t__NN:. % 10 ) %_ 100s#   8BB.BBBB(c                    . ROV n         \        V 4      ;_uu_ 4       pVP                  \        4       RRR4       R#   + '       g   i     R# ; i)r.   N)re  )r   )r   rV  r[  r4  rf  rj  rk  rl  s   & r   test_stepinstrStateTestCase.test_stepinstri  s0    

 t__NN:& ___rp  c                    . ROV n         \        V 4      ;_uu_ 4       pVP                  \        4       RRR4       R#   + '       g   i     R# ; i)r.   N)
re  r5  rf  r4  r.   rv  r[  r5  )r   r   rX  r5  )r.   rV  rX  rj  rk  rl  s   & r   	test_nextStateTestCase.test_nextr  0    
 t__NN:& ___rp  c           	        R p\         V/p\        V4      ;_uu_ 4        . ROV n        \        V 4      ;_uu_ 4       pVP	                  \
        4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)9
            def main():
                lno = 3
        N)r.   rV  r:  r4  r.   rg  r:  rj  )TEST_MODULEr8  r   r  r9  r:  r=   rX   r;  r  s   &   r   test_next_over_import#StateTestCase.test_next_over_import}  sc      'G$$DO 4F|, ! %$
 ! %$$s"   A6A#	A6#A3.A66B	c                    . ROV n         \        V 4      ;_uu_ 4       pVP                  \        4       RRR4       R#   + '       g   i     R# ; i)r.   N)re  r5  rf  r5  rh  r4  ri  rj  rk  rl  s   & r   test_next_on_plain_statement*StateTestCase.test_next_on_plain_statement  s0    
 t__NN:& ___rp  c                    . ROV n         \        V 4      ;_uu_ 4       pVP                  \        4       RRR4       R#   + '       g   i     R# ; i)r.   N)
re  r5  rf  r5  rh  r  rs  rg  r[  r4  r~  rj  rk  rl  s   & r   test_next_in_caller_frame'StateTestCase.test_next_in_caller_frame  s0    
 t__NN:& ___rp  c                    . ROV n         \        V 4      ;_uu_ 4       pVP                  \        4       RRR4       R#   + '       g   i     R# ; i)r.   N)re  r5  rf  r5  rh  r5  ri  r   r   rv  rW  r5  r~  rj  rk  rl  s   & r   test_returnStateTestCase.test_return  s0    
 t__NN:& ___rp  c                    . ROV n         \        V 4      ;_uu_ 4       pVP                  \        4       RRR4       R#   + '       g   i     R# ; i)r.   N)
re  r5  rf  r5  rh  r  r  r  )r      r[  rj  rk  rl  s   & r   test_return_in_caller_frame)StateTestCase.test_return_in_caller_frame  r  rp  c                    . ROV n         \        V 4      ;_uu_ 4       pVP                  \        4       RRR4       R#   + '       g   i     R# ; i)r.   N)
re  r5  rf  r5  rh  r5  ri  )r   )rv  ru  rj  rk  rl  s   & r   
test_untilStateTestCase.test_until  r  rp  c           	         R\        R4      RRR ^R^^/. 33RRR.V n        \        V 4      ;_uu_ 4       pVP                  \        4       RRR4       R#   + '       g   i     R# ; i)	r.   rW  Nre  )rs  rV  r[  rt  )r   )i'  r  rj  )rP  r   r  r9  r[  rl  s   & r   test_until_with_too_large_count-StateTestCase.test_until_with_too_large_count  s[    %]=5Q%^Q1r{35H(Z	
 t__NN:& ___s   AA%	c                    . ROV n         \        V 4      ;_uu_ 4       pVP                  \        4       RRR4       R#   + '       g   i     R# ; i)r.   N)
re  r5  rf  r5  rh  r  r  )r   )   )r.   r  r[  rj  rk  rl  s   & r   test_until_in_caller_frame(StateTestCase.test_until_in_caller_frame  r  rp  c           	     z   R  \         P                   4       \         P                  R&   Rp\        V/p\        V4      ;_uu_ 4        . ROV n        RRR\        3p\        WR7      ;_uu_ 4       pVP                  \        4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)	c              3   l   "   T F*  pVP                   P                  R 4      '       g   K&  Vx  K,  	  R# 5i)_frozen_importlibN)r   
startswith).0items   & r   	<genexpr>*StateTestCase.test_skip.<locals>.<genexpr>  s,      
%))*=> D%s   #4
4:NNNr  z
importlib*	zipimportzencodings.*r   N)r  r5  r  rj  )r  	meta_pathr  r8  r   r  r9  r:  )r=   rX   r;  r   r  s   &    r   	test_skipStateTestCase.test_skip  s    

a  'G$$DO !+}kJD4++v|, , %$ ,+ %$$s$   (B).B	B)B&!B))B:	c                b    \        R .R7      pV P                  VP                  R4      R4       R# )z	anything*r   NF)r8   assertIsis_skipped_module)r=   bdbs   & r   test_skip_with_no_name_module+StateTestCase.test_skip_with_no_name_module  s)     }%c++D159r   c                    RR.V n         \        V 4      ;_uu_ 4       pV P                  \        VP                  \
        4       RRR4       R#   + '       g   i     R# ; i)r.   Nre  )r  )r   r  assertRaisesr   r9  r[  rl  s   & r   	test_downStateTestCase.test_down  sA     &z
 t__h
C ___   &AA	c                    . ROV n         \        V 4      ;_uu_ 4       pVP                  \        4       RRR4       R#   + '       g   i     R# ; i)r.   N)re  r5  rf  r5  rh  r  r  rj  rk  rl  s   & r   test_upStateTestCase.test_up  ro  rp  r   N)r   r   r   r   r   rm  rx  r{  r  r  r  r  r  r  r  r  r  r   r  r  r  r  r  r  r   r~   r'  s   @r   rc  rc  N  sv     E'/'	'-
''
'	'	''	' - -2:D' 'r   rc  c                   f   a  ] tR tRt o RtR tR tR tR tR t	R t
R	 tR
 tR tR tR tRtV tR# )BreakpointTestCasei  zTest the breakpoint set method.c                    RR.V n         \        V 4      ;_uu_ 4       pV P                  \        VP                  \
        4       RRR4       R#   + '       g   i     R# ; i)r.   Nr  )r  )z/non/existent/module.pyr   )r   r  r  r   r9  r:  rl  s   & r   test_bp_on_non_existent_module1BreakpointTestCase.test_bp_on_non_existent_module  s@    ')R
 t__hE ___r  c           	     D   R p\         V/p\        V4      ;_uu_ 4        RR\        ^33.V n        \	        V 4      ;_uu_ 4       pV P                  \        VP                  \        4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)r  r  Nr  )	r  r8  TEST_MODULE_FNAMEr   r  r  r   r9  r:  r  s   &   r   test_bp_after_last_statement/BreakpointTestCase.test_bp_after_last_statement  s}      'G$$+g8I17M-NDO 4F!!(FNNLI !	 %$ !	 %$$s#   %B&A;	)B;BBB	c                   R p\         V/p\        V4      ;_uu_ 4        R\        R\        R4      R\        R\        R4      RRR^R^^/^.33RR^R^^/^.33R.
V n        \        V 4      ;_uu_ 4       pVP                  \        4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)	
            def func():
                lno = 3

            def main():
                for i in range(2):
                    func()
        r.   rW   TNr  rs  rV  r:  rt  rj  r  r8  rP  r  r   r  r9  r:  r  s   &   r   test_temporary_bp$BreakpointTestCase.test_temporary_bp%  s      'G$$+!&*;TB+!&*;TB+>FaUQCL1>FaUQCL1:DO 4F|, ! %$ ! %$$s$   AB.3B		B.B+&B..B?	c                   R p\         V/p\        V4      ;_uu_ 4        R\        R\        4      R\        R\        R4      RRRRR^R^^/. 33R	R
RR
RR^R^^/^.33RR
RR^R^^/. 33R.V n        \        V 4      ;_uu_ 4       pVP                  \        4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)
            def func():
                lno = 3

            def main():
                for i in range(3):
                    func()
        r.   rW   TNr  r  )r  rV  rt  )r  r  rs  rg  rW   r  r   r  r   rj  r  r  s   &   r   test_disabled_temporary_bp-BreakpointTestCase.test_disabled_temporary_bp<  s      'G$$+!&*;<+!&*;TB+3E+>FaUBK03D#3E#>FaUQCL13D#>FaUBK0:DO 4F|, ! %$ ! %$$s$   A%B>B+	B>+B;6B>>C	c                L   R p\         V/p\        V4      ;_uu_ 4        R\        R\        RR4      RRR^R^^/. 33R	.V n        \        V 4      ;_uu_ 4       pVP                  \        4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)
z
            def func(a):
                lno = 3

            def main():
                for i in range(3):
                    func(i)
        r.   rW   Fza == 2Nr  r  rt  rj  r  r  s   &   r   test_bp_condition$BreakpointTestCase.test_bp_conditionX  s      'G$$+!&*;UHM+>FaUBK0:	DO 4F|, ! %$ ! %$$#   9BA?	-B?B
BB#	c                L   R p\         V/p\        V4      ;_uu_ 4        R\        R\        RR4      RRR^R^^/. 33R	.V n        \        V 4      ;_uu_ 4       pVP                  \        4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)
zk
            def func(a):
                lno = 3

            def main():
                func(0)
        r.   rW   Fz1 / 0Nr  r  rt  rj  r  r  s   &   r   )test_bp_exception_on_condition_evaluation<BreakpointTestCase.test_bp_exception_on_condition_evaluationl  s      'G$$+!&*;UGL+>FaUBK0:	DO 4F|, ! %$ ! %$$r  c                L   R p\         V/p\        V4      ;_uu_ 4        R\        R\        4      RRRRR^R^^/. 33R.V n        \        V 4      ;_uu_ 4       pVP                  \        4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)	r  r.   rW   Nr  r  r)   r   rt  rj  r  r  s   &   r   test_bp_ignore_count'BreakpointTestCase.test_bp_ignore_count  s      'G$$+!&*;<+2C+.FaUBK0*DO 4F|, ! %$ ! %$$r  c                   R p\         V/p\        V4      ;_uu_ 4        R\        R\        4      R\        R\        4      RRRRRRR^R^^/. 33R	R
RR^R^^/. 33RR^R^^/. 33R.V n        \        V 4      ;_uu_ 4       pVP                  \        4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)r  r.   rW   Nr  r  r  r  rt  r  r  rj  r  r  s   &   r    test_ignore_count_on_disabled_bp3BreakpointTestCase.test_ignore_count_on_disabled_bp  s      'G$$+!&*;<+!&*;<+2C+2D+.FaUBK02C#.FaUBK0.FaUBK0*DO 4F|, ! %$ ! %$$s$   A!B:?B'	B:'B72B::C	c                   R p\         V/p\        V4      ;_uu_ 4        RR\        ^33RR\        ^33RR\        ^33RRR^R^^/. 33RR^R^^/. 33R\        ^33R	RR^R^^/. 33R
.V n        \	        V 4      ;_uu_ 4       pVP                  \        4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)z
            def func():
                lno = 3
                lno = 4

            def main():
                for i in range(3):
                    func()
        r.   r  rW   r  Nr  r  rt  )rs  rv  rW   rj  )r  r8  r  r   r  r9  r:  r  s   &   r   test_clear_two_bp_on_same_line1BreakpointTestCase.test_clear_two_bp_on_same_line  s      'G$$+7=NPQ<R2S+7=NPQ<R2S+7=NPQ<R2S+.FaUBK0.FaUBK07=NPQ<R2S#.FaUBK0*	DO 4F|, ! %$ ! %$$s$   A#B<B)	B<)B94B<<C	c                    RR\         ^33.V n        \        V 4      ;_uu_ 4       pV P                  \        VP
                  \        4       RRR4       R#   + '       g   i     R# ; i)r.   r  Nr  )rH   r   r  r  r   r9  r:  rl  s   & r   test_clear_at_no_bp&BreakpointTestCase.test_clear_at_no_bp  sH    ''Ha=)A
 t__hE ___s   &AA&	c                   \        4        \        4       pVP                  \        4      pVP	                  \        ^4       V P                  VP                  4       V^./4       \        4       pVP	                  \        ^4       VP	                  \        ^4       VP	                  \        ^4       V P                  VP                  4       V^./4       V P                  VP                  4       V. RO/4       VP                  \        ^4       V P                  VP                  4       V^./4       V P                  VP                  4       V. RO/4       \        4       pV P                  VP                  4       V^./4       V P                  VP                  4       V. RO/4       V P                  VP                  4       V. RO/4       VP                  \        ^4       V P                  VP                  4       V^./4       V P                  VP                  4       V^^./4       V P                  VP                  4       V. RO/4       \        4       pVP	                  \        ^4       V P                  VP                  4       V^./4       V P                  VP                  4       V^^./4       V P                  VP                  4       V. RO/4       V P                  VP                  4       V. RO/4       \        4        \        4       pVP	                  \        ^4       V P                  VP                  4       V^./4       V P                  VP                  4       V^^./4       V P                  VP                  4       V. RO/4       V P                  VP                  4       V. RO/4       V P                  VP                  4       V^./4       R# )r   N)r   rV  rg  rv  )rV  rg  rv  )rg  rv     )r   r8   r   rH   rR   assertEqualget_all_breaksrq   )r=   db1rr   db2db3db4db5s   &      r   (test_load_bps_from_previous_Bdb_instance;BreakpointTestCase.test_load_bps_from_previous_Bdb_instance  s   eH%h"++-s|<eh"h"h"++-s|<++-|/DE!$++-s|<++-y/ABe++-s|<++-y/AB++-y/AB!$++-s|<++-1v?++-y/ABeh"++-s|<++-1v?++-y/AB++-y/ABeh"++-s|<++-1v?++-y/AB++-y/AB++-s|<r   r  N)r   r   r   r   r   r  r  r  r  r  r  r  r  r  r  r  r   r~   r'  s   @r   r  r    sG     )FJ-.-8-(-&-*-6-2F(= (=r   r  c                   0   a  ] tR tRt o RtR tR tRtV tR# )RunTestCasei  z Test run, runeval and set_trace.c           	         R p. ROV n         \        V 4      ;_uu_ 4       pVP                  \        \        P
                  ! V4      RR4      4       RRR4       R#   + '       g   i     R# ; i)
            lno = 2
        <string>execN)r.   rV  <module>r5  r   rV  r  rj  r   r  runcompilerH  rI  r=   rX   r  s   &  r   test_run_stepRunTestCase.test_run_step  sI    
 t__JJwxt4j&IJ ___   1AA+	c           	        R p\         V/p\        V4      ;_uu_ 4        . ROV n        ^ RIpRV/p\	        V 4      ;_uu_ 4       pVP                  RWD4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)r  NrQ  ztest_module_for_bdb.main())
)r.   r   r  r5  )r   rV  rS  r5  )r.   rg  rS  r5  )r   rg  rS  r5  )r   r   r  rj  )r  r8  r   rQ  r  runeval)r=   rX   r;  rQ  nsr  s   &     r   test_runeval_stepRunTestCase.test_runeval_step	  st      'G$$DO '')<=B4F;RD ! %$ ! %$$s#   %A;A(	A;(A83A;;B	r  N)	r   r   r   r   r   r  r	  r   r~   r'  s   @r   r  r    s     *
KE Er   r  c                   H   a  ] tR tRt o RtR tR tR tR tR t	R t
R	tV tR
# )IssuesTestCasei  zTest fixed bdb issues.c                P   R pRp\         VRV/p\        V4      ;_uu_ 4        R\        RR4      RR	R^R^^/. 33R
RR
RR.
V n        \	        V 4      ;_uu_ 4       pVP                  \        4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)z
            from test_module_for_bdb_2 import func
            def main():
                func()
                lno = 5
        z9
            def func():
                lno = 3
        test_module_for_bdb_2r.   rW   ztest_module_for_bdb_2.pyNr  r  rt  r5  )r   rg  rW   )r.   r  rS  rj  )r  r8  rP  r   r  r9  r:  )r=   code_1code_2r;  r  s   &    r   +test_step_at_return_with_no_trace_in_caller:IssuesTestCase.test_step_at_return_with_no_trace_in_caller   s    
 #V
 G$$+!&*DE+.FaUBK0*%*#*DO 4F|, ! %$ ! %$$s#   7BB	/BBBB%	c                b   R p\         V/pR F  pV P                  VR7      ;_uu_ 4        \        V4      ;_uu_ 4        R	\        R\        4      R
RR^R^^/. 33V3.V n        VR8X  d)   V P
                  P                  R^
R\        3RRR.4       MV P
                  P                  RR.4       \        V 4      ;_uu_ 4       pVP                  \        4       RRR4       RRR4       RRR4       K  	  R#   + '       g   i     L&; i  + '       g   i     L1; i  + '       g   i     EK!  ; i)z
            def test_gen():
                yield 0
                lno = 4
                return 123

            def main():
                it = test_gen()
                next(it)
                next(it)
                lno = 11
        r   rr  r.   test_genr   rS  N)r  r   r   r  r  rt  r5  )r   
   rS  rj  r.   rv  r  )r  rw  r8  rP  r  r   r	  r*  r  r9  r:  )r=   rX   r;  r
  r  s   &    r   #test_next_until_return_in_generator2IssuesTestCase.test_next_until_return_in_generator>  s   
  '3Hx00#G,,3)*6GH3nJ!A<xl	'DO  8+..)2v}Ey3z ..4jB #4F|4 )% - 10 4( )% -, 100s;   DBD	C6D	 D6DD		DDD.c                l   R p\         V/p\        V4      ;_uu_ 4        R\        R\        4      RRR^R^^/. 33R	R
R	RR	RR	R^	R\        3RRR.V n        \        V 4      ;_uu_ 4       pVP                  \        4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)z
            def test_gen():
                yield 0
                lno = 4
                yield 1
                return 123

            def main():
                for i in test_gen():
                    lno = 10
                lno = 11
        r.   r  r   rS  Nr  r  rt  r4  r  )r.   r  r  )r.   r  r  r5  )r.      rS  rj  	r  r8  rP  r  r*  r   r  r9  r:  r  s   &   r   'test_next_command_in_generator_for_loop6IssuesTestCase.test_next_command_in_generator_for_loopg  s      'G$$+!*.?@+J!A4'''a7$DO 4F|, ! %$ ! %$$s$   A	B"'B	=B"BB""B3	c                d   R p\         V/p\        V4      ;_uu_ 4        R\        R\        4      RRR^R^^/. 33R	R
R	R^R\        3RRR.V n        \        V 4      ;_uu_ 4       pVP                  \        4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)4  
            def test_subgen():
                yield 0
                return 123

            def test_gen():
                x = yield from test_subgen()
                return 456

            def main():
                for i in test_gen():
                    lno = 12
                lno = 13
        r.   r  r   rS  Nr  r  rt  r4  )r.      r  r5  r.      rS  rj  r  r  s   &   r   /test_next_command_in_generator_with_subiterator>IssuesTestCase.test_next_command_in_generator_with_subiterator  s      'G$$+!*.?@+.J!A4*'*b&-8*$*	DO 4F|, ! %$ ! %$$s$   AB#B	9BBBB/	c                t   R p\         V/p\        V4      ;_uu_ 4        R\        R\        4      RR	R^R^^/. 33R
R^R\        3R
R^R\        3RRR.V n        \        V 4      ;_uu_ 4       pVP                  \        4       RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i)r  r.   test_subgenr   r  rS  Nr  r  rt  r  r5  r!  rj  r  r  s   &   r   1test_return_command_in_generator_with_subiterator@IssuesTestCase.test_return_command_in_generator_with_subiterator  s      'G$$+!-1BC+nMQqE2;7la];lb&-8j$j	DO 4F|, ! %$ ! %$$s$   AB&+B	B&B#B&&B7	c           	         R p. ROV n         \        V 4      ;_uu_ 4       pVP                  \        \        P
                  ! V4      RR4      4       RRR4       R#   + '       g   i     R# ; i)r  r  r  N)r  r5  r  r4  r  r  s   &  r   test_next_to_botframe$IssuesTestCase.test_next_to_botframe  sI    
 t__JJwxt4j&IJ ___r  r  N)r   r   r   r   r   r  r  r  r#  r'  r*  r   r~   r'  s   @r   r  r    s.      -<'5R->->->K Kr   r  c                   &   a  ] tR tRt o R tRtV tR# )TestRegressionsi  c                    V P                  R \        4       P                  \        P                  ! 4       R34      4       R# )zWarning: lineno is NoneN)assertInr8   format_stack_entryr  	_getframerw   s   &r   !test_format_stack_entry_no_lineno1TestRegressions.test_format_stack_entry_no_lineno  s-    /e../FG	Ir   r
   N)r   r   r   r   r2  r   r~   r'  s   @r   r-  r-    s     I Ir   r-  __main__r   )0r   r  r   r  r*   unittestrH  rJ   rJ  
contextlibr   	itertoolsr   r   test.supportr   r   r   	Exceptionr	   r   r   r   r   r   r6   r8   r   r  r>  r8  rH   rP  r  r  r:  r[  rW  rX  TestCaser6  rc  r  r  r  r-  r   rS  r
   r   r   <module>r;     sZ  0d  
 	     % $ & " # $9 # E| E H\ H A, A '*>/$(( >/@{1S {1z-/ -/^H)T    #+e$ = $%' 
38$$ 3~'L ~'@i= i=X!E, !EFrK\ rKjIh'' I zMMO r   