Your IP : 216.73.216.196


Current Path : /opt/alt/python310/lib64/python3.10/test/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/test/__pycache__/test_unicode_file_functions.cpython-310.pyc

o

0�i��@sddlZddlZddlZddlZddlmZddlmZgd�Zej	dkr,e�
gd��ejjsMe�
�ZzeD]Ze�e�q7WneyLe�d��wGdd	�d	ej�ZGd
d�de�ZGdd
�d
e�ZGdd�de�ZGdd�de�Zedkr�e��dSdS)�N��	normalize)�	os_helper)
Z1_abcZ2_asciiu
3_Grüß-Gottu4_Γειά-σαςu5_Здравствуйтеu6_にぽんu7_השקצץסu8_曨曩曫u9_曨שんдΓßu	10_΅´�darwin)	u	11_΅ϓϔu12_΅ϓϔu13_ ̈́ΎΫu14_ẛ῁῍῎῏῝῞῟῭u15_΅´𣏕u
16_   Au
17_   Au
18_   Az19_   Az>only NT+ and systems with Unicode-friendly filesystem encodingc@s�eZdZee�ZdZdd�Zdd�Ze	dfdd�Z
d	d
�Zej
dkr'ee	fZneZdd
�Ze�ej
dkd�dd��Ze�ej
dkd�dd��Zdd�Zdd�ZdS)�UnicodeFileTestsNc	Cs�zt�tj�Wn	tyYnw|�tjtj�t�}|jD]6}tj	�
tj|�|��}t|d��}|�
|d�d��Wd�n1sGwYt�|�|�|�q ||_dS�N�wb�
�utf-8)�os�mkdirr�TESTFN�FileExistsErrorZ
addCleanupZrmtree�set�files�path�join�norm�open�write�encode�stat�add)�selfr�name�f�r�G/opt/alt/python310/lib64/python3.10/test/test_unicode_file_functions.py�setUp@s�
�

zUnicodeFileTests.setUpcCs|jr	t|j|�S|S�N)�normal_formr)r�srrrrPszUnicodeFileTests.normTcCs`|�|��}||�Wd�n1swY|jj}|r.|�||d|j||f�dSdS)Nz>Function '%s(%a) failed with bad filename in the exception: %a)ZassertRaisesZ	exception�filename�assertEqual�__name__)r�fnr"Zexpected_exceptionZcheck_filename�cZexc_filenamerrr�_apply_failureUs
�


��zUnicodeFileTests._apply_failurecCsj|jD]/}d|}|�t|�|�tj|�|�tj|�|�tj|�|�tj|�|�tj|�qdS)N�not_)	rr'rrr�chdir�rmdir�remove�listdir�rrrrr�
test_failures`s
�zUnicodeFileTests.test_failuresZwin32cCsR|jD]#}t|d�}|�|d�d��|��t�|�|�tj||j	�qdSr)
rrrr�closerrr'r,�_listdir_failure)rrrrrr�	test_openqs


�zUnicodeFileTests.test_openrzirrelevant test on Mac OS Xcs�t|j�}t�}tgd��D]�|t�fdd�|D��O}q||8}|D]+}|�t|�|�tj|�|�tj|�|�tj|�|�tj|�|�tj	|�q$dS)N)�NFC�NFD�NFKC�NFKDc3s�|]}t�|�VqdSrr)�.0�file�Znfrr�	<genexpr>�s�z2UnicodeFileTests.test_normalize.<locals>.<genexpr>)
rrr'rrrr)r*r+r,)rrZothersrrr8r�test_normalize}s
�zUnicodeFileTests.test_normalizecCs�t|j�}t���t�dt�t�tj	�
t����}Wd�n1s%wYt�tj	�}tdd�|D��}|�
||d||f�|�
t|�t|��dS)N�ignorecss �|]}tj�tj|�VqdSr)rrrrr
)r6rrrrr9�s�z0UnicodeFileTests.test_listdir.<locals>.<genexpr>z%a != %a)rr�warnings�catch_warnings�simplefilter�DeprecationWarningrr,rr
r�sys�getfilesystemencodingr#�len)rZsf0�f1�f2Zsf2rrr�test_listdir�s


��zUnicodeFileTests.test_listdircCs(|jD]}t�|d�t�d|�qdS)N�tmp)rr�renamer-rrr�test_rename�s
�zUnicodeFileTests.test_renamec	Cs�tj�tjd�}d}t�|��4t|d��}|�|d�d��Wd�n1s*wYt�	|tj
�t�|�Wd�dS1sFwYdS)NuGrüß-曨曩曫uß-曨曩曫rr	r
)rrrrr
Ztemp_cwdrrr�access�R_OKr+)r�dirnamer"rrrr�test_directory�s
��"�zUnicodeFileTests.test_directory)r$�
__module__�__qualname__r�	filenamesrr rr�FileNotFoundErrorr'r.r@�platform�NotADirectoryErrorr0r1�unittestZskipIfr:rErHrLrrrrr<s&
�



rc@�eZdZdZdS)�UnicodeNFCFileTestsr2N�r$rMrNr rrrrrU��rUc@rT)�UnicodeNFDFileTestsr3NrVrrrrrX�rWrXc@rT)�UnicodeNFKCFileTestsr4NrVrrrrrY�rWrYc@rT)�UnicodeNFKDFileTestsr5NrVrrrrrZ�rWrZ�__main__)rr@rSr<�unicodedatarZtest.supportrrOrQ�extendr�supports_unicode_filenamesrAZ
fsencodingrr�UnicodeEncodeErrorZSkipTestZTestCaserrUrXrYrZr$�mainrrrr�<module>s4
�
�o�