Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/test/test_importlib/resources/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/test/test_importlib/resources/__pycache__/test_resource.cpython-312.pyc

�

)ΜgW ���ddlZddlZddlZddlZddlZddlmZddlmZmZddlm	Z	ddl
mZmZddl
mZmZddlmZGd	�d
�ZGd�deej&�ZGd
�dee	j*ej&�Zd�ZGd�dej&�ZGd�dej&�ZGd�de	j4ej&�ZGd�de	j4ej&�Zej:d��ZGd�dej&�ZGd�dej&�Z e!dk(rejD�yy)�N�)�data01)�	zipdata01�	zipdata02)�util)�	resources�
import_module)�
import_helper�	os_helper)�unlinkc��eZdZd�Zd�Zd�Zy)�
ResourceTestsc��tj|j�dz}|j|j	��y)N�binary.file)r�files�data�
assertTrue�is_file��self�targets  �H/usr/local/lib/python3.12/test/test_importlib/resources/test_resource.py�test_is_file_existsz!ResourceTests.test_is_file_existss,��������+�m�;��������(�)�c��tj|j�dz}|j|j	��y)Nz
not-a-file)rrr�assertFalserrs  r�test_is_file_missingz"ResourceTests.test_is_file_missings.��������+�l�:��������)�*rc���tj|j�dz}|j|j	��|j|j
��y)N�subdirectory)rrrrrr�is_dirrs  r�test_is_dirzResourceTests.test_is_dirs@��������+�n�<��������)�*�����
�
��(rN)�__name__�
__module__�__qualname__rrr!�rrrrs��*�+�)rrc��eZdZd�Zy)�ResourceDiskTestsc��t|_y�N)rr�rs r�setUpzResourceDiskTests.setUp!s	����	rN)r"r#r$r+r%rrr'r' s��rr'c��eZdZy)�ResourceZipTestsN)r"r#r$r%rrr-r-%s��rr-c�\�|j�D�chc]}|j��c}Scc}wr))�iterdir�name)�traversable�items  r�namesr3)s)��"-�"5�"5�"7�8�"7�$�D�I�I�"7�8�8��8s�)c�$�eZdZd�Zd�Zd�Zd�Zy)�ResourceLoaderTestsc��tjttjgd���}|j	tt
j|��hd��y)N��A�B�C��file�path�contents>r8r9r:)r�create_packager�__file__�assertEqualr3rr�r�packages  r�test_resource_contentsz*ResourceLoaderTests.test_resource_contents.s=���%�%��f�o�o��
��	
����y���w�7�8�/�Jrc���tjttjgd���}|j	tj|�jd�j��y)N�r8r9r:zD/EzD/Fr;r9)	rr?rr@rrr�joinpathrrBs  r�test_is_filez ResourceLoaderTests.test_is_file4sI���%�%��f�o�o�8U�
��	
���	����0�9�9�#�>�F�F�H�Irc���tjttjgd���}|j	tj|�jd�j��y)NrFr;�D)	rr?rr@rrrrGr rBs  rr!zResourceLoaderTests.test_is_dir:sI���%�%��f�o�o�8U�
��	
���	����0�9�9�#�>�E�E�G�Hrc���tjttjgd���}|j	tj|�jd�j��y)NrFr;�Z)	rr?rr@rrrrGrrBs  r�test_resource_missingz)ResourceLoaderTests.test_resource_missing@sK���%�%��f�o�o�8U�
��	
�������1�:�:�3�?�G�G�I�JrN)r"r#r$rDrHr!rMr%rrr5r5-s��K�J�I�Krr5c��eZdZd�Zy)�ResourceCornerCaseTestsc�v�tjttjgd���}t	�|_d|_|j
|j_|j|j_|jtj|�jd�j��y)z�
        Test odd ball packages which:
        # 1. Do not have a ResourceReader as a loader
        # 2. Are not on the file system
        # 3. Are not in a zip file
        r7r;z/path/which/shall/not/be/namedr8N)rr?rr@�object�
__loader__�__spec__�loader�originrrrrGr)r�modules  r�#test_package_has_no_reader_fallbackz;ResourceCornerCaseTests.test_package_has_no_reader_fallbackHs���$�$��f�o�o��
��#�H���:���!'�!2�!2�����!'��������������0�9�9�#�>�F�F�H�IrN)r"r#r$rWr%rrrOrOGs��JrrOc�.�eZdZeZd�Zd�Zd�Zd�Zd�Z	y)�ResourceFromZipsTest01c��td�}|jtj|�j	d�j��y�N�ziptestdata.subdirectoryr)r	rrrrGr�r�	submodules  r�test_is_submodule_resourcez1ResourceFromZipsTest01.test_is_submodule_resource^s6��!�"<�=�	����	���	�2�;�;�M�J�R�R�T�Urc��|jtjd�jd�j	��yr[�rrrrGrr*s r�$test_read_submodule_resource_by_namez;ResourceFromZipsTest01.test_read_submodule_resource_by_namebs,������O�O�6�7�
�X�m�
$�
�W�Y�	
rc�z�td�}|jttj|��ddh�y�Nr\�__init__.pyr)r	rAr3rrr]s  r�test_submodule_contentsz.ResourceFromZipsTest01.test_submodule_contentsis3��!�"<�=�	�����)�/�/�)�,�-�
�}�/M�	
rc�d�|jttjd��ddh�yrd�rAr3rrr*s r�test_submodule_contents_by_namez6ResourceFromZipsTest01.test_submodule_contents_by_nameos*������)�/�/�"<�=�>�
�M�*�	
rc��tjtjd��5}|jdk(sJ�|j	�sJ�|jd�j	�sJ�t
t|j���sJ�	ddd�jj�rJ�y#1swY�&xYw)N�ziptestdatar)r�as_filerr0r rG�len�listr/�parent�exists)rrs  r�test_as_file_directoryz-ResourceFromZipsTest01.test_as_file_directoryus���
�
�
�y���}�=�
>�$��9�9�
�-�-�-��;�;�=� �=��=�=��0�7�7�9�9�9��t�D�L�L�N�+�,�,�,�	?�
�;�;�%�%�'�'�'�'�?�
>�s�A)B8�8CN)
r"r#r$r�
ZIP_MODULEr_rbrfrirqr%rrrYrY[s!���J�V�
�
�
�(rrYc��eZdZeZd�Zy)�ResourceFromZipsTest02c���|jttjd��ddh�|jttjd��ddh�y)z�
        Test thata zip with two unrelated subpackages return
        distinct resources. Ref python/importlib_resources#44.
        zziptestdata.onerez
resource1.txtzziptestdata.twoz
resource2.txtNrhr*s r�test_unrelated_contentsz.ResourceFromZipsTest02.test_unrelated_contents�sV��
	
����)�/�/�"3�4�5�
�O�,�	
�	
����)�/�/�"3�4�5�
�O�,�	
rN)r"r#r$rrrrvr%rrrtrt~s���J�
rrtc#�>K�tjtj�}|jjd�}tj|�t
j��d�z}|j|j��tjjt|��td�	d��tj t"�5tjj%t|��ddd�tj t&�5tj(t|�=tj*d=ddd�tj t,�5t/|�ddd�y#1swY��xYw#1swY�CxYw#1swYyxYw#tj t"�5tjj%t|��ddd�n#1swYnxYwtj t&�5tj(t|�=tj*d=ddd�n#1swYnxYwtj t,�5t/|�ddd�w#1swYwxYwxYw�w)Nzziptestdata.zipz.ziprk)�pathlib�Pathrr@rorG�uuid�uuid4�write_bytes�
read_bytes�sysr=�append�strr	�
contextlib�suppress�
ValueError�remove�KeyError�path_importer_cache�modules�OSErrorr)�dir�	data_path�source_zip_path�zip_paths    r�zip_on_pathr��s��������Y�/�/�0�I��&�&�/�/�0A�B�O��|�|�C� �d�j�j�l�^�4�#8�8�H�����3�3�5�6��H�H�O�O�C��M�"��-� ��
�
�
 �
 ��
,��H�H�O�O�C��M�*�-��
 �
 ��
*��'�'��H�
�6����M�*�+��
 �
 ��
)��8��*�
)�-�
,��+�
*��*�
)���
 �
 ��
,��H�H�O�O�C��M�*�-�
,�
,���
 �
 ��
*��'�'��H�
�6����M�*�+�
*�
*���
 �
 ��
)��8��*�
)�
)�s��B>J�F.�J�)F
�!J�(,F�!J�5F"�	J�
F�J�F�J�"F+�'J�.J�)G:�1	J�:H�? J�,I�	J�I� J�9J�	J�J�J�Jc�j�eZdZdZd�Zd�Zd�Zd�Zejd�d��Z
d�Zd	�Zd
�Z
y)�DeletingZipsTestz^Having accessed resources in a zip file should not keep an open
    reference to the zip.
    c��tj�|_|j|jj�tj�}|jt
jg|���|jjtj��}|jjt|��yr))r��	ExitStack�fixtures�
addCleanup�closer
�
modules_setup�modules_cleanup�
enter_contextr�temp_dirr�)rr�r�s   rr+zDeletingZipsTest.setUp�s���"�,�,�.��
�����
�
�+�+�,��-�-�/������
�5�5�@��@��=�=�.�.�y�/A�/A�/C�D���
�
�#�#�K��$9�:rc��tjd�j�D�cgc]}|j��c}ycc}w)Nrk)rrr/r0)rr2s  r�test_iterdir_does_not_keep_openz0DeletingZipsTest.test_iterdir_does_not_keep_open�s/��(���}�=�E�E�G�H�G�t����G�H��Hs�=c�h�tjd�jd�j�y�Nrkr�rrrGrr*s r�test_is_file_does_not_keep_openz0DeletingZipsTest.test_is_file_does_not_keep_open��"�����
�&�/�/�
�>�F�F�Hrc�h�tjd�jd�j�y)Nrkznot-presentr�r*s r�'test_is_file_failure_does_not_keep_openz8DeletingZipsTest.test_is_file_failure_does_not_keep_open�r�rzDesired but not supported.c�Z�tjtjd�dz�yr�)rrlrr*s r�test_as_file_does_not_keep_openz0DeletingZipsTest.test_as_file_does_not_keep_open�s�����)�/�/�-�8�=�H�Irc�v�tjtjd�dz�j�y)zr
        Mimic what certifi does on import to make its bundle
        available for the process duration.
        rkrN)rrlr�	__enter__r*s r�$test_entered_path_does_not_keep_openz5DeletingZipsTest.test_entered_path_does_not_keep_open�s)��
	���)�/�/�-�8�=�H�I�S�S�Urc�h�tjd�jd�j�yr�)rrrGr}r*s r�#test_read_binary_does_not_keep_openz4DeletingZipsTest.test_read_binary_does_not_keep_open�s"�����
�&�/�/�
�>�I�I�Krc�l�tjd�jd�jd��y)Nrk�
utf-8.filezutf-8)�encoding)rrrG�	read_textr*s r�!test_read_text_does_not_keep_openz2DeletingZipsTest.test_read_text_does_not_keep_open�s-�����
�&�/�/��=�G�G��	H�	
rN)r"r#r$�__doc__r+r�r�r��unittest�skipr�r�r�r�r%rrr�r��sQ���;�I�I�I��X�]�]�/�0�J�1�J�V�L�
rr�c��eZdZeej
e�j�Ze	d��Z
e	d��Zd�Zd�Z
d�Zd�Zy)�ResourceFromNamespaceTest01c�V�tjj|j�yr))r~r=r�site_dir��clss r�
setUpClassz&ResourceFromNamespaceTest01.setUpClass������������%rc�V�tjj|j�yr))r~r=r�r�r�s r�
tearDownClassz)ResourceFromNamespaceTest01.tearDownClass�r�rc��|jtjtd��j	d�j��y�N�namespacedata01r)rrrr	rGrr*s rr_z6ResourceFromNamespaceTest01.test_is_submodule_resource�s1������O�O�M�*;�<�=�
�X�m�
$�
�W�Y�	
rc��|jtjd�jd�j	��yr�rar*s rrbz@ResourceFromNamespaceTest01.test_read_submodule_resource_by_name�s/������O�O�-�.�7�7�
�F�N�N�P�	
rc��ttjtd���}	|j	d�|j
|hd��y#t
$rY� wxYw�Nr��__pycache__>�utf-16.filer�r)r3rrr	r�r�rA�rr>s  rrfz3ResourceFromNamespaceTest01.test_submodule_contents�sS�������7H�)I�J�K��	��O�O�M�*�	
����#O�P���	��	�s�A�	A�Ac��ttjd��}	|jd�|j|hd��y#t$rY� wxYwr�)r3rrr�r�rAr�s  rriz;ResourceFromNamespaceTest01.test_submodule_contents_by_name�sN������):�;�<��	��O�O�M�*�	
����#O�P���	��	�s�A�	A�AN)r"r#r$r�rxryr@ror��classmethodr�r�r_rbrfrir%rrr�r��sY���<�7�<�<��)�0�0�1�H��&��&��&��&�
�
�
Q�Qrr��__main__)#r�r~r�rzrx�rrrr�	importlibrr	�test.supportr
r�test.support.os_helperrr�TestCaser'�ZipSetupr-r3r5rO�ZipSetupBaserYrt�contextmanagerr�r�r�r"�mainr%rr�<module>r�s���
�����"��.�1�)�)�)�"�
�x�'8�'8��
	�}�d�m�m�X�5F�5F�	�9�K�(�+�+�K�4J�h�/�/�J�( (�T�.�.��0A�0A� (�F
�T�.�.��0A�0A�
�$������,)
�x�(�(�)
�X%Q�(�"3�"3�%Q�P�z���H�M�M�O�r

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists