
    @g                     b   d dl Z d dlZd dlZd dlZddlmZ  G d dej                  ej                        Z G d d      Z	 G d d	e	ej                  ej                        Z G d
 de	ej                        Z G d de	ej                  ej                        Zedk(  r ej                           yy)    N   )utilc                       e Zd Zd Zy)CommonTestsc                     t        j                  t        j                  |      j                  |            5  	 d d d        y # 1 sw Y   y xY w)N)	resourcesas_filefilesjoinpath)selfpackagepaths      X/var/www/openai/venv/lib/python3.12/site-packages/importlib_resources/tests/test_path.pyexecutezCommonTests.execute   s4    yw7@@FG HGGs   AAN)__name__
__module____qualname__r        r   r   r   
   s    r   r   c                       e Zd Zd Zy)	PathTestsc                    t        j                  | j                        dz  }t        j                  |      5 }| j	                  |t
        j                         | j                  |j                  j                  d      t        |             | j                  d|j                  d             ddd       y# 1 sw Y   yxY w)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   s      r   test_readingzPathTests.test_reading   s     +l:v&$!!$5OODII..|<d4jI4dnngn6VW '&&s   A7B88CN)r   r   r   r'   r   r   r   r   r      s    Xr   r   c                       e Zd Zd Zy)PathDiskTestsc                     t        j                  | j                        dz  }t        j                  |      5 }dt	        |      v sJ 	 ddd       y# 1 sw Y   yxY w)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%   s      r   test_natural_pathzPathDiskTests.test_natural_path   sI     +l:v&$SY&&& '&&s   AAN)r   r   r   r,   r   r   r   r)   r)      s    'r   r)   c                       e Zd Zd Zy)PathMemoryTestsc                    t        j                  d      }| j                  |j                         t	        j
                  |t        d            | _        d | j                  j                  _	        d| j                  j                  _
        y )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   r0   s     r   setUpzPathMemoryTests.setUp)   se    zz23

#''-.MN
	 %)		!*/		'r   N)r   r   r   r:   r   r   r   r.   r.   (   s    0r   r.   c                       e Zd Zd Zy)PathZipTestsc                     t        j                  | j                        dz  }t        j                  |      5 }|j	                          ddd       y# 1 sw Y   yxY w)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%   s      r   test_remove_in_context_managerz+PathZipTests.test_remove_in_context_manager4   s@    
 +l:v&$KKM '&&s   AAN)r   r   r   r?   r   r   r   r<   r<   3   s    r   r<   __main__)r1   r   unittestimportlib_resourcesr    r   r   TestCaser   	DiskSetupr)   r.   ZipSetupr<   r   mainr   r   r   <module>rH      s    	   ' $""H$5$5 	X 	X	'It~~x/@/@ 	'0i!2!2 09dmmX->->  zHMMO r   