a
    ij                     @   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re  dS )    N   )utilc                   @   s   e Zd Zdd ZdS )CommonTestsc                 C   s:   t t || W d    n1 s,0    Y  d S )N)	resourcesas_filefilesjoinpath)selfpackagepath r   a/home/ghrups/robot-bench/.venv/lib/python3.9/site-packages/importlib_resources/tests/test_path.pyexecute   s    zCommonTests.executeN)__name__
__module____qualname__r   r   r   r   r   r   
   s   r   c                   @   s   e Zd Zdd ZdS )	PathTestsc                 C   sx   t | jd }t |J}| |tj | |j	dt
| | d|jdd W d   n1 sj0    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   ZassertIsInstancepathlibPathZ
assertTruenameendswithreprZassertEqual	read_textr	   targetr   r   r   r   test_reading   s
    zPathTests.test_readingN)r   r   r   r   r   r   r   r   r      s   r   c                   @   s   e Zd Zdd ZdS )PathDiskTestsc                 C   sN   t | jd }t | }dt|v s,J W d   n1 s@0    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      s   r   c                   @   s   e Zd Zdd ZdS )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BytesIOZ
addCleanupcloser   Zcreate_packageFileNotFoundErrorr   __spec__originhas_location)r	   r#   r   r   r   setUp)   s    

zPathMemoryTests.setUpN)r   r   r   r+   r   r   r   r   r"   (   s   r"   c                   @   s   e Zd Zdd ZdS )PathZipTestsc                 C   sF   t | jd }t |}|  W d   n1 s80    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   r.   r   r   r   r   r,   3   s   r,   __main__)r$   r   ZunittestZimportlib_resourcesr    r   r   ZTestCaser   Z	DiskSetupr   r"   ZZipSetupr,   r   mainr   r   r   r   <module>   s   