Your IP : 216.73.216.196


Current Path : /opt/alt/python37/lib64/python3.7/test/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/test/__pycache__/test_unicode_file_functions.cpython-37.pyc

B

� f\�@s0ddlZddlZddlZddlZddlmZddlmZdddddd	d
ddd
g
Zej	dkrve�
dddddddddg	�ejjs�e�
�ZyxeD]Ze�e�q�WWnek
r�e�d��YnXGdd�dej�ZGdd�de�ZGdd�de�ZGdd �d e�ZGd!d"�d"e�Zd#d$�Zed%k�r,e�dS)&�N)�	normalize)�supportZ1_abcZ2_asciiu
3_Grüß-Gottu4_Γειά-σαςu5_Здравствуйтеu6_にぽんu7_השקצץסu8_曨曩曫u9_曨שんдΓßu	10_΅´�darwinu	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�yt�tj�Wntk
r$YnX|�tjtj�t�}xb|jD]X}tj	�
tj|�|��}t|d��}|�
|d�d��WdQRXt�|�|�|�qDW||_dS)N�wb�
zutf-8)�os�mkdirr�TESTFN�FileExistsErrorZ
addCleanupZrmtree�set�files�path�join�norm�open�write�encode�stat�add)�selfr
�name�f�r�E/opt/alt/python37/lib64/python3.7/test/test_unicode_file_functions.py�setUp?s
zUnicodeFileTests.setUpcCs|jrt|j|�S|S)N)�normal_formr)r�srrrrOszUnicodeFileTests.normTc	CsH|�|��}||�WdQRX|jj}|rD|�||d|j||f�dS)Nz>Function '%s(%a) failed with bad filename in the exception: %a)ZassertRaisesZ	exception�filename�assertEqual�__name__)r�fnrZexpected_exceptionZcheck_filename�cZexc_filenamerrr�_apply_failureTs
zUnicodeFileTests._apply_failurecCsnxh|jD]^}d|}|�t|�|�tj|�|�tj|�|�tj|�|�tj|�|�tj|�qWdS)N�not_)	r
r#rrr�chdir�rmdir�remove�listdir)rrrrr�
test_failures_szUnicodeFileTests.test_failuresZwin32cCsVxP|jD]F}t|d�}|�|d�d��|��t�|�|�tj||j	�qWdS)Nrrzutf-8)
r
rrr�closerrr#r(�_listdir_failure)rrrrrr�	test_openps

zUnicodeFileTests.test_openrzirrelevant test on Mac OS Xcs�t|j�}t�}x2tddddg�D]�|t�fdd�|D��O}q"W||8}x^|D]V}|�t|�|�tj|�|�tj|�|�tj|�|�tj|�|�tj	|�qRWdS)N�NFC�NFD�NFKC�NFKDc3s|]}t�|�VqdS)N)r)�.0�file)�nfrr�	<genexpr>�sz2UnicodeFileTests.test_normalize.<locals>.<genexpr>)
rr
r#rrrr%r&r'r()rr
Zothersrr)r3r�test_normalize|s

zUnicodeFileTests.test_normalizec	Cs�t|j�}t���(t�dt�t�tj	�
t����}WdQRXt�tj	�}tdd�|D��}|�
||d||f�|�
t|�t|��dS)N�ignorecss|]}tj�tj|�VqdS)N)rrrrr
)r1rrrrr4�sz0UnicodeFileTests.test_listdir.<locals>.<genexpr>z%a != %a)rr
�warnings�catch_warnings�simplefilter�DeprecationWarningrr(rr
r�sys�getfilesystemencodingr�len)rZsf0�f1�f2Zsf2rrr�test_listdir�s

 zUnicodeFileTests.test_listdircCs,x&|jD]}t�|d�t�d|�qWdS)NZtmp)r
r�rename)rrrrr�test_rename�szUnicodeFileTests.test_renamec
Csptj�tjd�}d}t�|��Ht|d��}|�|d�d��WdQRXt�	|tj
�t�|�WdQRXdS)NuGrüß-曨曩曫uß-曨曩曫rrzutf-8)rrrrr
Ztemp_cwdrrr�access�R_OKr')r�dirnamerrrrr�test_directory�szUnicodeFileTests.test_directory)r �
__module__�__qualname__r�	filenamesr
rrr�FileNotFoundErrorr#r)r;�platform�NotADirectoryErrorr+r,�unittestZskipIfr5r@rBrFrrrrr;s	

rc@seZdZdZdS)�UnicodeNFCFileTestsr-N)r rGrHrrrrrrN�srNc@seZdZdZdS)�UnicodeNFDFileTestsr.N)r rGrHrrrrrrO�srOc@seZdZdZdS)�UnicodeNFKCFileTestsr/N)r rGrHrrrrrrP�srPc@seZdZdZdS)�UnicodeNFKDFileTestsr0N)r rGrHrrrrrrQ�srQcCst�ttttt�dS)N)rZrun_unittestrrNrOrPrQrrrr�	test_main�srR�__main__)rr;rMr7ZunicodedatarZtestrrIrK�extendr�supports_unicode_filenamesr<Z
fsencodingrr�UnicodeEncodeErrorZSkipTestZTestCaserrNrOrPrQrRr rrrr�<module>sR	

m