o
    }¨Êhþ  ã                   @   s²   d dl Z 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rWe  ¡  dS dS )é    Né   )Údata01)Úutil)Úimport_modulec                   @   ó   e Zd Zdd„ ZdS )ÚCommonBinaryTestsc                 C   ó   t  ||¡ d S ©N)Ú	resourcesÚread_binary©ÚselfÚpackageÚpath© r   úU/var/www/html/env/lib/python3.10/site-packages/importlib_resources/tests/test_read.pyÚexecute
   ó   zCommonBinaryTests.executeN©Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r   	   ó    r   c                   @   r   )ÚCommonTextTestsc                 C   r   r	   )r
   Ú	read_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	S )
Ú	ReadTestsc                 C   ó   t  | jd¡}|  |d¡ d S )Núbinary.fileó    )r
   r   ÚdataÚassertEqual©r   Úresultr   r   r   Útest_read_binary   ó   zReadTests.test_read_binaryc                 C   r   )Nz
utf-8.filezHello, UTF-8 world!
©r
   r   r   r    r!   r   r   r   Útest_read_text_default_encoding   r$   z)ReadTests.test_read_text_default_encodingc                 C   s"   t j| jddd�}|  |d¡ d S )Núutf-16.filezutf-16)ÚencodingzHello, UTF-16 world!
r%   r!   r   r   r   Útest_read_text_given_encoding   s   ÿz'ReadTests.test_read_text_given_encodingc                 C   s6   |   ttj| jd¡ tj| jddd�}|  |d¡ d S )Nr'   Úignore)Úerrorsz*H e l l o ,   U T F - 1 6   w o r l d ! 
 )ÚassertRaisesÚUnicodeErrorr
   r   r   r    r!   r   r   r   Útest_read_text_with_errors!   s   ÿþz$ReadTests.test_read_text_with_errorsN)r   r   r   r#   r&   r)   r.   r   r   r   r   r      s
    r   c                   @   s   e Zd ZeZdS )ÚReadDiskTestsN)r   r   r   r   r   r   r   r   r   r/   -   s    r/   c                   @   s   e Zd Zdd„ Zdd„ ZdS )ÚReadZipTestsc                 C   s$   t dƒ}t |d¡}|  |d¡ d S ©Nzziptestdata.subdirectoryr   r   )r   r
   r   r    )r   Ú	submoduler"   r   r   r   Útest_read_submodule_resource2   s
   ÿz)ReadZipTests.test_read_submodule_resourcec                 C   s   t  dd¡}|  |d¡ d S r1   )r
   r   r    r!   r   r   r   Ú$test_read_submodule_resource_by_name8   s   ÿz1ReadZipTests.test_read_submodule_resource_by_nameN)r   r   r   r3   r4   r   r   r   r   r0   1   s    r0   Ú__main__)ÚunittestÚimportlib_resourcesr
   Ú r   r   Ú	importlibr   ÚCommonTestsÚTestCaser   r   r   r/   ÚZipSetupr0   r   Úmainr   r   r   r   Ú<module>   s    ÿ