o
    gn
                     @   s   d dl Z d dlZd dlmZ d dlmZmZmZmZm	Z	m
Z
 d dlmZ d dlmZ e G dd dejZe G dd	 d	eZdS )
    N)	ExitStack)PackageNotFoundErrordistributiondistributionsentry_pointsfilesversion)	resources)requires_zlibc                   @   sX   e Zd ZdZdd Zdd Zdd Zdd	 Zd
d Zdd Z	dd Z
dd Zdd ZdS )TestZipztest.test_importlib.datac                 C   sL   t | j|}| j t |}tjdt	| | j 
tjjd d S )Nr   )r	   r   rootjoinpathenter_contextZas_filesyspathinsertstrcallbackpop)selffilenameZpkg_filefile r   R/Users/admin/.pyenv/versions/3.10.0/lib/python3.10/test/test_importlib/test_zip.py_fixture_on_path   s   zTestZip._fixture_on_pathc                 C   $   t  | _| | jj | d d S )Nzexample-21.12-py3-none-any.whlr   r	   Z
addCleanupcloser   r   r   r   r   setUp      zTestZip.setUpc                 C      |  tdd d S )Nexample21.12assertEqualr   r   r   r   r   test_zip_version$      zTestZip.test_zip_versionc                 C   s8   |  t td W d    d S 1 sw   Y  d S )Nzdefinitely-not-installed)ZassertRaisesr   r   r   r   r   r   test_zip_version_does_not_match'   s   
"z'TestZip.test_zip_version_does_not_matchc                 C   s:   t dd}|d }| |jd |d }| |jd d S )NZconsole_scripts)groupr"   zexample:mainExample)r   r%   value)r   ZscriptsZentry_pointr   r   r   test_zip_entry_points+   s
   
zTestZip.test_zip_entry_pointsc                 C   s   |  tdd d S )Nr"   zdoes not exist)ZassertIsNoner   	read_textr   r   r   r   test_missing_metadata2   s   zTestZip.test_missing_metadatac                 C   r!   )Nr*   r#   r$   r   r   r   r   test_case_insensitive5   r'   zTestZip.test_case_insensitivec                 C   "   t dD ]
}t|j|}qd S Nr"   r   r   distZlocate_filer   r   r   r   r   r   
test_files8      zTestZip.test_filesc                 C   s   t ttjd d d}d S )N   )r   )listr   r   r   )r   Zdistsr   r   r   test_one_distribution=   s   zTestZip.test_one_distributionN)__name__
__module____qualname__r   r   r   r&   r(   r,   r.   r/   r5   r9   r   r   r   r   r      s    r   c                   @   s$   e Zd Zdd Zdd Zdd ZdS )TestEggc                 C   r   )Nzexample-21.12-py3.6.eggr   r   r   r   r   r   D   r    zTestEgg.setUpc                 C   r0   r1   r2   r4   r   r   r   r5   K   r6   zTestEgg.test_filesc                 C   s   t d}d S r1   )r   )r   r3   r   r   r   test_normalized_nameP   s   zTestEgg.test_normalized_nameN)r:   r;   r<   r   r5   r>   r   r   r   r   r=   B   s    r=   )r   Zunittest
contextlibr   importlib.metadatar   r   r   r   r   r   	importlibr	   Ztest.supportr
   ZTestCaser   r=   r   r   r   r   <module>   s     /