
    dafV                        d dl Z d dlmZ d dlZd dlmZmZ d dlmZm	Z	m
Z
 d dlmZmZ d dlZd dlZd dlmZ d dlZd dlmZ d dlmZ d	 Zd
 Zd Zd Zd Zd Zd Zd Zd Zd Zd Z d Z!d Z"d Z# G d de$      Z% G d dejL                        Z' G d dejL                        Z( G d dejL                        Z) G d d ejL                        Z* G d! d"ejL                        Z+ G d# d$ejL                        Z, G d% d&ejL                        Z- G d' d(ejL                        Z. G d) d*ejL                        Z/e0d+k(  r ejb                          yy),    N)dump)captured_stdoutrequires_resource)TESTFNrmtreeunlinkassert_python_okassert_python_failure)FunctionType)Trace)testmodc                 2    | j                  d      r| dd } | S )z8Given a .pyc filename converts it to the appropriate .pyz.pycN)endswith)filenames    */root/Python-3.12.4/Lib/test/test_trace.py
fix_ext_pyr      s      CR=O    c                      t         j                  j                  t         j                  j                  t                    d   } t        t              | fS )z4The .py file and module name of this file (__file__)r   )ospathsplitextbasename__file__r   )modnames    r   my_file_and_modnamer      s:    ggrww//9:1=Gh((r   c                 .    | j                   j                  S N)__code__co_firstlinenofuncs    r   get_firstlinenor$   "   s    =='''r   c                     | }|}||z   }|S r    )xyabcs        r   traced_func_linearr,   ,   s    	A	A	AAHr   c                 4    | }t        d      D ]  }||z  }	 |S N   range)r'   r(   r+   is       r   traced_func_loopr3   2   s(    	A1X 	QHr   c                 8    | |z   t        j                  d      z   S )N   )r   r#   )r'   r(   s     r   traced_func_importingr6   8   s    q57<<?""r   c                 $    t        | |       }|| z   S r   r,   )r'   r+   s     r   traced_func_simple_callerr9   ;   s    1a Aq5Lr   c                 :    t        |       }|t        ||       z  }|S r   )r9   r6   )r'   ks     r   traced_func_importing_callerr<   ?   s#    !!$A	q!	$$AHr   c              #   >   K   d}t        |       D ]	  }||z     y wr.   r0   )numr+   r2   s      r   traced_func_generatorr?   D   s'     	A3Z !es   c                  2    d} t        d      D ]  }| |z  } 	 y )Nr   
   )r?   )r;   r2   s     r   traced_func_calling_generatorrB   I   s$    	A"2& 	Qr   c                     | dz  S N   r&   )r>   s    r   traced_doublerrF   N   s    7Nr   c                  
    | |fS r   r&   )argskwargss     r   traced_capturerrJ   Q   s    <r   c                  V    d} t        |       D cg c]  }t        |       }}|S c c}w )NrA   )r1   rF   )r;   r2   mylists      r    traced_caller_list_comprehensionrM   T   s-    
A).q2AnQ2F2M 3s   &c                  B    d } d }|  |       d               } |        y )Nc                     | S r   r&   fs    r   
decorator1z-traced_decorated_function.<locals>.decorator1Z   s    r   c                      d } | S )Nc                     | S r   r&   rP   s    r   
decorator2zGtraced_decorated_function.<locals>.decorator_fabric.<locals>.decorator2]   s    Hr   r&   rU   s    r   decorator_fabricz3traced_decorated_function.<locals>.decorator_fabric\   s    	r   c                       y r   r&   r&   r   r   r#   z'traced_decorated_function.<locals>.func`   s     	r   r&   )rR   rW   r#   s      r   traced_decorated_functionrY   Y   s0       Fr   c                   >    e Zd Zd Zd Zd Zed        Zed        Z	y)TracedClassc                     || _         y r   r)   )selfr'   s     r   __init__zTracedClass.__init__h   s	    r   c                      | j                   |z   S r   r]   )r^   r(   s     r   inst_method_linearzTracedClass.inst_method_lineark   s    vvzr   c                 B    | j                  |      }|t        ||      z   S r   )ra   r,   )r^   r'   r+   s      r   inst_method_callingzTracedClass.inst_method_callingn   s%    ##A&%a+++r   c                     |dz  S rD   r&   )clsr(   s     r   class_method_linearzTracedClass.class_method_linearr       1ur   c                     | dz  S rD   r&   )r(   s    r   static_method_linearz TracedClass.static_method_linearv   rg   r   N)
__name__
__module____qualname__r_   ra   rc   classmethodrf   staticmethodri   r&   r   r   r[   r[   g   s9    ,    r   r[   c                   @    e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zy
)TestLineCountsz/White-box testing of line-counting, via runfuncc                     | j                  t        j                  t        j                                t	        dddd      | _        t        t              | _        y )Nr5   r   counttrace
countfuncscountcallers)	
addCleanupsyssettracegettracer   tracerr   r   my_py_filenamer^   s    r   setUpzTestLineCounts.setUp   s9    clln5!1K(2r   c                 >   | j                   j                  t        dd      }| j                  |d       i }t	        t              }t        dd      D ]  }d|| j                  ||z   f<    | j                  | j                   j                         j                  |       y )NrE   r/      r5   )	r{   runfuncr,   assertEqualr$   r1   r|   resultscounts)r^   resultexpectedfirstlinenor2   s        r   test_traced_func_linearz&TestLineCounts.test_traced_func_linear   s    $$%7A># %&89q! 	BA@AHd));!+;<=	B 	,,.55x@r   c           	      X   | j                   j                  t        dd       t        t              }| j                  |dz   fd| j                  |dz   fd| j                  |dz   fd| j                  |dz   fdi}| j                  | j                   j                         j                  |       y )NrE      r5      r/      )r{   r   r3   r$   r|   r   r   r   r^   r   r   s      r   test_traced_func_loopz$TestLineCounts.test_traced_func_loop   s    ,a3%&67  +/2A  +/2A  +/2A  +/2A	
 	,,.55x@r   c                 ^   | j                   j                  t        dd       t        t              }| j                  |dz   fdt        t        j                        dfdt        t        j                        dfdi}| j                  | j                   j                         j                  |       y )NrE   r/   r5   r   )r{   r   r6   r$   r|   r   r   r   r   r   r   r   s      r   test_traced_func_importingz)TestLineCounts.test_traced_func_importing   s    11a8%&;<  +/2A(()1-q(()1-q
 	,,.55x@r   c                    | j                   j                  t               t        t              }t        t              }| j
                  |dz   fd| j
                  |dz   fd| j
                  |dz   fd| j
                  |dz   fd| j
                  |dz   fd| j
                  |dz   fdi}| j                  | j                   j                         j                  |       y Nr5   rE      r   rA   )	r{   r   rB   r$   r?   r|   r   r   r   )r^   firstlineno_callingfirstlineno_genr   s       r   test_trace_func_generatorz(TestLineCounts.test_trace_func_generator   s    9:-.KL)*?@  "5"9:A  "5"9:B  "5"9:B  /A"56  /A"56  /A"56
 	,,.55x@r   c           	      r   | j                   j                  t               t        t              }t        t              }| j
                  |dz   fd| j
                  |dz   fd| j
                  |dz   fd| j
                  |dz   fdi}| j                  | j                   j                         j                  |       y r   )	r{   r   rM   r$   rF   r|   r   r   r   )r^   r   firstlineno_calledr   s       r   test_trace_list_comprehensionz,TestLineCounts.test_trace_list_comprehension   s    <=-.NO,^<  "5"9:A  "5"9:B  "5"9:A  "4q"892	
 	,,.55x@r   c                 B   | j                   j                  t               t        t              }| j                  |dz   fd| j                  |dz   fd| j                  |dz   fd| j                  |dz   fd| j                  |dz   fd| j                  |dz   fd| j                  |dz   fd| j                  |dz   fd| j                  |d	z   fd| j                  |d
z   fd| j                  |dz   fdi}| j                  | j                   j                         j                  |       y )Nr5   rE   r   r   r/   r   r      	   rA   r   )r{   r   rY   r$   r|   r   r   r   r   s      r   test_traced_decorated_functionz-TestLineCounts.test_traced_decorated_function   s*   56%&?@  +/2A  +/2A  +/2A  +/2A  +/2A  +/2A  +/2A  +/2A  +/2A  +"23Q  +"23Q
 	,,.55x@r   c                    dD ]  }t        dddd      }t        d      }t        ||      }|j                  |d       t	        |      }| j
                  |dz   fdi}| j                  |j                         j                  |        y )N)ra   r5   r   rr         )	r   r[   getattrr   r$   r|   r   r   r   )r^   methnamer{   
traced_objmethodr   r   s          r   test_linear_methodsz"TestLineCounts.test_linear_methods   s     0 
	@H!JF$RJZ2FNN62&)&1K$$kAo6H V^^-44h?
	@r   N)rj   rk   rl   __doc__r~   r   r   r   r   r   r   r   r&   r   r   rp   rp   ~   s4    93

A
A
AAAA&@r   rp   c                       e Zd ZdZd Zd Zy)TestRunExecCountsz8A simple sanity test of line-counting, via runctx (exec)c                     t        t              | _        | j                  t        j
                  t	        j                                y r   )r   r   r|   rw   rx   ry   rz   r}   s    r   r~   zTestRunExecCounts.setUp   s'    (2clln5r   c           	         t        dddd      | _        d}t        |t        d      }| j                  j	                  |t               t                      t        t              }| j                  |dz   fd| j                  |dz   fd| j                  |dz   fd	| j                  |d
z   fdi}|j                         D ]<  }| j                  | j                  j                         j                  |   ||          > y )Nr5   r   rr   ztraced_func_loop(2, 5)execrE   r   r   r/   r   )r   r{   compiler   runctxglobalsvarsr$   r3   r|   keysr   r   r   )r^   coder   r   r;   s        r   test_exec_countsz"TestRunExecCounts.test_exec_counts   s    !1K,tXv.4DF3%&67  +/2A  +/2A  +/2A  +/2A	
  	KAT[[00299!<hqkJ	Kr   N)rj   rk   rl   r   r~   r   r&   r   r   r   r      s    B6Kr   r   c                       e Zd ZdZd Zd Zd Zd Zd Z e	j                   eed      xr  ej                         d      d	        Zd
 Zy)	TestFuncsz"White-box testing of funcs tracingc                     | j                  t        j                  t        j                                t	        ddd      | _        t               | _        t        j                         | _        y )Nr   r5   )rs   rt   ru   )	rw   rx   ry   rz   r   r{   r   filemod_saved_tracefuncr}   s    r   r~   zTestFuncs.setUp  sB    clln5!1;*, #r   c                 \    | j                    t        j                  | j                          y y r   )r   rx   ry   r}   s    r   tearDownzTestFuncs.tearDown  s%      ,LL../ -r   c                     | j                   j                  t        d       | j                  dz   d| j                  dz   di}| j	                  | j                   j                         j                  |       y )Nr5   r9   r8   )r{   r   r9   r   r   r   calledfuncsr^   r   s     r   test_simple_callerzTestFuncs.test_simple_caller  sc    5q9 LL991LL22A
 	,,.::HEr   c                    | j                   j                  t        dddd      }| j                  |ddddf       | j	                  t
              5  | j                   j                  t        d       d d d        | j	                  t
              5  | j                   j                          d d d        y # 1 sw Y   BxY w# 1 sw Y   y xY w)Nr5   rE   r   r   )r^   r#   )r5   rE   )r#   arg)r{   r   rJ   r   assertRaises	TypeError)r^   ress     r   test_arg_errorszTestFuncs.test_arg_errors  s    kk!!/1aaa!Hv1'=>?y) 	=KK_!<	=y) 	"KK!	" 	"	= 	=	" 	"s   "B4C 4B= C	c                 `   | j                   j                  t        d       | j                  dz   d| j                  dz   d| j                  dz   d| j                  dz   dt	        t
        j                        ddfdi}| j                  | j                   j                         j                  |       y )Nr5   r   r8   r<   r6   r   r#   )
r{   r   r<   r   r   r   r   r   r   r   r   s     r   test_loop_caller_importingz$TestFuncs.test_loop_caller_importing"  s    8!< LL991LL22ALL<<aLL55q(()9f=q
 	,,.::HEr   rz   3pre-existing trace function throws off measurementsc                 ,   t        d      }| j                  j                  |j                  d       | j                  dz   d| j                  dz   d| j                  dz   di}| j                  | j                  j                         j                  |       y )Nr   r5   )zTracedClass.inst_method_calling)zTracedClass.inst_method_linearr8   )r[   r{   r   rc   r   r   r   r   )r^   objr   s      r   test_inst_method_callingz"TestFuncs.test_inst_method_calling.  s     "oC33Q7 LL??LL>>LL22A

 	,,.::HEr   c           
      D   | j                   j                  t               | j                  dz   d| j                  dz   d| j                  dz   d| j                  dz   d| j                  dz   di}| j	                  | j                   j                         j                  |       y )N)rY   r5   )rW   rV   )rR   r"   )r{   r   rY   r   r   r   r   r   s     r   r   z(TestFuncs.test_traced_decorated_function;  s    56 LL991LL00!LL?*ALL?*ALL9$a
 	,,.::HEr   N)rj   rk   rl   r   r~   r   r   r   r   unittestskipIfhasattrrx   rz   r   r   r&   r   r   r   r     sb    ,/0F"
F X__WS*-@,#,,.JL	FL	F
Fr   r   c                   |    e Zd ZdZd Z ej                   eed      xr  ej                         d      d        Z
y)TestCallersz$White-box testing of callers tracingc                     | j                  t        j                  t        j                                t	        ddd      | _        t               | _        y )Nr   r5   )rs   rt   rv   rw   rx   ry   rz   r   r{   r   r   r}   s    r   r~   zTestCallers.setUpJ  s4    clln5!11=*,r   rz   r   c                 D   | j                   j                  t        d       t        j                  j                  t        j                        d   dz   ddf| j                  dz   fd| j                  dz   | j                  dz   fd| j                  dz   | j                  dz   fd| j                  dz   | j                  d	z   fd| j                  d	z   t        t        j                        d
dffdi}| j                  | j                   j                         j                  |       y )Nr5   r   .pyrt   zTrace.runfuncr   r   r8   r   r   r#   )r{   r   r<   r   r   r   rt   r   r   r   r   r   r   callersr   s     r   r   z&TestCallers.test_loop_caller_importingO  s    	8!< ggu~~.q1E97OT AADEFll;; 77:;<ll>> >>ABCll>> ::=>?ll77G,,-y&ACDE
 	,,.66Ar   N)rj   rk   rl   r   r~   r   r   r   rx   rz   r   r&   r   r   r   r   H  sF    .-
 X__WS*-@,#,,.JLBLBr   r   c                   T    e Zd Zd Zd ZdZefdZ ed      d        Zd Z	d Z
d	 Zy
)TestCoveragec                 h    | j                  t        j                  t        j                                y r   )rw   rx   ry   rz   r}   s    r   r~   zTestCoverage.setUpe  s    clln5r   c                 @    t        t               t        t               y r   )r   r   r   r}   s    r   r   zTestCoverage.tearDownh  s    vvr   zif True:
        import unittest
        from test.test_pprint import QueryTestCase
        loader = unittest.TestLoader()
        tests = loader.loadTestsFromTestCase(QueryTestCase)
        tests(unittest.TestResult())
        c                 v    |j                  |       |j                         }|j                  ddt               y )NT)show_missingsummarycoverdir)runr   write_resultsr   )r^   r{   cmdrs       r   	_coveragezTestCoverage._coverages  s+    

3NN	T4&Ir   cpuc                 t   t        j                  dd      }t               5 }| j                  |       d d d        j	                         }| j                  d|       | j                  d|       t        j                  t              }| j                  d|       | j                  d|       y # 1 sw Y   {xY w)Nr   r5   rt   rs   z	pprint.pyzcase.pyzpprint.coverzunittest.case.cover)	rt   r   r   r   getvalueassertInr   listdirr   )r^   r{   stdoutfiless       r   test_coveragezTestCoverage.test_coveragex  s    1A. 	#&NN6"	#"k6*i(

6"ne,+U3	# 	#s   B..B7c                 ,   t         j                  j                  t         j                  j                  t         j                  j                  t                          }t        j                  t        j                  t        j                  |gdd      }t               5 }| j                  |       d d d        t         j                  j                  t              r-t        j                  t              }| j                  |dg       y y # 1 sw Y   ZxY w)Nr   r5   )
ignoredirsrt   rs   z_importlib.cover)r   r   normpathdirnamer   rt   r   rx   base_prefixbase_exec_prefixr   r   existsr   r   r   )r^   libpathr{   r   r   s        r   test_coverage_ignorez!TestCoverage.test_coverage_ignore  s    ''""277??277??83L#MN#:N:N$)&-.a9 	#&NN6"	#77>>&!JJv&EU%7$89 "	# 	#s   D

Dc                 J   t        j                  dd      }d}|t        j                  v rt        j                  |= d}t	               5 }| j                  ||       d d d        j                  d       |j                          i }|D ]5  }|j                         d d \  }}}	t        |      t        |d d       f||	<   7 t        j                  t        j                  |   j                        }| j                  ||       | j                  ||   d       y # 1 sw Y   xY w)	Nr   r5   r   ztest.tracedmodules.testmodz<import test.tracedmodules.testmod as t;t.func(0); t.func2();r   r   )r/   d   )rt   r   rx   modulesr   r   seekreadlinesplitint_fullmodnamer   r   r   )
r^   r{   r   r   r   coveragelinelinescovmodules
             r   test_issue9936zTestCoverage.test_issue9936  s   1A..ckk!G$' 	(&NN63'	(A 	;D!%bq!1E3 #E
CCRM:HV	; $$S[[%9%B%BCgx('*H5	( 	(s   	DD"c                    t         dz   }t        |d      5 }t        i i ddif|d       d d d        | j                  t        |       t        j                  i i |i       }| j                  |j                  ddi       y # 1 sw Y   VxY w)Nz-infilewbcallerr5   )protocol)	r   openr   rw   r   rt   CoverageResultsr   r   )r^   infilerQ   r   s       r   test_coverageresults_updatez(TestCoverage.test_coverageresults_update  s    )#&$ 	91"b8Q-(!a8	9'''B;8Q-8		9 	9s   A??BN)rj   rk   rl   r~   r   DEFAULT_SCRIPTr   r   r   r   r  r  r&   r   r   r   r   d  sF    6N %3 J
 u	4 	4
:6*9r   r   c                       e Zd Zd Zy)Test_Ignorec           	      0   t         j                  j                  }t        j                  ddg |dd      g      }| j                  |j                  dd             | j                  |j                  dd             | j                  |j                  dd	             | j                  |j                   |ddd
      d             | j                  |j                   |dd      d             | j                  |j                   |dd
      d             y )Nr'   zy.zfoobarzx.pyzxy.pyxyzy.pyr(   zbaz.pybazzz.pyz)r   r   joinrt   _Ignore
assertTruenamesassertFalse)r^   jnignores      r   test_ignoredzTest_Ignore.test_ignored  s    WW\\U|b.>-?@VS12gt45fc23Ruh%?GHb&7=>Rx%8%@Ar   N)rj   rk   rl   r  r&   r   r   r  r    s    	Br   r  c                   ,    e Zd ZdZdZd Zd Zd Zd Zy)TestCoverageCommandLineOutputztmp.pyz	tmp.coverc                     t        | j                  dd      5 }|j                  t        j                  d             d d d        y # 1 sw Y   y xY w)Nwiso-8859-15encodingu                   # coding: iso-8859-15
                x = 'spœm'
                if []:
                    print('unreachable')
            )r	  codefilewritetextwrapdedent)r^   rQ   s     r   r~   z#TestCoverageCommandLineOutput.setUp  sE    $--}= 	GGHOO %  	 	 	s   %AAc                 X    t        | j                         t        | j                         y r   )r   r%  	coverfiler}   s    r   r   z&TestCoverageCommandLineOutput.tearDown  s    t}}t~~r   c                    t         j                  j                  t         j                  j                  t        j
                              }t         j                  j                  |d      }t        |       dj                         | j                  gz   }t        | \  }}}| j                  |d       | j                  t         j                  j                  |             | j                  t         j                  j                  | j                               t!        | j                  d      5 }| j                  |j#                         d       d d d        y # 1 sw Y   y xY w)Nztrace.coverz-m trace --countr   r"  r#  u^          # coding: iso-8859-15
    1: x = 'spœm'
    1: if []:
           print('unreachable')
)r   r   r   abspathrt   r   r  r   r   r%  r
   r   r  r   r  r*  r	  read)r^   tracedirtracecoverpathargvstatusr   stderrrQ   s           r   %test_cover_files_written_no_highlightzCTestCoverageCommandLineOutput.test_cover_files_written_no_highlight  s     77??277??5>>#BCh>~!'')T]]O;!14!8%78t~~67$..=9 	QQVVX4	 	 	s   /!EE"c                    dj                         | j                  gz   }t        | \  }}}| j                  t        j
                  j                  | j                               t        | j                  d      5 }| j                  |j                         t        j                  d             d d d        y # 1 sw Y   y xY w)Nz-m trace --count --missingr"  r#  u                          # coding: iso-8859-15
                    1: x = 'spœm'
                    1: if []:
                >>>>>>     print('unreachable')
            )r   r%  r
   r  r   r   r   r*  r	  r   r-  r'  r(  )r^   r0  r1  r   r2  rQ   s         r   'test_cover_files_written_with_highlightzETestCoverageCommandLineOutput.test_cover_files_written_with_highlight  s    +113t}}oE!14!8t~~67$..=9 	QQVVXx 8 ( 	 	 	s   :4B77C N)	rj   rk   rl   r%  r*  r~   r   r3  r5  r&   r   r   r  r    s     HI(
r   r  c                   *    e Zd Zd Zd Zd Zd Zd Zy)TestCommandLinec                 ^    d}|D ]&  ^}}t        ddg| ^ }}| j                  ||       ( y )N))s3   progname is missing: required with the main options-lz-T)s8   cannot specify both --listfuncs and (--trace or --count)z-lc)s>   argument -R/--no-report: not allowed with argument -r/--reportz-rR)sL   must specify one of --trace, --count, --report, --listfuncs, or --trackcallsz-g)s   -r/--report requires -f/--filez-r)s3   --summary can only be used with --count or --reportz-sT)s   unrecognized arguments: -yz-y-mrt   )r   r   )r^   _errorsmessagerH   _r2  s         r   test_failureszTestCommandLine.test_failures  sA    3 & 	+NGd.tWDtDJQMM'6*	+r   c                    t         dz   }t        j                  j                  t               }t	        |dd      5 }| j                  t        |       |j                  d       t        ddd|d	      \  }}}| j                  d
|       d| d| d}| j                  |j                         |       d d d        y # 1 sw Y   y xY w)Nr   r!  utf-8r#  za = 1
r:  rt   r9  PYTHONIOENCODINGs   functions called:z
filename: z, modulename: z, funcname: <module>)r   r   r   r   r	  rw   r   r&  r
   r   encode)r^   r   
modulenamefdr1  r   r2  r   s           r   test_listfuncs_flag_successz+TestCommandLine.test_listfuncs_flag_success  s    E>WW%%f-
(C'2 	5bOOFH-HHY%5dGT8GN&P"FFFMM.7#H:^J<G[\HMM(//+V4	5 	5 	5s   A7B;;Cc                 `   t        t        dd      5 }| j                  t        t               |j	                  d       |j	                  d       d d d        t        t              \  }}}t        dddt        d	      \  }}}| j                  |j                         |       y # 1 sw Y   UxY w)
Nr!  r@  r#  zimport sys
zprint(type(sys.argv))
r:  rt   r9  rA  )r	  r   rw   r   r&  r
   r   strip)r^   rE  r1  direct_stdoutr2  trace_stdouts         r   test_sys_argv_listz"TestCommandLine.test_sys_argv_list  s    &#0 	0BOOFF+HH^$HH./	0
 )9(@%v'7gtVIP(R$fm))+\:	0 	0s   =B$$B-c                    t          d}t          d}t        j                  j                  t               }t	        |dd      5 }| j                  t        |       | j                  t        |       |j                  t        j                  d             d d d        t        ddd	|d
      \  }}}|j                         }| j                  |d       | j                  d|       | j                  d| d| d|       y # 1 sw Y   kxY w)Nr   z.coverr!  r@  r#  z                x = 1
                y = 2

                def f():
                    return x + y

                for i in range(10):
                    f()
            r:  rt   z-csrA  r   zlines   cov%   module   (path)z6   100%   z   ())r   r   r   r   r	  rw   r   r&  r'  r(  r
   decoder   r   )r^   r   coverfilenamerD  rE  r1  r   r=  s           r   test_count_and_summaryz&TestCommandLine.test_count_and_summary  s    XS>!(&)WW%%f-
(C'2 	bOOFH-OOFM2HHX__ 	& 	 		 -T7E8>EG#6?J<tH:Q?H%	 	s   AC??Dc           	      D    t        ddddddd       t        ddddd       y )	Nr:  rt   r9  z--moduletimeitz-n1not_a_module_zzzr	   r}   s    r   test_run_as_modulez"TestCommandLine.test_run_as_module.  s'    wj(D#NdGT:?QRr   N)rj   rk   rl   r>  rF  rK  rP  rU  r&   r   r   r7  r7    s    +
5	;I0Sr   r7  c                       e Zd Zd Zd Zy)	TestTracec                     | j                  t        j                  t        j                                t	        dd      | _        t               | _        y )Nr   r5   )rs   rt   r   r}   s    r   r~   zTestTrace.setUp4  s2    clln5!1-*,r   c                    d}t         j                  }|j                  |      }t        |t	                     }t               5 }| j                  j                  |dd       d d d        j                         j                         }t        |      }| j                  d| j                  d    d|j                  j                   |d          | j                  | d	|dz    d
|d          | j                  | d	|dz    d
|d          | j                  | d	|dz    d
|d          | j                  | d	|dz    d
|d          y # 1 sw Y   xY w)Nz	<unknown>)co_filenamerE   r   z --- modulename: r5   z, funcname: r   (rM  r   )r,   r    replacer   r   r   r{   r   r   
splitlinesr$   r   r   co_name)r^   r   corQ   outr   s         r   test_no_source_filezTestTrace.test_no_source_file9  sJ   ((ZZHZ-WY' 	)#KK1a(	) lln'')%a()$,,q/):,qzzGYGYFZ[]`ab]cd
!K!O#4A6A?
!K!O#4A6A?
!K!O#4A6A?
!K!O#4A6A?	) 	)s   EEN)rj   rk   rl   r~   ra  r&   r   r   rW  rW  3  s    -
@r   rW  __main__)2r   pickler   rx   test.supportr   r   test.support.os_helperr   r   r   test.support.script_helperr
   r   r'  r   typesr   rt   r   test.tracedmodulesr   r   r   r$   r,   r3   r6   r9   r<   r?   rB   rF   rJ   rM   rY   objectr[   TestCaserp   r   r   r   r   r  r  r7  rW  rj   mainr&   r   r   <module>rl     sU   	  
 ; ; ; N      &)
(#



& .h@X&& h@VK)) K8@F!! @FFB(## B8H98$$ H9Z
B(## 
B0H$5$5 0d@Sh'' @SF@!! @0 zHMMO r   