
    0hhV                        S SK r S SKJr  S SKrS SKJrJrJr  S SKJ	r	J
r
Jr  S SKJrJr  S SKrS SKrS SKJr  S SKrS SKJr  S SKJr  S	 rS
 rS rS rS rS rS rS rS rS r S r!S r"S r#S r$ " S S\%5      r& " S S\RN                  5      r( " S S\RN                  5      r) " S S\RN                  5      r* " S S \RN                  5      r+ " S! S"\RN                  5      r, " S# S$\RN                  5      r- " S% S&\RN                  5      r. " S' S(\RN                  5      r/ " S) S*\RN                  5      r0\1S+:X  a  \Rd                  " 5         gg),    N)dump)captured_stdoutrequires_resourcerequires_gil_enabled)TESTFNrmtreeunlinkassert_python_okassert_python_failure)FunctionType)Trace)testmodc                 <    U R                  S5      (       a  U SS n U $ )z8Given a .pyc filename converts it to the appropriate .pyz.pycN)endswith)filenames    8/opt/python-3.13.8/usr/lib/python3.13/test/test_trace.py
fix_ext_pyr      s#      CR=O    c                      [         R                  R                  [         R                  R                  [        5      5      S   n [        [        5      U 4$ )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                 .    U R                   R                  $ N)__code__co_firstlinenofuncs    r   get_firstlinenor%   "   s    =='''r   c                     U nUnX#-   nU$ r     )xyabcs        r   traced_func_linearr-   ,   s    	A	A	AHr   c                 6    U n[        S5       H  nX!-  nM	     U$ N   range)r(   r)   r,   is       r   traced_func_loopr4   2   s!    	A1X	 Hr   c                 8    X-   [         R                  " S5      -   $ )N   )r   r$   )r(   r)   s     r   traced_func_importingr7   8   s    57<<?""r   c                      [        X 5      nX-   $ r    r-   )r(   r,   s     r   traced_func_simple_callerr:   ;   s    1 A5Lr   c                 8    [        U 5      nU[        X5      -  nU$ r    )r:   r7   )r(   ks     r   traced_func_importing_callerr=   ?   s!    !!$A	q	$$AHr   c              #   @   #    Sn[        U 5       H	  nX!-   v   M     g 7fr/   r1   )numr,   r3   s      r   traced_func_generatorr@   D   s     	A3Ze s   c                  4    Sn [        S5       H  nX-  n M	     g )Nr   
   )r@   )r<   r3   s     r   traced_func_calling_generatorrC   I   s    	A"2&	 'r   c                     U S-  $ N   r'   )r?   s    r   traced_doublerrG   N   s    7Nr   c                      X4$ r    r'   )argskwargss     r   traced_capturerrK   Q   s
    <r   c                  \    Sn [        U 5       Vs/ s H  n[        U5      PM     nnU$ s  snf )NrB   )r2   rG   )r<   r3   mylists      r    traced_caller_list_comprehensionrN   T   s.    
A).q2AnQF2M 3s   )c                  B    S n S nU U" 5       S 5       5       nU" 5         g )Nc                     U $ r    r'   fs    r   
decorator1-traced_decorated_function.<locals>.decorator1Z   s    r   c                      S n U $ )Nc                     U $ r    r'   rQ   s    r   
decorator2Gtraced_decorated_function.<locals>.decorator_fabric.<locals>.decorator2]   s    Hr   r'   rW   s    r   decorator_fabric3traced_decorated_function.<locals>.decorator_fabric\   s    	r   c                      g r    r'   r'   r   r   r$   'traced_decorated_function.<locals>.func`   s     	r   r'   )rS   rZ   r$   s      r   traced_decorated_functionr^   Y   s0       Fr   c                   F    \ rS rSrS rS rS r\S 5       r\	S 5       r
Srg)	TracedClassg   c                     Xl         g r    r*   )selfr(   s     r   __init__TracedClass.__init__h   s    r   c                      U R                   U-   $ r    rc   )rd   r)   s     r   inst_method_linearTracedClass.inst_method_lineark   s    vvzr   c                 @    U R                  U5      nU[        X5      -   $ r    )rh   r-   )rd   r(   r,   s      r   inst_method_callingTracedClass.inst_method_callingn   s#    ##A&%a+++r   c                     US-  $ rE   r'   )clsr)   s     r   class_method_linearTracedClass.class_method_linearr       1ur   c                     U S-  $ rE   r'   )r)   s    r   static_method_linear TracedClass.static_method_linearv   rq   r   rc   N)__name__
__module____qualname____firstlineno__re   rh   rk   classmethodro   staticmethodrs   __static_attributes__r'   r   r   r`   r`   g   s9    ,    r   r`   c                   H    \ rS rSrSrS rS rS rS rS r	S r
S	 rS
 rSrg)TestLineCounts~   z/White-box testing of line-counting, via runfuncc                     U R                  [        R                  [        R                  " 5       5        [	        SSSSS9U l        [        [        5      U l        g )Nr6   r   counttrace
countfuncscountcallers)	
addCleanupsyssettracegettracer   tracerr   r   my_py_filenamerd   s    r   setUpTestLineCounts.setUp   s9    clln5!1K(2r   c                 >   U R                   R                  [        SS5      nU R                  US5        0 n[	        [        5      n[        SS5       H  nSX R                  X4-   4'   M     U R                  U R                   R                  5       R                  U5        g )NrF   r0      r6   )	r   runfuncr-   assertEqualr%   r2   r   resultscounts)rd   resultexpectedfirstlinenor3   s        r   test_traced_func_linear&TestLineCounts.test_traced_func_linear   s    $$%7A># %&89q!A@AH));+;<=  	,,.55x@r   c           	      X   U R                   R                  [        SS5        [        [        5      nU R                  US-   4SU R                  US-   4SU R                  US-   4SU R                  US-   4S0nU R                  U R                   R                  5       R                  U5        g )NrF      r6      r0      )r   r   r4   r%   r   r   r   r   rd   r   r   s      r   test_traced_func_loop$TestLineCounts.test_traced_func_loop   s    ,a3%&67  +/2A  +/2A  +/2A  +/2A	
 	,,.55x@r   c                 ^   U R                   R                  [        SS5        [        [        5      nU R                  US-   4S[        [        R                  5      S4S[        [        R                  5      S4S0nU R                  U R                   R                  5       R                  U5        g )NrF   r0   r6   r   )r   r   r7   r%   r   r   r   r   r   r   r   r   s      r   test_traced_func_importing)TestLineCounts.test_traced_func_importing   s    11a8%&;<  +/2A(()1-q(()1-q
 	,,.55x@r   c                    U R                   R                  [        5        [        [        5      n[        [        5      nU R
                  US-   4SU R
                  US-   4SU R
                  US-   4SU R
                  US-   4SU R
                  US-   4SU R
                  US-   4S0nU R                  U R                   R                  5       R                  U5        g Nr6   rF      r   rB   )	r   r   rC   r%   r@   r   r   r   r   )rd   firstlineno_callingfirstlineno_genr   s       r   test_trace_func_generator(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   U R                   R                  [        5        [        [        5      n[        [        5      nU R
                  US-   4SU R
                  US-   4SU R
                  US-   4SU R
                  US-   4S0nU R                  U R                   R                  5       R                  U5        g r   )	r   r   rN   r%   rG   r   r   r   r   )rd   r   firstlineno_calledr   s       r   test_trace_list_comprehension,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   U R                   R                  [        5        [        [        5      nU R                  US-   4SU R                  US-   4SU R                  US-   4SU R                  US-   4SU R                  US-   4SU R                  US-   4SU R                  US-   4SU R                  US-   4SU R                  US	-   4SU R                  US
-   4SU R                  US-   4S0nU R                  U R                   R                  5       R                  U5        g )Nr6   rF   r   r   r0   r   r      	   rB   r   )r   r   r^   r%   r   r   r   r   r   s      r   test_traced_decorated_function-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                    S H  n[        SSSSS9n[        S5      n[        X15      nUR                  US5        [	        U5      nU R
                  US-   4S0nU R                  UR                  5       R                  U5        M     g )N)rh   r6   r   r         )	r   r`   getattrr   r%   r   r   r   r   )rd   methnamer   
traced_objmethodr   r   s          r   test_linear_methods"TestLineCounts.test_linear_methods   s     0H!JF$RJZ2FNN62&)&1K$$kAo6H V^^-44h? 0r   r   r   N)ru   rv   rw   rx   __doc__r   r   r   r   r   r   r   r   r{   r'   r   r   r}   r}   ~   s4    93

A
A
AAAA&@r   r}   c                   $    \ rS rSrSrS rS rSrg)TestRunExecCounts   z8A simple sanity test of line-counting, via runctx (exec)c                     [        [        5      U l        U R                  [        R
                  [        R                  " 5       5        g r    )r   r   r   r   r   r   r   r   s    r   r   TestRunExecCounts.setUp   s'    (2clln5r   c           	         [        SSSSS9U l        Sn[        U[        S5      nU R                  R	                  U[        5       [        5       5        [        [        5      nU R                  US-   4SU R                  US-   4SU R                  US-   4S	U R                  US
-   4S0nUR                  5        H<  nU R                  U R                  R                  5       R                  U   X4   5        M>     g )Nr6   r   r   ztraced_func_loop(2, 5)execrF   r   r   r0   r   )r   r   compiler   runctxglobalsvarsr%   r4   r   keysr   r   r   )rd   coder   r   r<   s        r   test_exec_counts"TestRunExecCounts.test_exec_counts   s    !1K,tXv.4DF3%&67  +/2A  +/2A  +/2A  +/2A	
 AT[[00299!<hkJ !r   r   N)ru   rv   rw   rx   r   r   r   r{   r'   r   r   r   r      s    B6Kr   r   c                       \ rS rSrSrS rS rS rS rS r	\
R                  " \" \S5      =(       a    \R                  " 5       S	5      \" S
5      S 5       5       rS rSrg)	TestFuncsi  z"White-box testing of funcs tracingc                     U R                  [        R                  [        R                  " 5       5        [	        SSSS9U l        [        5       U l        [        R                  " 5       U l        g )Nr   r6   )r   r   r   )	r   r   r   r   r   r   r   filemod_saved_tracefuncr   s    r   r   TestFuncs.setUp  sB    clln5!1;*, #r   c                 `    U R                   b!  [        R                  " U R                   5        g g r    )r   r   r   r   s    r   tearDownTestFuncs.tearDown  s%      ,LL../ -r   c                     U R                   R                  [        S5        U R                  S-   SU R                  S-   S0nU R	                  U R                   R                  5       R                  U5        g )Nr6   r:   r9   )r   r   r:   r   r   r   calledfuncsrd   r   s     r   test_simple_callerTestFuncs.test_simple_caller  sc    5q9 LL991LL22A
 	,,.::HEr   c                    U R                   R                  [        SSSSS9nU R                  USSSS.45        U R	                  [
        5         U R                   R                  [        SS9  S S S 5        U R	                  [
        5         U R                   R                  5         S S S 5        g ! , (       d  f       NG= f! , (       d  f       g = f)Nr6   rF   r   r   )rd   r$   )r6   rF   )r$   arg)r   r   rK   r   assertRaises	TypeError)rd   ress     r   test_arg_errorsTestFuncs.test_arg_errors  s    kk!!/1aaa!Hv1'=>?y)KK_!< *y)KK! *) *)))s   B.
B?.
B<?
Cc                 `   U R                   R                  [        S5        U R                  S-   SU R                  S-   SU R                  S-   SU R                  S-   S[	        [
        R                  5      SS4S0nU R                  U R                   R                  5       R                  U5        g )Nr6   r   r9   r=   r7   r   r$   )
r   r   r=   r   r   r   r   r   r   r   r   s     r   test_loop_caller_importing$TestFuncs.test_loop_caller_importing"  s    8!< LL991LL22ALL<<aLL55q(()9f=q
 	,,.::HEr   r   3pre-existing trace function throws off measurements?gh-117783: immortalization of types affects traced method namesc                 ,   [        S5      nU R                  R                  UR                  S5        U R                  S-   SU R                  S-   SU R                  S-   S0nU R                  U R                  R                  5       R                  U5        g )Nr   r6   )zTracedClass.inst_method_calling)zTracedClass.inst_method_linearr9   )r`   r   r   rk   r   r   r   r   )rd   objr   s      r   test_inst_method_calling"TestFuncs.test_inst_method_calling.  s     "oC33Q7 LL??LL>>LL22A

 	,,.::HEr   c           
      D   U R                   R                  [        5        U R                  S-   SU R                  S-   SU R                  S-   SU R                  S-   SU R                  S-   S0nU R	                  U R                   R                  5       R                  U5        g )N)r^   r6   )rZ   rY   )rS   r#   )r   r   r^   r   r   r   r   r   s     r   r   (TestFuncs.test_traced_decorated_function<  s    56 LL991LL00!LL?*ALL?*ALL9$a
 	,,.::HEr   )r   r   r   N)ru   rv   rw   rx   r   r   r   r   r   r   unittestskipIfhasattrr   r   r   r   r   r{   r'   r   r   r   r     sm    ,/0F"
F __WS*-@#,,.JL[\	F ]L	F
Fr   r   c                       \ rS rSrSrS r\R                  " \" \	S5      =(       a    \	R                  " 5       S5      \" S5      S 5       5       rSrg	)
TestCallersiI  z$White-box testing of callers tracingc                     U R                  [        R                  [        R                  " 5       5        [	        SSSS9U l        [        5       U l        g )Nr   r6   )r   r   r   r   r   r   r   r   r   r   r   r   s    r   r   TestCallers.setUpK  s4    clln5!11=*,r   r   r   r   c                 D   U R                   R                  [        S5        [        R                  R                  [        R                  5      S   S-   SS4U R                  S-   4SU R                  S-   U R                  S-   4SU R                  S-   U R                  S-   4SU R                  S-   U R                  S	-   4SU R                  S	-   [        [        R                  5      S
S44S0nU R                  U R                   R                  5       R                  U5        g )Nr6   r   .pyr   zTrace.runfuncr   r   r9   r   r   r$   )r   r   r=   r   r   r   r   r   r   r   r   r   r   callersr   s     r   r   &TestCallers.test_loop_caller_importingP  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   r   r   N)ru   rv   rw   rx   r   r   r   r   r   r   r   r   r   r{   r'   r   r   r   r   I  sQ    .-
 __WS*-@#,,.JL[\B ]LBr   r   c                   ^    \ rS rSrS rS rSr\4S jr\" S5      S 5       r	S r
S	 rS
 rSrg)TestCoverageif  c                 j    U R                  [        R                  [        R                  " 5       5        g r    )r   r   r   r   r   s    r   r   TestCoverage.setUpg  s    clln5r   c                 @    [        [        5        [        [        5        g r    )r   r   r	   r   s    r   r   TestCoverage.tearDownj  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                 p    UR                  U5        UR                  5       nUR                  SS[        S9  g )NT)show_missingsummarycoverdir)runr   write_resultsr   )rd   r   cmdrs       r   	_coverageTestCoverage._coverageu  s+    

3NN	T4&Ir   cpuc                 |   [         R                  " SSS9n[        5        nU R                  U5        S S S 5        WR	                  5       nU R                  SU5        U R                  SU5        [        R                  " [        5      nU R                  SU5        U R                  SU5        g ! , (       d  f       N= f)Nr   r6   r   r   z	pprint.pyzcase.pyzpprint.coverzunittest.case.cover)	r   r   r   r  getvalueassertInr   listdirr   )rd   r   stdoutfiless       r   test_coverageTestCoverage.test_coveragez  s    1A.&NN6" "k6*i(

6"ne,+U3 s   B--
B;c                 `   [         R                  R                  [         R                  R                  [         R                  R                  [        5      5      5      n[
        R                  " [        R                  [        R                  U/[        R                  -   SSS9n[        5        nU R                  U5        S S S 5        [         R                  R                  [        5      (       a.  [         R                  " [        5      nU R                  US/5        g g ! , (       d  f       Ne= f)Nr   r6   )
ignoredirsr   r   z_importlib.cover)r   r   normpathdirnamer   r   r   r   base_prefixbase_exec_prefixr   r  existsr   r  r   )rd   libpathr   r  r  s        r   test_coverage_ignore!TestCoverage.test_coverage_ignore  s    ''""277??277??83L#MN#:N:N$)&(+)189D&NN6" 77>>&!!JJv&EU%7$89 " s   .D
D-c                 P   [         R                  " SSS9nSnU[        R                  ;   a  [        R                  U	 Sn[	        5        nU R                  X5        S S S 5        WR                  S5        UR                  5         0 nU H4  nUR                  5       S S u  pxn	[        U5      [        US S 5      4XY'   M6     [         R                  " [        R                  U   R                  5      nU R                  X%5        U R                  XR   S5        g ! , (       d  f       N= f)	Nr   r6   r  ztest.tracedmodules.testmodz<import test.tracedmodules.testmod as t;t.func(0); t.func2();r   r   )r0   d   )r   r   r   modulesr   r  seekreadlinesplitint_fullmodnamer   r  r   )
rd   r   r   r	  r  coveragelinelinescovmodules
             r   test_issue9936TestCoverage.test_issue9936  s    1A..ckk!G$'&NN6' AD!%bq!1E #E
CCRM:H  $$S[[%9%B%BCg(*H5 s   	D
D%c                    [         S-   n[        US5       n[        0 0 SS04USS9  S S S 5        U R                  [        U5        [
        R                  " 0 0 U0 5      nU R                  UR                  SS05        g ! , (       d  f       N\= f)Nz-infilewbcallerr6   )protocol)	r   openr   r   r	   r   CoverageResultsr   r   )rd   infilerR   r   s       r   test_coverageresults_update(TestCoverage.test_coverageresults_update  sy    )#&$1"b8Q-(!a8  '''B;8Q-8	  s   A==
Br'   N)ru   rv   rw   rx   r   r   DEFAULT_SCRIPTr  r   r  r  r.  r7  r{   r'   r   r   r   r   f  sF    6N %3 J
 u	4 	4
:6*9r   r   c                       \ rS rSrS rSrg)Test_Ignorei  c           	      2   [         R                  R                  n[        R                  " SS/U" SS5      /5      nU R                  UR                  SS5      5        U R                  UR                  SS5      5        U R                  UR                  SS	5      5        U R                  UR                  U" SSS
5      S5      5        U R                  UR                  U" SS5      S5      5        U R                  UR                  U" SS
5      S5      5        g )Nr(   zy.zfoobarzx.pyzxy.pyxyzy.pyr)   zbaz.pybazzz.pyz)r   r   joinr   _Ignore
assertTruenamesassertFalse)rd   jnignores      r   test_ignored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   r'   N)ru   rv   rw   rx   rI  r{   r'   r   r   r;  r;    s    	Br   r;  c                   4    \ rS rSrSrSrS rS rS rS r	Sr
g	)
TestCoverageCommandLineOutputi  ztmp.pyz	tmp.coverc                     [        U R                  SSS9 nUR                  [        R                  " S5      5        S S S 5        g ! , (       d  f       g = f)Nwiso-8859-15encodingu                   # coding: iso-8859-15
                x = 'spœm'
                if []:
                    print('unreachable')
            )r4  codefilewritetextwrapdedent)rd   rR   s     r   r   #TestCoverageCommandLineOutput.setUp  s<    $--}=GGHOO %   >==s   &A
Ac                 X    [        U R                  5        [        U R                  5        g r    )r	   rR  	coverfiler   s    r   r   &TestCoverageCommandLineOutput.tearDown  s    t}}t~~r   c                    [         R                  R                  [         R                  R                  [        R
                  5      5      n[         R                  R                  US5      n[        U5        SR                  5       U R                  /-   n[        U6 u  pEnU R                  US5        U R                  [         R                  R                  U5      5        U R                  [         R                  R                  U R                  5      5        [!        U R                  SS9 nU R                  UR#                  5       S5        S S S 5        g ! , (       d  f       g = f)Nztrace.coverz-m trace --countr   rO  rP  u^          # coding: iso-8859-15
    1: x = 'spœm'
    1: if []:
           print('unreachable')
)r   r   r  abspathr   r   rB  r	   r&  rR  r   r   rF  r  rD  rX  r4  read)rd   tracedirtracecoverpathargvstatusr  stderrrR   s           r   %test_cover_files_written_no_highlightCTestCoverageCommandLineOutput.test_cover_files_written_no_highlight  s     77??277??5>>#BCh>~!'')T]]O;!14!8%78t~~67$..=9QQVVX4 :99s   +!E
E#c                    SR                  5       U R                  /-   n[        U6 u  p#nU R                  [        R
                  R                  U R                  5      5        [        U R                  SS9 nU R                  UR                  5       [        R                  " S5      5        S S S 5        g ! , (       d  f       g = f)Nz-m trace --count --missingrO  rP  u                          # coding: iso-8859-15
                    1: x = 'spœm'
                    1: if []:
                >>>>>>     print('unreachable')
            )r&  rR  r   rD  r   r   r  rX  r4  r   r\  rT  rU  )rd   r_  r`  r  ra  rR   s         r   'test_cover_files_written_with_highlightETestCoverageCommandLineOutput.test_cover_files_written_with_highlight  s    +113t}}oE!14!8t~~67$..=9QQVVXx 8 (  :99s   65B44
Cr'   N)ru   rv   rw   rx   rR  rX  r   r   rb  re  r{   r'   r   r   rL  rL    s     HI(
r   rL  c                   2    \ rS rSrS rS rS rS rS rSr	g)	TestCommandLinei  c                 \    SnU H$  tp#[        SS/UQ76 Gt pEU R                  X%5        M&     g )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-mr   )r   r  )rd   _errorsmessagerI   _ra  s         r   test_failuresTestCommandLine.test_failures  s6    3 &NG.tWDtDJQMM'* &r   c           	         [         S-   n[        R                  R                  [         5      n[	        USSS9 nU R                  [        U5        UR                  S5        [        SSSUSS	9u  pEnU R                  S
U5        SU SU S3nU R                  UR                  5       U5        S S S 5        g ! , (       d  f       g = f)Nr   rN  utf-8rP  za = 1
rk  r   rj  PYTHONIOENCODINGs   functions called:z
filename: z, modulename: z, funcname: <module>)r   r   r   r   r4  r   r	   rS  r   r  encode)rd   r   
modulenamefdr`  r  ra  r   s           r   test_listfuncs_flag_success+TestCommandLine.test_listfuncs_flag_success  s    E>WW%%f-
(C'2bOOFH-HHY%5dGT8GN&P"FFMM.7#H:^J<G[\HMM(//+V4 322s   A3B44
Cc                 Z   [        [        SSS9 nU R                  [        [        5        UR	                  S5        UR	                  S5        S S S 5        [        [        5      u  p#n[        SSS[        SS	9u  p%nU R                  UR                  5       U5        g ! , (       d  f       NU= f)
NrN  rr  rP  zimport sys
zprint(type(sys.argv))
rk  r   rj  rs  )r4  r   r   r	   rS  r   r  strip)rd   rw  r`  direct_stdoutra  trace_stdouts         r   test_sys_argv_list"TestCommandLine.test_sys_argv_list  s    &#0BOOFF+HH^$HH./ 1
 )9(@%v'7gtVIP(R$fm))+\: 10s   =B
B*c                    [          S3n[          S3n[        R                  R                  [         5      n[	        USSS9 nU R                  [        U5        U R                  [        U5        UR                  [        R                  " S5      5        S S S 5        [        SSS	USS
9u  pVnUR                  5       nU R                  US5        U R                  SU5        U R                  SU SU S3U5        g ! , (       d  f       Nl= f)Nr   z.coverrN  rr  rP  z                x = 1
                y = 2

                def f():
                    return x + y

                for i in range(10):
                    f()
            rk  r   z-csrs  r   zlines   cov%   module   (path)z6   100%   z   ())r   r   r   r   r4  r   r	   rS  rT  rU  r   decoder   r  )rd   r   coverfilenamerv  rw  r`  r  rn  s           r   test_count_and_summary&TestCommandLine.test_count_and_summary  s    XS>!(&)WW%%f-
(C'2bOOFH-OOFM2HHX__ 	& 	 	 3 -T7E8>EG#6?J<tH:Q?H% 32s   AC99
Dc           	      D    [        SSSSSSS5        [        SSSSS5        g )	Nrk  r   rj  z--moduletimeitz-n1not_a_module_zzzr
   r   s    r   test_run_as_module"TestCommandLine.test_run_as_module0  s'    wj(D#NdGT:?QRr   r'   N)
ru   rv   rw   rx   ro  rx  r~  r  r  r{   r'   r   r   rh  rh    s    +
5	;I0Sr   rh  c                        \ rS rSrS rS rSrg)	TestTracei5  c                     U R                  [        R                  [        R                  " 5       5        [	        SSS9U l        [        5       U l        g )Nr   r6   )r   r   r   r   s    r   r   TestTrace.setUp6  s2    clln5!1-*,r   c                    Sn[         R                  nUR                  US9n[        U[	        5       5      n[        5        nU R                  R                  USS5        S S S 5        WR                  5       R                  5       n[        U5      nU R                  SU R                  S    SUR                  R                   3US   5        U R                  U S	US-    S
3US   5        U R                  U S	US-    S
3US   5        U R                  U S	US-    S
3US   5        U R                  U S	US-    S
3US   5        g ! , (       d  f       N= f)Nz	<unknown>)co_filenamerF   r   z --- modulename: r6   z, funcname: r   (r  r   )r-   r!   replacer   r   r   r   r   r  
splitlinesr%   r  r   co_name)rd   r   corR   outr   s         r   test_no_source_fileTestTrace.test_no_source_file;  sC   ((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r   N)ru   rv   rw   rx   r   r  r{   r'   r   r   r  r  5  s    -
@r   r  __main__)3r   pickler   r   test.supportr   r   r   test.support.os_helperr   r   r	   test.support.script_helperr   r   rT  r   typesr   r   r   test.tracedmodulesr   r   r   r%   r-   r4   r7   r:   r=   r@   rC   rG   rK   rN   r^   objectr`   TestCaser}   r   r   r   r   r;  rL  rh  r  ru   mainr'   r   r   <module>r     sV   	  
 Q Q ; ; N      &)
(#



& .h@X&& h@VK)) K8AF!! AFHB(## B:H98$$ H9Z
B(## 
B0H$5$5 0d@Sh'' @SF@!! @0 zMMO r   