HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.70.1.lve.el8.x86_64 #1 SMP Wed Aug 20 14:42:18 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.28
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.10/test/test_importlib/__pycache__/test_metadata_api.cpython-310.pyc
o

�i�-�@s�ddlZddlZddlZddlZddlZddlZddlmZddlm	Z	m
Z
mZmZm
Z
mZmZmZejdd��ZGdd�dejejejejej�ZGd	d
�d
ejej�ZGdd�dejej�ZGd
d�dej�ZdS)�N�)�fixtures)�Distribution�PackageNotFoundError�distribution�entry_points�files�metadata�requires�versionccsD�tjdd��}t�d�|VWd�dS1swYdS)NT)�record�default)�warnings�catch_warnings�simplefilter)�ctx�r�B/usr/local/lib/python3.10/test/test_importlib/test_metadata_api.py�suppress_known_deprecations
�
"�rc@seZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zed&d'��Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Z d:d;�Z!d<d=�Z"d>d?�Z#d@S)A�APITestsz\d+\.\d+(\.\d)?cC�,td�}t|t�sJ�t�|j|�sJ�dS�N�egginfo-pkg�r�
isinstance�str�re�match�version_pattern��selfZpkg_versionrrr�test_retrieves_version_of_self&�z'APITests.test_retrieves_version_of_selfcCr�N�distinfo-pkgrrrrr�&test_retrieves_version_of_distinfo_pkg+r"z/APITests.test_retrieves_version_of_distinfo_pkgcCs8|�t��
td�Wd�dS1swYdS)Nzdoes-not-exist)�assertRaisesrr�r rrr�test_for_name_does_not_exist0s
"�z%APITests.test_for_name_does_not_existc	C�Rd}|D]"}|�|��t|�jddksJ�Wd�n1s!wYqdS�N)�pkg.dotZpkg_dotzpkg-dotzpkg..dotzPkg.Dot�Namer+��subTestrr	�r �names�namerrr�test_name_normalization4����z APITests.test_name_normalizationc
Csnd}|D]0}|�|��!|�t��t|�Wd�n1s wYWd�n1s/wYqdS)N)�pZpkgzpkg.)r.r&rr)r �prefixes�prefixrrr�test_prefix_not_matched:s
�����z APITests.test_prefix_not_matchedcCs|�td��d���d�dS)Nr�
top_level.txt�mod)�assertEqualr�	read_text�stripr'rrr�test_for_top_levelAs�zAPITests.test_for_top_levelcCs*dd�td�D�d}|�|��d�dS)NcS�g|]	}|jdkr|�qS)r8�r1)�.0�pathrrr�
<listcomp>Gsz+APITests.test_read_text.<locals>.<listcomp>rrzmod
)rr:r;)r Z	top_levelrrr�test_read_textFs��zAPITests.test_read_textcCsVt�}d|jvs
J�|jdd�}d|jvsJ�|d}|�|jd�|�|jg�dS)N�entries��group�mainzmod:main)r�groups�selectr0r:�value�extras)r �epsrD�eprrr�test_entry_pointsLszAPITests.test_entry_pointscCs@tdd�}dD]}||}|�|jjd�|�|jjd�qdS)NrDrE)rG�ns:sub)r$r�1.0.0)rZassertIn�distr1r:r)r rD�entryrMrrr�test_entry_points_distributionUs
�z'APITests.test_entry_points_distributioncCsl|j�t���}|j�|�|��dddd�i}t�||�tdd�}tdd�|D��r.J�d	|vs4J�d
S)z�
        Entry points should only be exposed for the first package
        on sys.path with a given name (even when normalized).
        zDistInfo_pkg-1.1.0.dist-infozS
                Name: distinfo-pkg
                Version: 1.1.0
                zJ
                [entries]
                main = mod:altmain
            )ZMETADATAzentry_points.txtrDrEcss(�|]}|jjdko|jjdkVqdS)r$rPN)rQr1r)r@rMrrr�	<genexpr>qs
��
�zHAPITests.test_entry_points_unique_packages_normalized.<locals>.<genexpr>rON)r�
enter_context�tempdirZadd_sys_path�build_filesr�any)r Zalt_site_dirZalt_pkgrDrrr�,test_entry_points_unique_packages_normalized\s��
�z5APITests.test_entry_points_unique_packages_normalizedcCs>|�t��tdd�dWd�dS1swYdS�NrDrE�missing)r&�KeyErrorrr'rrr�test_entry_points_missing_namexs"�z'APITests.test_entry_points_missing_namecCstdd�dks	J�dS)Nr[rEr)rr'rrr�test_entry_points_missing_group|sz(APITests.test_entry_points_missing_groupcCs�t��}ttdd��}Wd�n1swYd|vs J�|dtdd�dks-J�tt|��}|jtus:J�dt|�vsBJ�dS)NrDrErGz1Construction of dict of EntryPoints is deprecated)r�dictr�next�iter�category�DeprecationWarningr)r �caughtrL�expectedrrr�#test_entry_points_dict_constructions�z,APITests.test_entry_points_dict_constructioncCsftd�j}t��}|dWd�n1swYtt|��}|jtus)J�dt|�vs1J�dS)z�
        Prior versions of Distribution.entry_points would return a
        tuple that allowed access by index.
        Capture this now deprecated use-case
        See python/importlib_metadata#300 and bpo-44246.
        r$rNz-Accessing entry points by index is deprecated)rrrr`rarbrcr)r rLrdrerrr�test_entry_points_by_index�s

�z#APITests.test_entry_points_by_indexc	Cs�t��5t�dtdd�k|�t��
t�dWd�n1s#wYWd�dSWd�dS1s;wYdSrZ)rrr&r\r'rrr� test_entry_points_groups_getitem�s��"�z)APITests.test_entry_points_groups_getitemcCsht��'t��dd�dkt��dd�t�dkt��dd�dkWd�dS1s-wYdS)Nr[r
rDr)rr�getr'rrr�test_entry_points_groups_get�s
"�z%APITests.test_entry_points_groups_getcCsFt�jddd�}|�t��d|_Wd�dS1swYdS)NrDrG)rFr1�)rrIr&�AttributeErrorZfoo)r rMrrr�&test_entry_points_allows_no_attributes�s"�z/APITests.test_entry_points_allows_no_attributescCsRtd�}|ddksJ�|ddksJ�|ddksJ�|�d�}d|vs'J�dS)	NrZauthorz	Steven Ma�LICENSEZUnknownr,Z
Classifierz*Topic :: Software Development :: Libraries)r	Zget_all)r �mdZclassifiersrrr�test_metadata_for_this_package�s
z'APITests.test_metadata_for_this_packagecCs�|dj}|D]B}|j|ksJ�|jr|jjsJ�|jr$|jjdks$J�|jr.|jdks.J�|����s6J�t|��t	�s?J�|j
�d�rI|��qdS)NrZsha256z.py)
�root�hashrJ�mode�sizeZlocate�existsrZread_binary�bytesr1�endswithr;)rrq�filerrr�_test_files�s
��zAPITests._test_filescCs0|j}dd�td�D�d}|t|j�d�dS)NcSr>)zmod.pyr?)r@r4rrrrB�sz0APITests.test_file_hash_repr.<locals>.<listcomp>r$rz!<FileHash mode: sha256 value: .*>)�assertRegexr�reprrr)r rz�utilrrr�test_file_hash_repr�szAPITests.test_file_hash_reprcC�|�td��dSr#�ryrr'rrr�test_files_dist_info��zAPITests.test_files_dist_infocCr~rrr'rrr�test_files_egg_info�r�zAPITests.test_files_egg_infocCs|�td�d�dS)N�egginfo-filez0.1)r:rr'rrr�test_version_egg_info_file�sz#APITests.test_version_egg_info_filecCstd�}|�|�dS)Nr�)r
ZassertIsNone)r Zrequirementsrrr�test_requires_egg_info_file�sz$APITests.test_requires_egg_info_filecCs2td�}t|�dksJ�tdd�|D��sJ�dS)Nr�css�|]}|dkVqdS)z%wheel >= 1.0; python_version >= "2.7"Nr)r@ZdeprrrrT�s�z2APITests.test_requires_egg_info.<locals>.<genexpr>)r
�lenrX�r �depsrrr�test_requires_egg_info�szAPITests.test_requires_egg_infocCs0t�ddi|j�d��td�}|gksJ�dS)Nzrequires.txt�zegginfo_pkg.egg-infor)rrW�site_dir�joinpathr
r�rrr�test_requires_egg_info_empty�s�
�z%APITests.test_requires_egg_info_emptycCs@td�}t|�dksJ�t|�sJ�d|vsJ�d|vsJ�dS)Nr$r�zwheel >= 1.0zpytest; extra == 'test')r
r��allr�rrr�test_requires_dist_info�s
z APITests.test_requires_dist_infocCs0t�d�}tt�|��}gd�}||ksJ�dS)Na
            dep1
            dep2

            [:python_version < "3"]
            dep3

            [extra1]
            dep4
            dep6@ git+https://example.com/python/dep.git@v1.0.0

            [extra2:python_version < "3"]
            dep5
            )Zdep1Zdep2zdep3; python_version < "3"zdep4; extra == "extra1"z2dep5; (python_version < "3") and extra == "extra2"zGdep6@ git+https://example.com/python/dep.git@v1.0.0 ; extra == "extra1")�textwrap�dedent�sortedrZ_deps_from_requires_text)r r
r�rerrr�$test_more_complex_deps_requires_text�s�z-APITests.test_more_complex_deps_requires_textcC�Xtd�j}d|vsJ�|dddgksJ�|d}|�d�s J�t|d�d	ks*J�dS)
Nr$r1�keywords�sample�package�description�Once upon a time
There was�
requires_distr��r	�json�
startswithr��r roZdescrrr�test_as_json�
zAPITests.test_as_jsoncCr�)
Nrr1r�r�r�r�r�Z
classifierr�r�r�rrr�test_as_json_egg_infor�zAPITests.test_as_json_egg_infocCsJ|��td�j}d|vsJ�t|d�dksJ�|dddgks#J�dS)Nr$r1r�r�r�ZSAMPLEZPACKAGE)Zmake_uppercaser	r�r�)r rorrr�test_as_json_odd_case$s

zAPITests.test_as_json_odd_caseN)$�__name__�
__module__�__qualname__rr!r%r(r2r7r=rCrNrSrYr]r^rfrgrhrjrmrp�staticmethodryr}r�r�r�r�r�r�r�r�r�r�r�rrrrrsD	
	

 rc@seZdZdd�Zdd�ZdS)�
LegacyDotsc	Cr)r*r-r/rrrr2-r3z"LegacyDots.test_name_normalizationc	Cr))N)�pkg.lotZpkg_lotzpkg-lotzpkg..lotzPkg.Lotr,r�r-r/rrr�,test_name_normalization_versionless_egg_info3r3z7LegacyDots.test_name_normalization_versionless_egg_infoN)r�r�r�r2r�rrrrr�,sr�c@s$eZdZdd�Zdd�Zdd�ZdS)�OffSysPathTestscCs.tjt|j�gd�}tdd�|D��sJ�dS)N)rAcss�|]
}|jddkVqdS)r,r$N)r	)r@rQrrrrT=s�zIOffSysPathTests.test_find_distributions_specified_path.<locals>.<genexpr>)rZdiscoverrr�rX)r Zdistsrrr�&test_find_distributions_specified_path;sz6OffSysPathTests.test_find_distributions_specified_pathcCs&|jd}t�|�}|jdksJ�dS�Nzdistinfo_pkg-1.0.0.dist-inforP)r�r�atr�r Zdist_info_pathrQrrr�test_distribution_at_pathlib?s

z,OffSysPathTests.test_distribution_at_pathlibcCs*|jd}t�t|��}|jdksJ�dSr�)r�rr�rrr�rrr�test_distribution_at_strEs
z(OffSysPathTests.test_distribution_at_strN)r�r�r�r�r�r�rrrrr�:sr�c@seZdZdd�ZdS)�InvalidateCachecCst��dS)N)�	importlib�invalidate_cachesr'rrr�test_invalidate_cacheLsz%InvalidateCache.test_invalidate_cacheN)r�r�r�r�rrrrr�Ksr�)rr�Zunittestrr��
contextlibr�r�importlib.metadatarrrrrr	r
r�contextmanagerrZ
EggInfoPkgZDistInfoPkgZDistInfoPkgWithDotZEggInfoFileZTestCaserZDistInfoPkgWithDotLegacyr�ZDistInfoPkgOffPathr�r�rrrr�<module>s,(

�