HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
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_main.cpython-310.pyc
o

�i#�@s�ddlZddlZddlZddlZddlZddlZddlZzddlm	Z
Wney3ddlm	Z
Ynwddl
mZddlmZmZmZmZmZmZmZGdd�dejej�ZGdd	�d	ejej�ZGd
d�dejejej�ZGdd
�d
ejejej�ZGdd�dejejej�ZGdd�dejejej�Z Gdd�dejej�Z!Gdd�deje
j�Z"Gdd�dej�Z#Gdd�dejejej$ej�Z%dS)�N�)�fake_filesystem_unittest)�fixtures)�Distribution�
EntryPoint�PackageNotFoundError�
distributions�entry_points�metadata�versionc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�
BasicTestsz\d+\.\d+(\.\d)?cCs2t�d�}t|jt�s
J�t�|j|j�sJ�dS)N�distinfo-pkg)r�	from_name�
isinstancer�str�re�match�version_pattern)�self�dist�r�:/usr/local/lib/python3.10/test/test_importlib/test_main.py�test_retrieves_version_of_selfs
z)BasicTests.test_retrieves_version_of_selfcC�:|�t��t�d�Wd�dS1swYdS)N�does-not-exist)�assertRaisesrrr�rrrr�test_for_name_does_not_exist"s"�z'BasicTests.test_for_name_does_not_existcCsJ|�t��
}t�d�Wd�n1swYdt|j�vs#J�dS)Nrr
)rrrrr�	exception)r�ctxrrr�(test_package_not_found_mentions_metadata&s�z3BasicTests.test_package_not_found_mentions_metadatacCs|�tt�dS�N)ZassertIsInstancer�typerrrr�test_new_style_classes0sz!BasicTests.test_new_style_classesN)�__name__�
__module__�__qualname__rrrr r#rrrrrs
rc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�ImportTestscCr)NZdoes_not_exist)r�ImportError�	importlib�
import_modulerrrr�test_import_nonexistent_module5s"�z*ImportTests.test_import_nonexistent_modulecCs$tdd�d}|�|��jd�dS)N�entries��group�main)r	�assertEqual�loadr$�r�eprrr�test_resolve;szImportTests.test_resolvecCs tdd�d}|�|jd�dS)Nr,r-zns:subzmod:main)r	r0�valuer2rrr�"test_entrypoint_with_colon_in_name?sz.ImportTests.test_entrypoint_with_colon_in_namecCs$tdddd�}|��tjusJ�dS)Nr3zimportlib.metadata�grp)�namer5r.)rr1r)r
r2rrr�test_resolve_without_attrCs�z%ImportTests.test_resolve_without_attrN)r$r%r&r+r4r6r9rrrrr'4s
r'c@s4eZdZedd��Zdd�Zedd��Zdd�Zd	S)
�NameNormalizationTestscC�V|d}|��|d}|jddd��}|�d�Wd�dS1s$wYdS)	z
        Create minimal metadata for a package with dashes
        in the name (and thus underscores in the filename).
        zmy_pkg.dist-info�METADATA�w�utf-8��encoding�
Version: 1.0
Nzmy-pkg��mkdir�open�write��site_dir�metadata_dirr
Zstrmrrr�pkg_with_dashesM�
��z&NameNormalizationTests.pkg_with_dashescCs |�|j�}t|�dksJ�dS�Nz1.0)rIrGr�r�pkg_namerrr�-test_dashes_in_dist_name_found_as_underscoresZszDNameNormalizationTests.test_dashes_in_dist_name_found_as_underscorescCr;)	z\
        Create minimal metadata for a package with mixed case
        in the name.
        zCherryPy.dist-infor<r=r>r?rANZCherryPyrBrFrrr�pkg_with_mixed_case`rJz*NameNormalizationTests.pkg_with_mixed_casecCsH|�|j�}t|�dksJ�t|���dksJ�t|���dks"J�dSrK)rOrGr�lower�upperrLrrr� test_dist_name_found_as_any_casemsz7NameNormalizationTests.test_dist_name_found_as_any_caseN)r$r%r&�staticmethodrIrNrOrRrrrrr:Ls

r:c@s4eZdZedd��Zedd��Zdd�Zdd�Zd	S)
�
NonASCIITestscCr;)	zb
        Create minimal metadata for a package with non-ASCII in
        the description.
        �portend.dist-infor<r=r>r?uDescription: pôrˈtendN�portendrB�rGrHr
�fprrr�pkg_with_non_ascii_descriptionvrJz,NonASCIITests.pkg_with_non_ascii_descriptioncCs`|d}|��|d}|jddd��}|�t�d����Wd�dS1s)wYdS)	zl
        Create minimal metadata for an egg-info package with
        non-ASCII in the description.
        rUr<r=r>r?uK
                Name: portend

                pôrˈtend
                NrV)rCrDrE�textwrap�dedent�striprWrrr�'pkg_with_non_ascii_description_egg_info�s��
�
�
z5NonASCIITests.pkg_with_non_ascii_description_egg_infocC�(|�|j�}t|�}|ddksJ�dS�NZDescriptionu
pôrˈtend)rYrGr
�rrM�metarrr�test_metadata_loads��z!NonASCIITests.test_metadata_loadscCr^r_)r]rGr
r`rrr�test_metadata_loads_egg_info�rcz*NonASCIITests.test_metadata_loads_egg_infoN)r$r%r&rSrYr]rbrdrrrrrTus

rTc@�eZdZdd�Zdd�ZdS)�DiscoveryTestscCsPtt��}tdd�|D��sJ�tdd�|D��sJ�tdd�|D��s&J�dS)Ncss�|]}t|t�VqdSr!)rr��.0rrrr�	<genexpr>�s�z8DiscoveryTests.test_package_discovery.<locals>.<genexpr>cs��|]
}|jddkVqdS)�Namezegginfo-pkgN�r
rgrrrri���csrj)rkr
Nrlrgrrrri�rm)�listr�all�any)rZdistsrrr�test_package_discovery�s
z%DiscoveryTests.test_package_discoverycCs@|�t��ttddd��Wd�dS1swYdS)NZ	something�else)�contextr8)r�
ValueErrorrnrrrrr�test_invalid_usage�s"�z!DiscoveryTests.test_invalid_usageN)r$r%r&rqrurrrrrf�srfc@re)�
DirectoryTestcCsH|j�d���|�t��
td�Wd�dS1swYdS)NzEGG-INFOzunknown-package)rG�joinpathrCrrrrrrr�
test_egg_info�s
"�zDirectoryTest.test_egg_infoc	Cs�|j�d�}|��|�|��*|�t��td�Wd�n1s$wYWd�dSWd�dS1s<wYdS)Nzfoo-3.6.eggZfoo)rGrwrCZadd_sys_pathrrr)rZeggrrr�test_egg�s
��"�zDirectoryTest.test_eggN)r$r%r&rxryrrrrrv�srvc@seZdZdZdd�ZdS)�MissingSysPathz/does-not-existcCstj��dS�zp
        Discovering distributions should succeed even if
        there is an invalid path on sys.path.
        N)r)r
rrrrr�test_discovery�szMissingSysPath.test_discoveryN)r$r%r&rGr|rrrrrz�srzcs(eZdZdZ�fdd�Zdd�Z�ZS)�InaccessibleSysPathz/access-deniedcs,tt|���|��|jj|jdd�dS)Nr)Z	perm_bits)�superr}�setUpZ
setUpPyfakefs�fsZ
create_dirrGr��	__class__rrr�szInaccessibleSysPath.setUpcCsttj���dSr{)rnr)r
rrrrrr|�sz"InaccessibleSysPath.test_discovery)r$r%r&rGrr|�
__classcell__rrr�rr}�sr}cs\eZdZ�fdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Z�ZS)�TestEntryPointscs&tt|�j|�tj�ddd�|_dS)Nr8r5r.)r~r��__init__r)r
rr3)r�argsr�rrr��szTestEntryPoints.__init__cCs$t�t�|j��}||jksJ�dSr!)�pickle�loads�dumpsr3)rZrevivedrrr�test_entry_point_pickleable�sz+TestEntryPoints.test_entry_point_pickleablecCs8|�t��
d|j_Wd�dS1swYdS)zEntryPoints should be immutableZbadactorN)r�AttributeErrorr3r8rrrr�test_immutable�s
"�zTestEntryPoints.test_immutablecCs:dt|j�vs	J�dt|j�vsJ�dt|j�vsJ�dS)Nrzname=z'name')�reprr3rrrr�	test_repr�szTestEntryPoints.test_reprcCst|j�dSr!)�hashr3rrrr�
test_hashable�szTestEntryPoints.test_hashablec	Csx|�t��-tjdd��t�|j�Wd�n1swYWd�dSWd�dS1s5wYdS)NT)�record)r�	Exception�warnings�catch_warnings�jsonr�r3rrrr�test_json_dump�s��"�zTestEntryPoints.test_json_dumpcCs|jjdksJ�dS)Nr5)r3�modulerrrr�test_module��zTestEntryPoints.test_modulecCs|jjdusJ�dSr!)r3�attrrrrr�	test_attr�r�zTestEntryPoints.test_attrcCs ttddd�tddd�g�dS)N�b�valr.�a)�sortedrrrrr�
test_sortable�s


��zTestEntryPoints.test_sortable)
r$r%r&r�r�r�r�r�r�r�r�r�r�rrr�rr��sr�c@seZdZdd�ZdS)�
FileSystemcCs&tj|��ii|jd�tt��dS)N)�prefix)rZbuild_filesZunicode_filenamerGrnrrrrr�test_unicode_dir_on_sys_path
s

�z'FileSystem.test_unicode_dir_on_sys_pathN)r$r%r&r�rrrrr�sr�)&rr�r�rZZunittestr��importlib.metadatar)Z!pyfakefs.fake_filesystem_unittestrZffsr(Zstubs�rrrrrr	r
rZDistInfoPkgZTestCaserr'Z	OnSysPathZSiteDirr:rTZ
EggInfoPkgrfrvrzr}r�ZFileBuilderr�rrrr�<module>s4�$).
-�