
    dafg
                        d dl Z d dl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                        Z G d de
ej                  e j                        Zedk(  r e j                           yy)    N)	resources   )data01)utilc                       e Zd Zd Zy)CommonBinaryTestsc                     t        j                  |      j                  |      }|j                  d      5  	 d d d        y # 1 sw Y   y xY w)Nrbr   filesjoinpathopenselfpackagepathtargets       B/root/Python-3.12.4/Lib/test/test_importlib/resources/test_open.pyexecutezCommonBinaryTests.execute	   s?    )2248[[ 		 	 	s   AA
N__name__
__module____qualname__r        r   r   r          r   r   c                       e Zd Zd Zy)CommonTextTestsc                     t        j                  |      j                  |      }|j                  d      5  	 d d d        y # 1 sw Y   y xY w)Nutf-8encodingr   r   s       r   r   zCommonTextTests.execute   sA    )2248[['[* 		 	 	s   AANr   r   r   r   r   r      r   r   r   c                   0    e Zd Zd Zd Zd Zd Zd Zd Zy)	OpenTestsc                     t        j                  | j                        dz  }|j                  d      5 }|j	                         }| j                  |d       d d d        y # 1 sw Y   y xY w)Nzbinary.filer
   s    r   r   datar   readassertEqualr   r   fpresults       r   test_open_binaryzOpenTests.test_open_binary   sX    +m;[[ 	:"WWYFV%89	: 	: 	:s   #A  A)c                     t        j                  | j                        dz  }|j                  d      5 }|j	                         }| j                  |d       d d d        y # 1 sw Y   y xY w)Nz
utf-8.filer    r!   zHello, UTF-8 world!
r&   r*   s       r   test_open_text_default_encodingz)OpenTests.test_open_text_default_encoding   sZ    +l:[['[* 	>bWWYFV%<=	> 	> 	>s   #A!!A*c                     t        j                  | j                        dz  }|j                  dd      5 }|j	                         }d d d        | j                  d       y # 1 sw Y   xY w)Nutf-16.filezutf-16strictr"   errorszHello, UTF-16 world!
r&   r*   s       r   test_open_text_given_encodingz'OpenTests.test_open_text_given_encoding#   s\    +m;[[(8[< 	WWYF	!9:	 	s   A""A+c                 l   t        j                  | j                        dz  }|j                  dd      5 }| j	                  t
        |j                         ddd       |j                  dd      5 }|j                         }ddd       | j                  d       y# 1 sw Y   HxY w# 1 sw Y   (xY w)zD
        Raises UnicodeError without the 'errors' argument.
        r1   r    r2   r3   Nignorez*H e l l o ,   U T F - 1 6   w o r l d ! 
 )r   r   r'   r   assertRaisesUnicodeErrorr(   r)   r*   s       r   test_open_text_with_errorsz$OpenTests.test_open_text_with_errors)   s     +m;[['([; 	5rlBGG4	5[['([; 	rWWYF	7	
		5 	5	 	s   !B2B*B'*B3c                     t        j                  | j                        dz  }| j                  t              5  |j                  d       d d d        y # 1 sw Y   y xY w)Ndoes-not-existr
   r   r   r'   r8   FileNotFoundErrorr   r   r   s     r   "test_open_binary_FileNotFoundErrorz,OpenTests.test_open_binary_FileNotFoundError9   sJ    +.>>01 	KK	 	 	s   AAc                     t        j                  | j                        dz  }| j                  t              5  |j                  d       d d d        y # 1 sw Y   y xY w)Nr<   r    r!   r=   r?   s     r    test_open_text_FileNotFoundErrorz*OpenTests.test_open_text_FileNotFoundError>   sL    +.>>01 	*KKK)	* 	* 	*s   AAN)	r   r   r   r-   r/   r5   r:   r@   rB   r   r   r   r$   r$      s     :>;
 
*r   r$   c                       e Zd Zd Zy)OpenDiskTestsc                     t         | _        y )N)r   r'   )r   s    r   setUpzOpenDiskTests.setUpE   s	    	r   Nr   r   r   rF   r   r   r   rD   rD   D   s    r   rD   c                       e Zd Zd Zy)OpenDiskNamespaceTestsc                     ddl m} || _        y )Nr   )namespacedata01) rK   r'   )r   rK   s     r   rF   zOpenDiskNamespaceTests.setUpJ   s    %#	r   NrG   r   r   r   rI   rI   I   s    $r   rI   c                       e Zd Zy)OpenZipTestsN)r   r   r   r   r   r   rN   rN   P   s    r   rN   __main__)unittest	importlibr   rL   r   r   CommonTestsTestCaser   r   r$   rD   rI   ZipSetuprN   r   mainr   r   r   <module>rV      s       (((*;*; d&&(9(9 +* +*\Ix00 
$Y(9(9 $	9dmmX->-> 	 zHMMO r   