
    ^h=                         S r SSKrSSKrSSKJr  SSKJr  \R                  S 5       r	\R                  S 5       rS rS r " S	 S
\R                  5      r " S S\R                   5      rg)z
Tests for testing.tools
    N)
decorators)toolsc                      Sn [         R                  " U SS/5      nU(       d   SS:H  /5       eSn [         R                  " U SS/5      nU(       d   SS:H  /5       e[         R                  " U S5      nUS/:X  d   eg )	Nz/foo/bar.pya.txtb.txtz
/foo/a.txtz
/foo/b.txtz/fooz/a.txtz/b.txttt	full_pathspathresults     Z/home/james-whalen/.local/lib/python3.13/site-packages/IPython/testing/tests/test_tools.pytest_full_path_posixr      s    E\\%'7!34F1LL0116E\\%'7!34F)H())6\\%)FhZ    c                      Sn [         R                  " U SS/5      nU(       d   SS:H  /5       eSn [         R                  " U SS/5      nU(       d   SS:H  /5       e[         R                  " U S5      nUS/:X  d   eg )	Nzc:\foo\bar.pyr   r   zc:\foo\a.txtzc:\foo\b.txtzc:\foozc:\a.txtzc:\b.txtr   r   s     r   test_full_path_win32r   '   s    E\\%'7!34F9$(88996E\\%'7!34F/K;.//6\\%)Fk]"""r   c                  x    Sn SnSnXU4 H,  u  p4n[         R                  " U5      u  pgXF:X  d   eXW:X  a  M,   e   g )N)zFAILED (errors=1)   r   )zFAILED (failures=1)r   r   )zFAILED (errors=1, failures=1)r   r   )r	   parse_test_output)errfailbothtxtnerrnfailnerr1nfail1s           r   test_parserr   3   sK    
%C(D2D -5,,S1}} .r   c                      Sn [         R                  " U 5      n[        R                  R	                  U5      (       d   e[        USS9 nUR                  5       nS S S 5        WU :X  d   eg ! , (       d  f       N= f)Nzpass
zutf-8)encoding)r	   temp_pyfileospathisfileopenread)srcfnamefh2src2s       r   test_temp_pyfiler+   =   s_    
CNN3E77>>%    	eg	&#xxz 
'3;; 
'	&s   	A++
A9c                        \ rS rSrS rS rSrg)TestAssertPrintsE   c                     [         R                  " S5         [        S5        [        S5        [        S5        S S S 5        g ! , (       d  f       g = f)Nabcabcddef   ghir	   AssertPrintsprintselfs    r   test_passingTestAssertPrints.test_passingF   s/    __U#&M%L&M $##   "A
Ac                 6    S nU R                  [        U5        g )Nc                      [         R                  " S5         [        S5        [        S5        [        S5        S S S 5        g ! , (       d  f       g = f)Nr0   acdr2   r3   r4    r   r   func+TestAssertPrints.test_failing.<locals>.funcM   s/    'eef (''r;   )assertRaisesAssertionError)r8   r@   s     r   test_failingTestAssertPrints.test_failingL   s    	 	.$/r   r?   N)__name__
__module____qualname____firstlineno__r9   rD   __static_attributes__r?   r   r   r-   r-   E   s    0r   r-   c                   2    \ rS rSrS rS rS rS rS rSr	g)	Test_ipexec_validateV   c                 l    U R                  S5        Sn[        R                  " U R                  U5        g)z'Test with only stdout results.
        print('A')
print('B')
A
BNmktmpr	   ipexec_validater(   r8   outs     r   test_main_path#Test_ipexec_validate.test_main_pathW   s0     	

 " 	 
4::s+r   c                 l    U R                  S5        Sn[        R                  " U R                  U5        g)zGTest with only stdout results, expecting windows line endings.
        rO   A
BNrQ   rT   s     r   test_main_path2$Test_ipexec_validate.test_main_path2`   s0     	

 " 	 
4::s+r   c                 j    U R                  S5        Sn[        R                  " U R                  USS9  g)z3Test exception path in exception_validate.
        Yimport sys
print('A')
print('B')
print('C', file=sys.stderr)
print('D', file=sys.stderr)
rP   zC
Dexpected_outexpected_errNrQ   rT   s     r   test_exception_path(Test_ipexec_validate.test_exception_pathi   s2     	

 3 	 
4::CfMr   c                 j    U R                  S5        Sn[        R                  " U R                  USS9  g)zSTest exception path in exception_validate, expecting windows line endings.
        r]   rY   zC
Dr^   NrQ   rT   s     r   test_exception_path2)Test_ipexec_validate.test_exception_path2u   s2     	

 3 	 
4::ChOr   c                 B    [         R                  R                  U 5        g )N)r	   TempFileMixintearDownr7   s    r   rh   Test_ipexec_validate.tearDown   s     	!!$'r   r?   N)
rF   rG   rH   rI   rV   rZ   ra   rd   rh   rJ   r?   r   r   rL   rL   V   s    ,,
N
P(r   rL   )__doc__r"   unittestIPython.testingr   decr   r	   
skip_win32r   skip_if_not_win32r   r   r+   TestCaser-   rg   rL   r?   r   r   <module>rq      sx    
  - '     # #0x(( 0"/(2++ /(r   