
    @gz
                        d dl Z d dl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                  e j                        Z G d de	ej                  e j                        Z G d de	ej                  e j                        Z G d de	ej                  e j                        Zedk(  r e j"                          yy)    N   )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	resourcesfilesjoinpathopenselfpackagepathtargets       X/var/www/openai/venv/lib/python3.12/site-packages/importlib_resources/tests/test_open.pyexecutezCommonBinaryTests.execute	   s6    )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   s8    )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                  |t        t        d                   d d d        y # 1 sw Y   y xY w)Nzbinary.filer      )r
   r   datar   readassertEqualbytesranger   r   fpresults       r   test_open_binaryzOpenTests.test_open_binary   sV    +m;[["WWYFVU58_5 s   5A22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   r&   r   r'   r(   r+   s       r   test_open_text_default_encodingz)OpenTests.test_open_text_default_encoding   sQ    +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!
r0   r+   s       r   test_open_text_given_encodingz'OpenTests.test_open_text_given_encoding#   sU    +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.
        r3   r   r4   r5   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;[['([;rlBGG4 <[['([;rWWYF <7	
	 <;;;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&   r:   FileNotFoundErrorr   r   r   s     r   "test_open_binary_FileNotFoundErrorz,OpenTests.test_open_binary_FileNotFoundError9   sA    +.>>01KK 211s   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?   rA   s     r    test_open_text_FileNotFoundErrorz*OpenTests.test_open_text_FileNotFoundError>   sC    +.>>01KKK) 211s   AAN)	r   r   r   r.   r1   r7   r<   rB   rD   r   r   r   r#   r#      s     6>;
 
*r   r#   c                       e Zd Zy)OpenDiskTestsNr   r   r   r   r   r   rF   rF   D       r   rF   c                       e Zd ZdZy)OpenDiskNamespaceTestsnamespacedata01Nr   r   r   MODULEr   r   r   rJ   rJ   H       Fr   rJ   c                       e Zd Zy)OpenZipTestsNrG   r   r   r   rP   rP   L   rH   r   rP   c                       e Zd ZdZy)OpenNamespaceZipTestsrK   NrL   r   r   r   rR   rR   P   rN   r   rR   __main__)unittestimportlib_resourcesr
    r   CommonTestsTestCaser   r   r#   	DiskSetuprF   rJ   ZipSetuprP   rR   r   mainr   r   r   <module>r\      s     ' (((*;*; d&&(9(9 +* +*\	It~~x/@/@ 	Y8I8I 	9dmmX->-> 	It}}h6G6G  zHMMO r   