
    hU                     j    S SK rS SKrS SKrS SKrS SKrSSKJrJrJ	r	   " S S\R                  5      rg)    N   )
write_filewrite_newer_file_parse_patternc                   j   ^  \ rS rSrU 4S jrU 4S jrS rS rS rS r	S r
S	 rS
 rS rS rSrU =r$ )TestTestUtils
   c                 V   > [         TU ]  5         [        R                  " 5       U l        g N)supersetUptempfilemkdtemptemp_dirself	__class__s    T/var/www/fran/franai/venv/lib/python3.13/site-packages/Cython/Tests/TestTestUtils.pyr   TestTestUtils.setUp   s     ((*    c                    > U R                   (       aN  [        R                  R                  U R                   5      (       a   [        R
                  " U R                   5        [        TU ]  5         g r   )r   ospathisdirshutilrmtreer   tearDownr   s    r   r   TestTestUtils.tearDown   s;    ==RWW]]4==99MM$--(r   c                 V    [         R                  R                  U R                  U5      $ r   )r   r   joinr   )r   filenames     r   
_test_pathTestTestUtils._test_path   s    ww||DMM844r   c                 8   U R                  S5      n[        XA40 UD6  [        R                  R	                  U5      (       d   e[        US5       nUR                  5       nS S S 5        WU:X  d   [        U5      [        U5      45       eg ! , (       d  f       N0= f)Nabcfilerb)r"   r   r   r   isfileopenreadrepr)r   contentexpectedkwargs	file_pathffounds          r   _test_write_fileTestTestUtils._test_write_file   s{    OOI.	900ww~~i(((()T"aFFHE # ?4>4;"??  #"s   B
Bc                 H    SnU R                  XR                  S5      5        g )Nu	   abcüöäutf8)r1   encoder   texts     r   test_write_file_text"TestTestUtils.test_write_file_text    s    dKK$78r   c                 p    SnU R                  U[        R                  " U5      R                  S5      SS9  g )Nz|
        A horse is a horse,
        of course, of course,
        And no one can talk to a horse
        of course
        r4   T)dedent)r1   textwrapr;   r5   r6   s     r   test_write_file_dedent$TestTestUtils.test_write_file_dedent$   s5     	dHOOD$9$@$@$HQUVr   c                 (    U R                  SS5        g )Ns   ab c)r1   r   s    r   test_write_file_bytes#TestTestUtils.test_write_file_bytes-   s    h1r   c                    U R                  S5      nU R                  S5      n[        US5        [        R                  R	                  U5      (       d   e[        X!S5        [        R                  R	                  U5      (       d   e[        R                  R                  U5      [        R                  R                  U5      :  d   eg )Nzabcfile1.txtzabcfile2.txtabcxyz)r"   r   r   r   r'   r   getmtime)r   file_path_1file_path_2s      r   test_write_newer_file#TestTestUtils.test_write_newer_file0   s    oon5oon5;&ww~~k****59ww~~k****ww,rww/?/?/LLLLr   c                     U R                  S5      n[        US5        [        R                  R	                  U5      n[        XS5        [        R                  R	                  U5      U:  d   eg )Nabcfile.txtrD   rE   )r"   r   r   r   rF   r   )r   r.   mtimes      r   test_write_newer_file_same(TestTestUtils.test_write_newer_file_same9   sU    OOM2	9e$  +u5ww	*U222r   c                     U R                  S5      n[        R                  R                  U5      (       a   e[	        XS5        [        R                  R                  U5      (       d   eg )NrL   rE   )r"   r   r   existsr   r'   )r   r.   s     r   test_write_newer_file_fresh)TestTestUtils.test_write_newer_file_fresh@   sL    OOM2	77>>),,,,u5ww~~i((((r   c                    U R                  [        S5      S5        U R                  [        S5      S5        U R                  [        S5      S5        U R                  [        S5      S5        U R                  [        S	5      S5        g )
Npattern)NNrU   z/start/:pattern)startNrU   z:/end/  pattern)NendrU   z/start/:/end/  pattern)rV   rW   rU   z/start/:/end/pattern)assertEqualr   r@   s    r   test_parse_pattern TestTestUtils.test_parse_patternF   s    9%#	
 	,-&	
 	,-$	
 	34'	
 	12'	
r   )r   )__name__
__module____qualname____firstlineno__r   r   r"   r1   r8   r=   rA   rI   rN   rR   rY   __static_attributes____classcell__)r   s   @r   r   r   
   sB    +
5@9W2M3)
 
r   r   )os.pathr   unittestr   r<   r   	TestUtilsr   r   r   TestCaser    r   r   <module>rf      s.         D DP
H%% P
r   