File: //usr/local/lib/python3.10/test/__pycache__/test_unicode_file_functions.cpython-310.opt-1.pyc
o
�i� � @ s d dl Z d dlZd dlZd dlZd dlmZ d dlmZ g d�Zej dkr,e�
g d�� e jjsMe�
� ZzeD ]Ze�e� q7W n eyL e�d��w G dd � d ej�ZG d
d� de�ZG dd
� d
e�ZG dd� de�ZG dd� de�Zedkr�e�� dS dS )� N�� normalize)� os_helper)
Z1_abcZ2_asciiu
3_Grüß-Gottu 4_Γειά-σαςu 5_Здравствуйтеu 6_にぽんu 7_השקצץסu 8_曨曩曫u 9_曨שんдΓßu 10_΅´�darwin) u 11_΅ϓϔu 12_΅ϓϔu 13_ ̈́ΎΫu 14_ẛ῁῍῎῏῝῞῟῭u 15_΅´𣏕u
16_ Au
17_ Au
18_ Az19_ Az>only NT+ and systems with Unicode-friendly filesystem encodingc @ s� e Zd Zee�ZdZdd� Zdd� Ze dfdd�Z
d d
� Zej
dkr'ee fZneZdd
� Ze�ej
dkd�dd� �Ze�ej
dkd�dd� �Zdd� Zdd� ZdS )�UnicodeFileTestsNc C s� zt �tj� W n ty Y nw | �tjtj� t� }| jD ]6}t j �
tj| �|��}t|d��}|�
|d �d�� W d � n1 sGw Y t �|� |�|� q || _d S �N�wb�
�utf-8)�os�mkdirr �TESTFN�FileExistsErrorZ
addCleanup�rmtree�set�files�path�join�norm�open�write�encode�stat�add)�selfr �name�f� r �=/usr/local/lib/python3.10/test/test_unicode_file_functions.py�setUp@ s �
�
zUnicodeFileTests.setUpc C s | j r t| j |�S |S �N)�normal_formr )r �sr r r r P s zUnicodeFileTests.normTc C s` | � |��}||� W d � n1 sw Y |jj}|r.| �||d|j||f � d S d S )Nz>Function '%s(%a) failed with bad filename in the exception: %a)ZassertRaises� exception�filename�assertEqual�__name__)r �fnr$ Zexpected_exceptionZcheck_filename�cZexc_filenamer r r �_apply_failureU s
�
��zUnicodeFileTests._apply_failurec C sj | j D ]/}d| }| �t|� | �tj|� | �tj|� | �tj|� | �tj|� | �tj|� qd S )N�not_) r r) r r r �chdir�rmdir�remove�listdir�r r r r r �
test_failures` s
�zUnicodeFileTests.test_failures�win32c C sR | j D ]#}t|d�}|�|d �d�� |�� t�|� | �tj|| j � qd S r )
r r r r �closer r r) r. �_listdir_failure)r r r r r r � test_openq s
�zUnicodeFileTests.test_openr zirrelevant test on Mac OS Xc s� t | j�}t � }t g d��D ]� |t � fdd�|D ��O }q||8 }|D ]+}| �t|� | �tj|� | �tj|� | �tj|� | �tj|� | �tj |� q$d S )N)�NFC�NFD�NFKC�NFKDc 3 s � | ]}t � |�V qd S r r )�.0�file�Znfr r � <genexpr>� s � z2UnicodeFileTests.test_normalize.<locals>.<genexpr>)
r r r) r r r r+ r, r- r. )r r Zothersr r r; r �test_normalize} s
�zUnicodeFileTests.test_normalizec C s� t | j�}t�� � t�dt� t�tj �
t�� ��}W d � n1 s%w Y t�tj �}t dd� |D ��}| �
||d||f � | �
t|�t|�� d S )N�ignorec s s � | ]}t j�tj|�V qd S r )r r r r r
)r9 r r r r r<