o
    g                     @   s   d dl Z d dlZd dlZd dlZddlmZ G dd dejejZG dd dZ	G dd	 d	e	ej
ejZG d
d de	ejZG dd de	ejejZedkrTe  dS dS )    N   )utilc                   @      e Zd Zdd ZdS )CommonTestsc                 C   s<   t t ||	 W d    d S 1 sw   Y  d S )N)	resourcesas_filefilesjoinpath)selfpackagepath r   Z/var/www/visachat/venv/lib/python3.10/site-packages/importlib_resources/tests/test_path.pyexecute   s   "zCommonTests.executeN)__name__
__module____qualname__r   r   r   r   r   r   
       r   c                   @   r   )	PathTestsc                 C   sz   t | jd }t |&}| |tj | |j	dt
| | d|jdd W d   dS 1 s6w   Y  dS )zF
        Path should be readable and a pathlib.Path instance.
        
utf-8.filezHello, UTF-8 world!
zutf-8)encodingN)r   r   datar   assertIsInstancepathlibPath
assertTruenameendswithreprassertEqual	read_textr
   targetr   r   r   r   test_reading   s   "zPathTests.test_readingN)r   r   r   r#   r   r   r   r   r      r   r   c                   @   r   )PathDiskTestsc                 C   sP   t | jd }t |}dt|v sJ W d   dS 1 s!w   Y  dS )z
        Guarantee the internal implementation detail that
        file-system-backed resources do not get the tempdir
        treatment.
        r   r   N)r   r   r   r   strr!   r   r   r   test_natural_path   s   "zPathDiskTests.test_natural_pathN)r   r   r   r&   r   r   r   r   r$      r   r$   c                   @   r   )PathMemoryTestsc                 C   sB   t d}| |j tj|tdd| _d | jj_	d| jj_
d S )Ns   Hello, UTF-8 world!
zpackage exists only in memory)filer   F)ioBytesIO
addCleanupcloser   create_packageFileNotFoundErrorr   __spec__originhas_location)r
   r(   r   r   r   setUp)   s   

zPathMemoryTests.setUpN)r   r   r   r2   r   r   r   r   r'   (   r   r'   c                   @   r   )PathZipTestsc                 C   sH   t | jd }t |}|  W d   dS 1 sw   Y  dS )z
        It is not an error if the file that was temporarily stashed on the
        file system is removed inside the `with` stanza.
        r   N)r   r   r   r   unlinkr!   r   r   r   test_remove_in_context_manager4   s   
"z+PathZipTests.test_remove_in_context_managerN)r   r   r   r5   r   r   r   r   r3   3   r   r3   __main__)r)   r   unittestimportlib_resourcesr    r   r   TestCaser   	DiskSetupr$   r'   ZipSetupr3   r   mainr   r   r   r   <module>   s    