
    <e                     @   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                               n# eef$ r  ej        d          w xY wd Z G d dej                  Zedk    r ej                     dS dS )    N)rmtree
change_cwdTESTFN_UNICODETESTFN_UNENCODABLEcreate_empty_filez1No Unicode filesystem semantics on this platform.c                 p    t           j                            |           rt          j        |            d S d S N)ospathexistsunlink)filenames    -/usr/lib/python3.11/test/test_unicode_file.pyremove_if_existsr      s8    	w~~h 
	(     c                   2    e Zd Zd Zd Zd Zd Zd Zd ZdS )TestUnicodeFilesc           
         |                      t          j                            |                     |                      t          j                            |                     |                      t          j        |t          j                             |                      t          j                            t          j                            |                               |                      t          j                            t          j                            |                               |                      t          j        t          j                            |          t          j                             t          j        |d           t          j	        |d            t          j	        |t          j
                    t          j
                    f           |                     ||           |                      t          j                            |          t          j                            t          j        t          j        |                    d                   k               t          j                            t          j                            |                    \  }}t          j        |          }t!          j        d|          }d |D             }|                     ||           d S )Ni  r   NFDc                 8    g | ]}t          j        d |          S )r   )unicodedata	normalize).0fs     r   
<listcomp>z/TestUnicodeFiles._do_single.<locals>.<listcomp>4   s%    HHH[*5!44HHHr   )
assertTruer
   r   r   isfileaccessR_OKabspathchmodutimetime_do_copyishglobescapesplitlistdirr   r   assertIn)selfr   r   base	file_lists        r   
_do_singlezTestUnicodeFiles._do_single   s   x00111x00111	(BG44555rwx'@'@AABBBrwx'@'@AABBB	"'//(";";RWEEFFF
5!!!
4   
DIKK56668,,,GOOH%%rwtyXAVAV7W7WXY7Z'['[[	] 	] 	] W]]27??8#<#<==
dJt$$	 $UD11HHiHHH	dI&&&&&r   c                    |                      t          j                            |                     t          j        ||dz              |                     t          j                            |                     |                      t          j                            |dz                        t          j        |dz   |           |                     t          j                            |dz                        |                      t          j                            |                     t          j        ||dz              t          j        |dz              t          j	        ||dz              |                     t          j        
                    |                     |                      t          j        
                    |dz                        t          j	        |dz   |           |                     t          j        
                    |dz                        |                      t          j        
                    |                     t          j        ||dz              |                      t          j                            |dz                        t          j        |dz              |                     t          j        
                    |dz                        d S )Nz.new)r   r
   r   r   renameassertFalseshutilcopyr   mover   copy2)r*   	filename1	filename2s      r   r$   zTestUnicodeFiles._do_copyish9   sF   y11222
	)Y/000	22333y6'9::;;;
	)f$i000	F(:;;<<<y11222Iy61222
	)f$%%%Iy61222	22333y6'9::;;;I&	222	F(:;;<<<y11222 	Y	F 2333y6'9::;;;
	)f$%%%	F(:;;<<<<<r   c                    t           j                            |          rt          |           t          j        |           	 t          |          5  t          j                    }|}t          j        d|          }t          j        d|          }| 	                    t           j        
                    |          |           d d d            n# 1 swxY w Y   t          j        |           d S # 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   s7   7==## 	9

	 J'' K KY[[
'(25*EE
)3E;GG  !1!1*!=!=kJJJK K K K K K K K K K K K K K K HYBHYs1   C3 A3CC3 CC3 CC3 3D	c                 6   t          |           t          |           	 |                     |           t          j        |           n# t          j        |           w xY w|                     t          j                            |                      t          j        |t          j	        t          j
        z            }t          j        |           	 |                     |           t          j        |           d S # 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%%%IhBIhBGNN8444555GHbj2;677
	 OOH%%%IhBIhs   A
 
A D Dc                     |                      t                     t          |                      t                     d S d S r	   )rH   r   r   )r*   s    r   test_single_filesz"TestUnicodeFiles.test_single_filesz   s?    .))))011111 *)r   c                     d}|                      t          |z   t          |z              t          (|                      t          |z   t          |z              d S d S )Nz.dir)rB   r   r   )r*   exts     r   test_directoriesz!TestUnicodeFiles.test_directories   si     >#-~c/ABBB)1#51#57 7 7 7 7 *)r   N)	__name__
__module____qualname__r-   r$   rB   rH   rJ   rM    r   r   r   r      sn        ' ' '4= = =:     $     $2 2 2
	7 	7 	7 	7 	7r   r   __main__)r
   r%   r#   r1   sysr   unittesttest.support.os_helperr   r   r   r   r   r   supports_unicode_filenamesencodegetfilesystemencodingUnicodeError	TypeErrorSkipTestr   TestCaser   rN   mainrQ   r   r   <module>r^      sx                   



     + + + + + + + + + + + + + + 
w) UU7c799::::)$ U U U  h STTTU
  o7 o7 o7 o7 o7x( o7 o7 o7d zHMOOOOO s   A A.