a
    3j                     @   s   d dl Z d dlmZ ddlmZ ddlmZ G dd deje jZG dd	 d	eje jZ	G d
d dZ
G dd de
e jZG dd de
eje jZedkre   dS )    N)	resources   )data01)utilc                   @   s   e Zd Zdd ZdS )CommonBinaryTestsc                 C   s0   t || W d    n1 s"0    Y  d S N)r   open_binaryselfpackagepath r   Y/www/server/python_manager/versions/3.9.10/lib/python3.9/test/test_importlib/test_open.pyexecute	   s    zCommonBinaryTests.executeN__name__
__module____qualname__r   r   r   r   r   r      s   r   c                   @   s   e Zd Zdd ZdS )CommonTextTestsc                 C   s0   t || W d    n1 s"0    Y  d S r   )r   	open_textr	   r   r   r   r      s    zCommonTextTests.executeNr   r   r   r   r   r      s   r   c                   @   s<   e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd ZdS )	OpenTestsc                 C   sF   t | jd$}| }| |d W d    n1 s80    Y  d S )Nzbinary.files    )r   r   datareadassertEqualr
   fpresultr   r   r   test_open_binary   s    zOpenTests.test_open_binaryc                 C   sF   t | jd$}| }| |d W d    n1 s80    Y  d S )Nz
utf-8.filezHello, UTF-8 world!
r   r   r   r   r   r   r   r   r   test_open_text_default_encoding   s    z)OpenTests.test_open_text_default_encodingc                 C   sJ   t | jddd}| }W d    n1 s00    Y  | |d d S )Nutf-16.filezutf-16strictzHello, UTF-16 world!
r   r   r   r   r   test_open_text_given_encoding   s    
&z'OpenTests.test_open_text_given_encodingc                 C   s   t | jddd}| t|j W d    n1 s60    Y  t | jddd}| }W d    n1 sp0    Y  | |d d S )Nr    zutf-8r!   ignorez*H e l l o ,   U T F - 1 6   w o r l d ! 
 )r   r   r   assertRaisesUnicodeErrorr   r   r   r   r   r   test_open_text_with_errors%   s    
,
&z$OpenTests.test_open_text_with_errorsc                 C   s   |  ttj| jd d S Nzdoes-not-exist)r$   FileNotFoundErrorr   r   r   r
   r   r   r   "test_open_binary_FileNotFoundError3   s    
z,OpenTests.test_open_binary_FileNotFoundErrorc                 C   s   |  ttj| jd d S r'   )r$   r(   r   r   r   r)   r   r   r    test_open_text_FileNotFoundError8   s    
z*OpenTests.test_open_text_FileNotFoundErrorN)	r   r   r   r   r   r"   r&   r*   r+   r   r   r   r   r      s   r   c                   @   s   e Zd Zdd ZdS )OpenDiskTestsc                 C   s
   t | _d S r   )r   r   r)   r   r   r   setUp?   s    zOpenDiskTests.setUpN)r   r   r   r-   r   r   r   r   r,   >   s   r,   c                   @   s   e Zd ZdS )OpenZipTestsN)r   r   r   r   r   r   r   r.   C   s   r.   __main__)Zunittest	importlibr    r   r   ZCommonResourceTestsZTestCaser   r   r   r,   ZZipSetupr.   r   mainr   r   r   r   <module>   s   *