
    daf                     `   d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlmZm	Z	m
Z
mZmZ e j                  j                  s"	  e
j                   ej                                 d Z G d dej*                        Zedk(  r ej0                          yy# eef$ r  ej&                  d      w xY w)    N)rmtree
change_cwdTESTFN_UNICODETESTFN_UNENCODABLEcreate_empty_filez1No Unicode filesystem semantics on this platform.c                 n    t         j                  j                  |       rt        j                  |        y y N)ospathexistsunlink)filenames    1/root/Python-3.12.4/Lib/test/test_unicode_file.pyremove_if_existsr      s#    	ww~~h
		(      c                   0    e Zd Zd Zd Zd Zd Zd Zd Zy)TestUnicodeFilesc           
         | j                  t        j                  j                  |             | j                  t        j                  j	                  |             | j                  t        j
                  |t        j                               | j                  t        j                  j                  t        j                  j                  |                   | j                  t        j                  j	                  t        j                  j                  |                   | j                  t        j
                  t        j                  j                  |      t        j                               t        j                  |d       t        j                  |d        t        j                  |t        j                         t        j                         f       | j                  ||       | j                  t        j                  j                  |      t        j                  j                  t        j                  t        j                  |            d         k(         t        j                  j                  t        j                  j                  |            \  }}t        j                  |      }t!        j"                  d|      }|D cg c]  }t!        j"                  d|       }}| j%                  ||       y c c}w )Ni  r   NFD)
assertTruer
   r   r   isfileaccessR_OKabspathchmodutimetime_do_copyishglobescapesplitlistdirunicodedata	normalizeassertIn)selfr   r   base	file_listfs         r   
_do_singlezTestUnicodeFiles._do_single   s   x01x01		(BGG45rwwx'@ABrwwx'@AB		"''//(";RWWEF
5!
4 
DIIK568,GGOOH%rwwtyyXAV7WXY7Z'[[	] WW]]277??8#<=
dJJt$	 $$UD1>GH[**5!4H	HdI& Is   Lc                    | j                  t        j                  j                  |             t        j                  ||dz          | j                  t        j                  j                  |             | j                  t        j                  j                  |dz                t        j                  |dz   |       | j                  t        j                  j                  |dz                | j                  t        j                  j                  |             t        j                  ||dz          t        j                  |dz          t        j                  ||dz          | j                  t        j                  j                  |             | j                  t        j                  j                  |dz                t        j                  |dz   |       | j                  t        j                  j                  |dz                | j                  t        j                  j                  |             t        j                  ||dz          | j                  t        j                  j                  |dz                t        j                  |dz          | j                  t        j                  j                  |dz                y )Nz.new)r   r
   r   r   renameassertFalseshutilcopyr   mover   copy2)r&   	filename1	filename2s      r   r   zTestUnicodeFiles._do_copyish9   s   y12
		)Y/0	23y6'9:;
		)f$i0	F(:;<y12Iy612
		)f$%Iy612	23y6'9:;I&	2	F(:;<y12 	Y	F 23y6'9:;
		)f$%	F(:;<r   c                    t         j                  j                  |      rt        |       t        j                  |       	 t        |      5  t        j                         }|}t        j                  d|      }t        j                  d|      }| j                  t         j                  j                  |      |       d d d        t        j                  |       y # 1 sw Y   xY w# t        j                  |       w xY w)Nr   )r
   r   isdirr   mkdirr   getcwdr#   r$   assertEqualbasenamermdir)r&   	make_name
chdir_name
cwd_resultname_results        r   _do_directoryzTestUnicodeFiles._do_directoryV   s    77==#9

	 J' KYY[
'(225*E
)33E;G  !1!1*!=kJK HHYK K HHYs%   C( A2C>C( C%!C( (C?c                 &   t        |       t        |       	 | j                  |       t        j                  |       | j                  t        j                  j                  |              t        j                  |t        j                  t        j                  z        }t        j                  |       	 | j                  |       t        j                  |       y # t        j                  |       w xY w# t        j                  |       w xY wr	   )r   r   r*   r
   r   r   r   r   openO_CREATO_WRONLYclose)r&   r   r)   s      r   _test_singlezTestUnicodeFiles._test_singleh   s    "(#	 OOH%IIhBGGNN8445GGHbjj2;;67
	 OOH%IIh IIh IIhs   C 8C9 C69Dc                 f    | j                  t               t        | j                  t               y y r	   )rE   r   r   )r&   s    r   test_single_filesz"TestUnicodeFiles.test_single_filesz   s*    .))01 *r   c                     d}| j                  t        |z   t        |z          t        !| j                  t        |z   t        |z          y y )Nz.dir)r?   r   r   )r&   exts     r   test_directoriesz!TestUnicodeFiles.test_directories   sL     >#-~c/AB)1#51#57 *r   N)	__name__
__module____qualname__r*   r   r?   rE   rG   rJ    r   r   r   r      s     '4=: $ $2
	7r   r   __main__)r
   r   r   r.   sysr#   unittesttest.support.os_helperr   r   r   r   r   r   supports_unicode_filenamesencodegetfilesystemencodingUnicodeError	TypeErrorSkipTestr   TestCaser   rK   mainrN   r   r   <module>r[      s      
  + + 
ww))U7c779:o7x(( o7d zHMMO w )$ U  h STTUs   !B B-