
    daf	                        d dl Z d dlmZmZ ddlmZ ddlmZ  G d dej                  e j                        Z	 G d d	ej                  e j                        Z
 G d
 d      Z G d dee j                        Z G d deej                  e j                        Z G d dee j                        Zedk(  r e j"                          yy)    N)import_module	resources   )data01)utilc                       e Zd Zd Zy)CommonBinaryTestsc                 h    t        j                  |      j                  |      j                          y )N)r   filesjoinpath
read_bytesselfpackagepaths      B/root/Python-3.12.4/Lib/test/test_importlib/resources/test_read.pyexecutezCommonBinaryTests.execute	   s"     ))$/::<    N__name__
__module____qualname__r    r   r   r	   r	      s    =r   r	   c                       e Zd Zd Zy)CommonTextTestsc                 l    t        j                  |      j                  |      j                  d       y )Nutf-8encoding)r   r   r   	read_textr   s      r   r   zCommonTextTests.execute   s'     ))$/9979Kr   Nr   r   r   r   r   r      s    Lr   r   c                   $    e Zd Zd Zd Zd Zd Zy)	ReadTestsc                     t        j                  | j                        j                  d      j	                         }| j                  |d       y )Nbinary.file    )r   r   datar   r   assertEqualr   results     r   test_read_byteszReadTests.test_read_bytes   s8    +44]CNNP-r   c                     t        j                  | j                        j                  d      j	                  d      }| j                  |d       y )Nz
utf-8.filer   r   zHello, UTF-8 world!
r   r   r&   r   r    r'   r(   s     r   test_read_text_default_encodingz)ReadTests.test_read_text_default_encoding   s@    OODII&Xl#YY( 	
 	!89r   c                     t        j                  | j                        j                  d      j	                  d      }| j                  |d       y )Nutf-16.filezutf-16r   zHello, UTF-16 world!
r,   r(   s     r   test_read_text_given_encodingz'ReadTests.test_read_text_given_encoding   s@    OODII&Xm$YY) 	
 	!9:r   c                     t        j                  | j                        dz  }| j                  t        |j
                  d       |j                  dd      }| j                  |d       y)zD
        Raises UnicodeError without the 'errors' argument.
        r/   r   r   ignore)r   errorsz*H e l l o ,   U T F - 1 6   w o r l d ! 
 N)r   r   r&   assertRaisesUnicodeErrorr    r'   )r   targetr)   s      r   test_read_text_with_errorsz$ReadTests.test_read_text_with_errors'   sa     +m;,(8(87K!!78!D7	
r   N)r   r   r   r*   r-   r0   r7   r   r   r   r"   r"      s    .:;
r   r"   c                       e Zd ZeZy)ReadDiskTestsN)r   r   r   r   r&   r   r   r   r9   r9   6   s    Dr   r9   c                       e Zd Zd Zd Zy)ReadZipTestsc                     t        d      }t        j                  |      j                  d      j	                         }| j                  |d       y Nzziptestdata.subdirectoryr$   r%   )r   r   r   r   r   r'   )r   	submoduler)   s      r   test_read_submodule_resourcez)ReadZipTests.test_read_submodule_resource;   s?    !"<=	+44]CNNP-r   c                     t        j                  d      j                  d      j                         }| j	                  |d       y r=   )r   r   r   r   r'   r(   s     r   $test_read_submodule_resource_by_namez1ReadZipTests.test_read_submodule_resource_by_name@   s7    OO67Xm$Z\ 	
 	-r   N)r   r   r   r?   rA   r   r   r   r;   r;   :   s    .
.r   r;   c                       e Zd Zd Zy)ReadNamespaceTestsc                     ddl m} || _        y )Nr   )namespacedata01) rE   r&   )r   rE   s     r   setUpzReadNamespaceTests.setUpJ   s    %#	r   N)r   r   r   rG   r   r   r   rC   rC   I   s    $r   rC   __main__)unittest	importlibr   r   rF   r   r   CommonTestsTestCaser	   r   r"   r9   ZipSetupr;   rC   r   mainr   r   r   <module>rO      s     .  =(((*;*; =
Ld&&(9(9 L
!
 !
HIx00 .9dmmX->-> .$H$5$5 $ zHMMO r   