Current File : //usr/local/apps/python3/lib/python3.11/test/__pycache__/test_unicode_file.cpython-311.pyc |
�
�Ke� � �@ � d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlmZm Z m
Z
mZmZ e j
j s: e
j ej � � � � n# eef$ r ej d� � �w xY wd� Z G d� dej � � Zedk r ej � � dS dS )� N)�rmtree�
change_cwd�TESTFN_UNICODE�TESTFN_UNENCODABLE�create_empty_filez1No Unicode filesystem semantics on this platform.c �p � t j � | � � rt j | � � d S d S �N)�os�path�exists�unlink)�filenames �@/usr/local/apps/python3/lib/python3.11/test/test_unicode_file.py�remove_if_existsr s8 � � �w�~�~�h��� �
� �(������� � c �2 � e Zd Zd� Zd� Zd� Zd� Zd� Zd� ZdS )�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_singlezTestUnicodeFiles._do_single s � ��������x�0�0�1�1�1��������x�0�0�1�1�1����� �(�B�G�4�4�5�5�5��������r�w���x�'@�'@�A�A�B�B�B��������r�w���x�'@�'@�A�A�B�B�B����� �"�'�/�/�(�";�";�R�W�E�E�F�F�F�
���5�!�!�!�
���4� � � �
���D�I�K�K�����5�6�6�6�����8�,�,�,�����G�O�O�H�%�%�r�w���t�y���X�AV�AV�7W�7W�XY�7Z�'[�'[�[� ]� ]� ]� �W�]�]�2�7�?�?�8�#<�#<�=�=�
��d��J�t�$�$� � �$�U�D�1�1��H�H�i�H�H�H� ��
�
�d�I�&�&�&�&�&r c �� � | � t j � |� � � � t j ||dz � � | � t j � |� � � � | � t j � |dz � � � � t j |dz |� � | � t j � |dz � � � � | � t j � |� � � � t
j ||dz � � t j |dz � � t
j ||dz � � | � t j �
|� � � � | � t j �
|dz � � � � t
j |dz |� � | � t j �
|dz � � � � | � t j �
|� � � � t
j ||dz � � | � t j � |dz � � � � t j |dz � � | � t j �
|dz � � � � d S )Nz.new)r r
r r �rename�assertFalse�shutil�copyr
�mover �copy2)r* � filename1� filename2s r r$ zTestUnicodeFiles._do_copyish9 sF � ��������y�1�1�2�2�2�
� �)�Y��/�0�0�0�������� �2�2�3�3�3��������y�6�'9�:�:�;�;�;�
� �)�f�$�i�0�0�0�������� �F�(:�;�;�<�<�<��������y�1�1�2�2�2���I�y�6�1�2�2�2�
� �)�f�$�%�%�%���I�y�6�1�2�2�2�������� �2�2�3�3�3��������y�6�'9�:�:�;�;�;���I��&� �2�2�2�������� �F�(:�;�;�<�<�<��������y�1�1�2�2�2� ��Y� �F� 2�3�3�3��������y�6�'9�:�:�;�;�;�
� �)�f�$�%�%�%�������� �F�(:�;�;�<�<�<�<�<r c � � t j � |� � rt |� � t j |� � t |� � 5 t j � � }|}t j d|� � }t j d|� � }| � t j �
|� � |� � d d d � � n# 1 swxY w Y t j |� � d S # t j |� � w xY w)Nr )r
r �isdirr �mkdirr �getcwdr r �assertEqual�basename�rmdir)r* � make_name�
chdir_name�
cwd_result�name_results r �
_do_directoryzTestUnicodeFiles._do_directoryV s7 � �
�7�=�=��#�#� ��9����
������
��J�'�'�
K�
K��Y�[�[�
�'��(�2�5�*�E�E�
�)�3�E�;�G�G��� � ���!1�!1�*�!=�!=�k�J�J�J�
K�
K�
K�
K�
K�
K�
K�
K�
K�
K�
K����
K�
K�
K�
K�
�H�Y�������B�H�Y�������s1 �C3 �A3C�C3 �C�C3 �C�C3 �3D c �6 � t |� � t |� � | � |� � t j |� � n# t j |� � w xY w| � t j � |� � � � t j |t j t j
z � � }t j |� � | � |� � t j |� � d S # t j |� � w xY wr )r r r- r
r
r r r �open�O_CREAT�O_WRONLY�close)r* r r s r �_test_singlezTestUnicodeFiles._test_singleh s� � ���"�"�"��(�#�#�#� ��O�O�H�%�%�%��I�h������B�I�h�����������B�G�N�N�8�4�4�4�5�5�5��G�H�b�j�2�;�6�7�7��
������ ��O�O�H�%�%�%��I�h�������B�I�h�������s �A
�
A �D �Dc � � | � 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����7�c�7�9�9�:�:�:�:���)�$� U� U� U� �h�� S�T�T�T�U����
� � �o7� o7� o7� o7� o7�x�(� o7� o7� o7�d �z����H�M�O�O�O�O�O� �s �A �A.