
    dafD                     T   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ej                  ej                        Z G d d	      Z	 G d
 de	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)	resources   )data01)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)r   as_filefilesjoinpath)selfpackagepaths      B/root/Python-3.12.4/Lib/test/test_importlib/resources/test_path.pyexecutezCommonTests.execute
   s<    yw7@@FG 		 	 	s   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	                  |j
                  j                  d      t        |             |j                  dd      5 }|j                         }ddd       | j                  d       ddd       y# 1 sw Y   $xY w# 1 sw Y   yxY w)z
        Path should be readable.

        Test also implicitly verifies the returned object is a pathlib.Path
        instance.
        
utf-8.filerzutf-8)encodingNzHello, UTF-8 world!
)r   r   datar
   
assertTruenameendswithrepropenreadassertEqual)r   targetr   filetexts        r   test_readingzPathTests.test_reading   s     +l:v& 	<$OODII..|<d4jI31 #Tyy{#4d;	< 	<# #	< 	<s$   AC  B4C 4B=	9C  C	N)r   r   r   r(   r   r   r   r   r      s    <r   r   c                       e Zd Ze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)Nr   r   )r   r   r   r
   strr   r%   r   s      r   test_natural_pathzPathDiskTests.test_natural_path#   sR     +l:v& 	'$SY&&&	' 	' 	's   AAN)r   r   r   r   r   r.   r   r   r   r*   r*       s    D'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)r&   r   F)ioBytesIO
addCleanupcloser   create_packageFileNotFoundErrorr   __spec__originhas_location)r   r&   s     r   setUpzPathMemoryTests.setUp-   se    zz23

#''-.MN
	 %)		!*/		'r   N)r   r   r   r;   r   r   r   r0   r0   ,   s    0r   r0   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_manager8   sI    
 +l:v& 	$KKM	 	 	s   AAN)r   r   r   r@   r   r   r   r=   r=   7   s    r   r=   __main__)r2   unittest	importlibr    r   r   r   TestCaser   r*   r0   ZipSetupr=   r   mainr   r   r   <module>rH      s    	    $""H$5$5 < <"	'Ix00 	'0i!2!2 09dmmX->->  zHMMO r   