HEX
Server: LiteSpeed
System: Linux server.nevid-deploma.com 4.18.0-553.111.1.lve.el8.x86_64 #1 SMP Fri Mar 13 13:42:17 UTC 2026 x86_64
User: smilepac (1037)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //opt/cppython/lib/python3.8/test/test_importlib/__pycache__/test_metadata_api.cpython-38.pyc
U

/D�g	�@s�ddlZddlZddlZddlmZddlmZddlmZm	Z	m
Z
mZmZm
Z
mZmZGdd�dejejejej�ZGdd	�d	ejej�ZdS)
�N)�Iterator�)�fixtures)�Distribution�PackageNotFoundError�distribution�entry_points�files�metadata�requires�versionc@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
edd��Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"S)#�APITestsz\d+\.\d+(\.\d)?cCs,td�}t|t�st�t�|j|�s(t�dS�N�egginfo-pkg�r�
isinstance�str�AssertionError�re�match�version_pattern��selfZpkg_version�r�D/opt/cppython/lib/python3.8/test/test_importlib/test_metadata_api.py�test_retrieves_version_of_selfsz'APITests.test_retrieves_version_of_selfcCs,td�}t|t�st�t�|j|�s(t�dS�N�distinfo-pkgrrrrr�&test_retrieves_version_of_distinfo_pkgsz/APITests.test_retrieves_version_of_distinfo_pkgc	Cs"|�t��td�W5QRXdS)Nzdoes-not-exist)ZassertRaisesrr�rrrr�test_for_name_does_not_exist sz%APITests.test_for_name_does_not_existcCs|�td��d���d�dS)Nr�
top_level.txt�mod)�assertEqualr�	read_text�striprrrr�test_for_top_level$s�zAPITests.test_for_top_levelcCs*dd�td�D�d}|�|��d�dS)NcSsg|]}|jdkr|�qS)r!��name)�.0�pathrrr�
<listcomp>*s
�z+APITests.test_read_text.<locals>.<listcomp>rrzmod
)r	r#r$)rZ	top_levelrrr�test_read_text)s��zAPITests.test_read_textcCs6tt�d�}|d}|�|jd�|�|jg�dS)N�entries�mainzmod:main)�dictrr#�value�extras)rr-Zeprrr�test_entry_points0szAPITests.test_entry_pointscCsRtd�}|ddkst�|ddks(t�|ddks8t�|�d�}d|ksNt�dS)	NrZauthorz	Steven Ma�LICENSEZUnknown�NameZ
Classifierz*Topic :: Software Development :: Libraries)r
rZget_all)rZmdZclassifiersrrr�test_metadata_for_this_package6s
z'APITests.test_metadata_for_this_packagecCs�|dj}|D]�}|j|ks t�|jr2|jjs2t�|jrH|jjdksHt�|jr\|jdks\t�|����slt�t|�	�t
�s~t�|j�d�r|�
�qdS)NrZsha256z.py)�rootr�hashr0�mode�sizeZlocate�existsrZread_binary�bytesr(�endswithr$)r	r6�filerrr�_test_files>s
zAPITests._test_filescCs0|j}dd�td�D�d}|t|j�d�dS)NcSsg|]}|jdkr|�qS)zmod.pyr')r)�prrrr+Ns
�z0APITests.test_file_hash_repr.<locals>.<listcomp>rrz!<FileHash mode: sha256 value: .*>)�assertRegexr	�reprr7)rr@�utilrrr�test_file_hash_reprKs���zAPITests.test_file_hash_reprcCs|�td��dSr�r>r	rrrr�test_files_dist_infoVszAPITests.test_files_dist_infocCs|�td��dSrrDrrrr�test_files_egg_infoYszAPITests.test_files_egg_infocCs|�td�d�dS)N�egginfo-filez0.1)r#rrrrr�test_version_egg_info_file\sz#APITests.test_version_egg_info_filecCstd�}|�|�dS)NrG)rZassertIsNone)rZrequirementsrrr�test_requires_egg_info_file_sz$APITests.test_requires_egg_info_filecCs2td�}t|�dkst�tdd�|D��s.t�dS)Nr�css|]}|dkVqdS)z%wheel >= 1.0; python_version >= "2.7"Nr)r)Zdeprrr�	<genexpr>fs�z2APITests.test_requires_egg_info.<locals>.<genexpr>)r�lenr�any�r�depsrrr�test_requires_egg_infocs
�zAPITests.test_requires_egg_infocCs@td�}t|�dkst�t|�s$t�d|ks0t�d|ks<t�dS)NrrJzwheel >= 1.0zpytest; extra == 'test')rrLr�allrNrrr�test_requires_dist_infoks
z APITests.test_requires_dist_infocCs6t�d�}tt�|��}dddddg}||ks2t�dS)Nz�
            dep1
            dep2

            [:python_version < "3"]
            dep3

            [extra1]
            dep4

            [extra2:python_version < "3"]
            dep5
            Zdep1Zdep2zdep3; python_version < "3"zdep4; extra == "extra1"z2dep5; (python_version < "3") and extra == "extra2")�textwrap�dedent�sortedrZ_deps_from_requires_textr)rrrOZexpectedrrr�$test_more_complex_deps_requires_textrs

�z-APITests.test_more_complex_deps_requires_textN)�__name__�
__module__�__qualname__rrrr r&r,r2r5�staticmethodr>rCrErFrHrIrPrRrVrrrrr
s$
r
c@s$eZdZdd�Zdd�Zdd�ZdS)�OffSysPathTestscCs.tjt|j�gd�}tdd�|D��s*t�dS)N)r*css|]}|jddkVqdS)r4rN)r
)r)�distrrrrK�s�zIOffSysPathTests.test_find_distributions_specified_path.<locals>.<genexpr>)rZdiscoverr�site_dirrMr)rZdistsrrr�&test_find_distributions_specified_path�s�z6OffSysPathTests.test_find_distributions_specified_pathcCs&|jd}t�|�}|jdks"t�dS)zBDemonstrate how to load metadata direct from a directory.
        �distinfo_pkg-1.0.0.dist-info�1.0.0N)r]r�atrr�rZdist_info_pathr\rrr�test_distribution_at_pathlib�s

z,OffSysPathTests.test_distribution_at_pathlibcCs*|jd}t�t|��}|jdks&t�dS)Nr_r`)r]rrarrrrbrrr�test_distribution_at_str�s
z(OffSysPathTests.test_distribution_at_strN)rWrXrYr^rcrdrrrrr[�sr[)rrSZunittest�collections.abcr�r�importlib.metadatarrrrr	r
rrZ
EggInfoPkgZDistInfoPkgZEggInfoFileZTestCaser
ZDistInfoPkgOffPathr[rrrr�<module>s(
�