Your IP : 216.73.216.60


Current Path : /opt/alt/python39/lib64/python3.9/test/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/test/__pycache__/test_unicode_file_functions.cpython-39.pyc

a

XC?h��@sddlZddlZddlZddlZddlmZddlmZgd�Zej	dkrXe�
gd��ejjs�e�
�ZzeD]Ze�e�qnWney�e�d��Yn0Gdd	�d	ej�ZGd
d�de�ZGdd
�d
e�ZGdd�de�ZGdd�de�Zedk�re��dS)�N��	normalize)�support)
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
dkrNee	fZneZdd
�Ze�ej
dkd�dd��Ze�ej
dkd�dd��Zdd�Zdd�ZdS)�UnicodeFileTestsNc	Cs�zt�tj�Wnty"Yn0|�tjtj�t�}|jD]l}tj	�
tj|�|��}t|d��$}|�
|d�d��Wd�n1s�0Yt�|�|�|�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�E/opt/alt/python39/lib64/python3.9/test/test_unicode_file_functions.py�setUp?s
2
zUnicodeFileTests.setUpcCs|jrt|j|�S|S�N)�normal_formr)r�srrrrOszUnicodeFileTests.normTcCs\|�|��}||�Wd�n1s(0Y|jj}|rX|�||d|j||f�dS)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_failureTs&

�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]F}t|d�}|�|d�d��|��t�|�|�tj||j	�qdSr)
rrrr�closerrr'r,�_listdir_failure)rrrrrr�	test_openps


zUnicodeFileTests.test_openrzirrelevant test on Mac OS Xcs�t|j�}t�}tgd��D]�|t�fdd�|D��O}q||8}|D]V}|�t|�|�tj|�|�tj|�|�tj|�|�tj|�|�tj	|�qHdS)N)�NFC�NFD�NFKC�NFKDc3s|]}t�|�VqdSrr)�.0�file�Znfrr�	<genexpr>��z2UnicodeFileTests.test_normalize.<locals>.<genexpr>)
rrr'rrrr)r*r+r,)rrZothersrrr8r�test_normalize|s
zUnicodeFileTests.test_normalizecCs�t|j�}t���2t�dt�t�tj	�
t����}Wd�n1sJ0Yt�tj	�}tdd�|D��}|�
||d||f�|�
t|�t|��dS)N�ignorecss|]}tj�tj|�VqdSr)rrrrr
)r6rrrrr9�r: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

4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�|��ft|d��$}|�|d�d��Wd�n1sT0Yt�	|tj
�t�|�Wd�n1s�0YdS)NuGrüß-曨曩曫uß-曨曩曫rr	r
)rrrrr
Ztemp_cwdrrr�access�R_OKr+)r�dirnamer"rrrr�test_directory�s2zUnicodeFileTests.test_directory)r$�
__module__�__qualname__r�	filenamesrr rr�FileNotFoundErrorr'r.rA�platform�NotADirectoryErrorr0r1�unittestZskipIfr;rFrIrMrrrrr;s$�





rc@seZdZdZdS)�UnicodeNFCFileTestsr2N�r$rNrOr rrrrrU�srUc@seZdZdZdS)�UnicodeNFDFileTestsr3NrVrrrrrW�srWc@seZdZdZdS)�UnicodeNFKCFileTestsr4NrVrrrrrX�srXc@seZdZdZdS)�UnicodeNFKDFileTestsr5NrVrrrrrY�srY�__main__)rrArTr=�unicodedatar�testrrPrR�extendr�supports_unicode_filenamesrBZ
fsencodingrr�UnicodeEncodeErrorZSkipTestZTestCaserrUrWrXrYr$�mainrrrr�<module>s,
m