o
    g;	                     @   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ZG dd de
eje jZedkr]e   dS dS )    N)	resources   )data01)utilc                   @      e Zd Zdd ZdS )CommonBinaryTestsc                 C   2   t ||	 W d    d S 1 sw   Y  d S N)r   open_binaryselfpackagepath r   S/Users/admin/.pyenv/versions/3.10.0/lib/python3.10/test/test_importlib/test_open.pyexecute	      "zCommonBinaryTests.executeN__name__
__module____qualname__r   r   r   r   r   r          r   c                   @   r   )CommonTextTestsc                 C   r   r	   )r   	open_textr   r   r   r   r      r   zCommonTextTests.executeNr   r   r   r   r   r      r   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   H   t | jd}| }| |d W d    d S 1 sw   Y  d S )Nzbinary.files    )r   r
   datareadassertEqualr   fpresultr   r   r   test_open_binary      "zOpenTests.test_open_binaryc                 C   r   )Nz
utf-8.filezHello, UTF-8 world!
r   r   r   r   r   r   r   r   r   test_open_text_default_encoding   r#   z)OpenTests.test_open_text_default_encodingc                 C   sJ   t | jddd}| }W d    n1 sw   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 sw   Y  t | jddd}| }W d    n1 s8w   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      |  ttj| jd d S Nzdoes-not-exist)r*   FileNotFoundErrorr   r
   r   r   r   r   r   "test_open_binary_FileNotFoundError1      z,OpenTests.test_open_binary_FileNotFoundErrorc                 C   r-   r.   )r*   r/   r   r   r   r0   r   r   r    test_open_text_FileNotFoundError6   r2   z*OpenTests.test_open_text_FileNotFoundErrorN)	r   r   r   r"   r%   r(   r,   r1   r3   r   r   r   r   r      s    r   c                   @   r   )OpenDiskTestsc                 C   s
   t | _d S r	   )r   r   r0   r   r   r   setUp=   s   
zOpenDiskTests.setUpNr   r   r   r5   r   r   r   r   r4   <   r   r4   c                   @   r   )OpenDiskNamespaceTestsc                 C   s   ddl m} || _d S )Nr   )namespacedata01) r8   r   )r   r8   r   r   r   r5   B   s   
zOpenDiskNamespaceTests.setUpNr6   r   r   r   r   r7   A   r   r7   c                   @   s   e Zd ZdS )OpenZipTestsN)r   r   r   r   r   r   r   r:   H   s    r:   __main__)Zunittest	importlibr   r9   r   r   ZCommonResourceTestsZTestCaser   r   r   r4   r7   ZZipSetupr:   r   mainr   r   r   r   <module>   s    (