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_util.cpython-310.opt-2.pyc
o

�i���@s�ddlmZe�d�Ze�d�Ze�d�Ze�d�ZddlZddl	Z	ddl
Z
ddlZddlZddl
mZddlZddlZddlZddlZGd	d
�d
�Zejeed�\ZZGdd�d�Zejeeeed
�\ZZGdd�d�Zejeed�\ZZGdd�d�Zejeed�\ZZGdd�d�Z eje ed�\Z!Z"Gdd�d�Z#eje#ed�\Z$Z%Gdd�d�Z&eje&eeed�\Z'Z(Gdd�d�Z)eje)ed�\Z*Z+Gdd�d�Z,eje,ed�\Z-Z.Gdd�dej/�Z)e0dkr�e�1�dSdS)�)�utilz
importlib.abc�	importlibzimportlib.machineryzimportlib.util�N)�supportc@s(eZdZdZdd�Zdd�Zdd�ZdS)	�DecodeSourceBytesTestsustring ='ü'cCs&|j�d�}|�|j�|�|j�dS)N�utf-8��source�encode�assertEqualr�
decode_source)�self�source_bytes�r�:/usr/local/lib/python3.10/test/test_importlib/test_util.py�test_ut8_defaultsz'DecodeSourceBytesTests.test_ut8_defaultcCs,d|j}|�d�}|�|j�|�|�dS)Nz# coding=latin-1
zlatin-1r�r
r	rrrr�test_specified_encodings

z.DecodeSourceBytesTests.test_specified_encodingcCsBd�|j|jg�}|�d�}|�|j�|�d�|j|jg��dS)Nz
r�
)�joinr	r
rrrrrrr�test_universal_newlines!s

�z.DecodeSourceBytesTests.test_universal_newlinesN)�__name__�
__module__�__qualname__r	rrrrrrrrs
rc@s\eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�ZdS)�ModuleFromSpecTestscCsZGdd�d�}|j�d|��}|�t��|j�|�}Wd�dS1s&wYdS)Nc@�eZdZdd�ZdS)z9ModuleFromSpecTests.test_no_create_module.<locals>.LoadercS�dS�Nr�r
�modulerrr�exec_module1�zEModuleFromSpecTests.test_no_create_module.<locals>.Loader.exec_moduleN)rrrr rrrr�Loader0�r"�test)�	machinery�
ModuleSpec�assertRaises�ImportErrorr�module_from_spec�r
r"�specrrrr�test_no_create_module/s
"�z)ModuleFromSpecTests.test_no_create_modulecCsRGdd�d|jj�}|j�d|��}|j�|�}|�|tj�|�	|j
|j�dS)Nc@r)zCModuleFromSpecTests.test_create_module_returns_None.<locals>.LoadercSrrr)r
r+rrr�
create_module9r!zQModuleFromSpecTests.test_create_module_returns_None.<locals>.Loader.create_moduleN�rrrr-rrrrr"8r#r"r$)�abcr"r%r&rr)�assertIsInstance�types�
ModuleTyperr�namer*rrr�test_create_module_returns_None7s
z3ModuleFromSpecTests.test_create_module_returns_Nonecsjd�Gdd�dtj��G��fdd�d|jj�}|j�d|��}|j�|�}|�|��|�	|j
��dS)Nzalready setc@seZdZdS)z<ModuleFromSpecTests.test_create_module.<locals>.CustomModuleN)rrrrrrr�CustomModuleBsr5cseZdZ��fdd�ZdS)z6ModuleFromSpecTests.test_create_module.<locals>.Loadercs�|j�}�|_|Sr)r3r�r
r+r�r5r3rrr-Es
zDModuleFromSpecTests.test_create_module.<locals>.Loader.create_moduleNr.rr7rrr"Dsr"r$)r1r2r/r"r%r&rr)r0rrr*rr7r�test_create_module@sz&ModuleFromSpecTests.test_create_modulecC�0|j�dt��}|j�|�}|�|j|j�dS�Nr$)r%r&�objectrr)rrr3r6rrr�
test___name__N�z!ModuleFromSpecTests.test___name__cCs.|j�dt��}|j�|�}|�|j|�dSr:)r%r&r;rr)r�__spec__r6rrr�
test___spec__Ssz!ModuleFromSpecTests.test___spec__cCs2t�}|j�d|�}|j�|�}|�|j|�dSr:)r;r%r&rr)�assertIs�
__loader__)r
�loaderr+rrrr�test___loader__Xsz#ModuleFromSpecTests.test___loader__cCr9)Nztest.pkg)r%r&r;rr)r�__package__�parentr6rrr�test___package__^r=z$ModuleFromSpecTests.test___package__cCs4|jjdt�dd�}|j�|�}|�|j|j�dS)Nr$T)�
is_package)r%r&r;rr)r�__path__�submodule_search_locationsr6rrr�
test___path__csz!ModuleFromSpecTests.test___path__cCs:|jjdt�dd�}d|_|j�|�}|�|j|j�dS)Nr$�	some/path)�originT)	r%r&r;�has_locationrr)r�__file__rLr6rrr�
test___file__hsz!ModuleFromSpecTests.test___file__cCs<|j�dt��}d|_d|_|j�|�}|�|j|j�dS)Nr$rKT)	r%r&r;�cachedrMrr)r�
__cached__r6rrr�test___cached__ns
z#ModuleFromSpecTests.test___cached__N)
rrrr,r4r8r<r?rCrFrJrOrRrrrrr-s	r)r/r%rc@sjeZdZ	edd��Zdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dd�ZdS)�ModuleForLoaderTestscCsDt���t�dt�|j�|�Wd�S1swYdS)N�ignore)�warnings�catch_warnings�simplefilter�DeprecationWarningr�module_for_loader)�cls�funcrrrrYs

$�z&ModuleForLoaderTests.module_for_loaderc	Cs�t���4t�dt�|�t��|j�dd��}Wd�n1s#wYWd�dSWd�dS1s;wYdS)N�errorcSs|Srr)�xrrr�<lambda>��z3ModuleForLoaderTests.test_warning.<locals>.<lambda>)rUrVrWrXr'rrY)r
r[rrr�test_warning�s
��"�z!ModuleForLoaderTests.test_warningcCs|�dd��}|||�S)NcS�|Srrrrrrr^�r_z4ModuleForLoaderTests.return_module.<locals>.<lambda>)rY)r
r3�fxnrrr�
return_module�s
z"ModuleForLoaderTests.return_modulecCs8dd�}|�|�}z|||�WdStyYdSw)NcS�t�r)r(rrrr�to_wrap�r!z5ModuleForLoaderTests.raise_exception.<locals>.to_wrap)rYr()r
r3rerbrrr�raise_exception�s
�z$ModuleForLoaderTests.raise_exceptioncCsfd}t�|��|�|�}|�|tj�Wd�n1swY|�|tj�|�	|j
|�dS�N�a.b.c)r�uncacherc�assertIn�sys�modulesr0r1r2rr)r
�module_namerrrr�test_new_module�s
�z$ModuleForLoaderTests.test_new_modulecs�G�fdd�d�}d}t�d�}d|_d|_t�|��-|tj|<|�}|�|�}��	|tj|���
|j|���
|j|�Wd�dS1sKwYdS)Ncs"eZdZdd�Z�jdd��ZdS)z4ModuleForLoaderTests.test_reload.<locals>.FakeLoadercS�dS)NTr�r
r3rrrrG�r!z?ModuleForLoaderTests.test_reload.<locals>.FakeLoader.is_packagecSrarrrrrr�load_module��z@ModuleForLoaderTests.test_reload.<locals>.FakeLoader.load_moduleN)rrrrGrYrqr�r
rr�
FakeLoader�srtrh�*)r1r2rArDrrirkrlrqr@r)r
rtr3rrBZreturned_modulerrsr�test_reload�s


"�z ModuleForLoaderTests.test_reloadcCsLd}t�|��|�|�|�|tj�Wd�dS1swYdSrg)rrirf�assertNotInrkrlrprrr�test_new_module_failure�s

"�z,ModuleForLoaderTests.test_new_module_failurecCsdd}t�|�}t�|��|tj|<|�|�|�|tj|�Wd�dS1s+wYdSrg)r1r2rrirkrlrfr@�r
r3rrrr�test_reload_failure�s


"�z(ModuleForLoaderTests.test_reload_failurecCs6dd�}|�|�}|�|j|j�|�|j|j�dS)NcSrrrrrrrrb�r_z6ModuleForLoaderTests.test_decorator_attrs.<locals>.fxn)rYrrr�r
rb�wrappedrrr�test_decorator_attrs�s
z)ModuleForLoaderTests.test_decorator_attrscCsxGdd�dtj�}d}||�}t�|��|�|�|tj|<|�|�}|�||�Wd�dS1s5wYdS)Nc@r)z;ModuleForLoaderTests.test_false_module.<locals>.FalseModulecSro)NFrrsrrr�__bool__�r_zDModuleForLoaderTests.test_false_module.<locals>.FalseModule.__bool__N�rrrr~rrrr�FalseModule�r#r��mod)	r1r2rriZassertFalserkrlrcr@)r
r�r3rZgivenrrr�test_false_module�s


"�z&ModuleForLoaderTests.test_false_modulecs�G�fdd�d�}d}t�|��&|d�}|�|�}��|j|���|j|���|jd�Wd�n1s9wYd}t�|��'|d�}|�|�}��|j|���|j|���|j|�Wd�dS1sowYdS)Ncs*eZdZdd�Zdd�Z�jdd��ZdS)z<ModuleForLoaderTests.test_attributes_set.<locals>.FakeLoadercSs
||_dSr�Z_pkg)r
rGrrr�__init__��
zEModuleForLoaderTests.test_attributes_set.<locals>.FakeLoader.__init__cS�|jSrr�rprrrrG�szGModuleForLoaderTests.test_attributes_set.<locals>.FakeLoader.is_packagecSrarrrrrrrq�rrzHModuleForLoaderTests.test_attributes_set.<locals>.FakeLoader.load_moduleN)rrrr�rGrYrqrrsrrrt�s
rt�pkg.modF�pkgzpkg.subT)rrirqrrr@rArD)r
rtr3rBrrrsr�test_attributes_set�s"	
�
"�z(ModuleForLoaderTests.test_attributes_setN)rrr�classmethodrYr`rcrfrnrvrxrzr}r�r�rrrrrS{s
	
	rSc@sFeZdZ	dd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�SetPackageTestscsv	�fdd�}|j�|�}t���t�dt�|�Wd�n1s%wY|�t�d��|�|�j	�dS)Ncs�Srrr�rrrr^r_z(SetPackageTests.verify.<locals>.<lambda>rTrD)
r�set_packagerUrVrWrX�
assertTrue�hasattrrrD)r
r�expectrbr|rr�r�verifys
�zSetPackageTests.verifycC� t�d�}d|_|�|d�dS)Nr��r1r2rDr�rrrr�test_top_level
s
zSetPackageTests.test_top_levelcCs(t�d�}dg|_d|_|�|d�dS)Nr�z<path>)r1r2rHrDr�rrrr�test_packages
zSetPackageTests.test_packagecCr�)Nr�r�r�rrrr�test_submodules
zSetPackageTests.test_submodulecCs.t�d�}t|d�rt|d�|�|d�dS)Nr�rDr�)r1r2r��delattrr�rrrr�test_setting_if_missing!s


z'SetPackageTests.test_setting_if_missingcCs*dD]}t�d�}||_|�||�qdS)N)TFr�r�)r
�valuerrrr�test_leaving_alone(s

�z"SetPackageTests.test_leaving_alonecCsldd�}t���t�dt�|j�|�}Wd�n1swY|�|j|j�|�|j|j�dS)NcSrrrr�rrrrb0r_z1SetPackageTests.test_decorator_attrs.<locals>.fxnrT)	rUrVrWrXrr�rrrr{rrrr}/s
�z$SetPackageTests.test_decorator_attrsN)
rrrr�r�r�r�r�r�r}rrrrr��sr�c@s2eZdZ	edd��Zdd�Zdd�Zdd�Zd	S)
�SetLoaderTestscsG�fdd�d�}|�j_|S)NcseZdZ�jjdd��ZdS)z/SetLoaderTests.DummyLoader.<locals>.DummyLoadercSr�rr�rrrrrqEsz;SetLoaderTests.DummyLoader.<locals>.DummyLoader.load_moduleN)rrrr�
set_loaderrqrrsrr�DummyLoaderDsr�)�	__class__r�)r
r�rrsrr�AszSetLoaderTests.DummyLoadercCs�|��}t�d�|_z|j`Wn	tyYnwt���t�dt	�|�
||�d�j�Wd�dS1s9wYdS�N�blahrT)r�r1r2rrA�AttributeErrorrUrVrWrXrrq�r
rBrrr�test_no_attributeKs
�
"�z SetLoaderTests.test_no_attributecCsj|��}t�d�|_d|j_t���t�dt�|�	||�
d�j�Wd�dS1s.wYdSr��r�r1r2rrArUrVrWrXrrqr�rrr�test_attribute_is_NoneV�
"�z%SetLoaderTests.test_attribute_is_NonecCsj|��}t�d�|_d|j_t���t�dt�|�	d|�
d�j�Wd�dS1s.wYdS)Nr�rurTr�r�rrr�test_not_reset^r�zSetLoaderTests.test_not_resetN)rrr�propertyr�r�r�r�rrrrr�=s
	r�c@s>eZdZ	dd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�ResolveNameTestscCs|�d|j�dd��dS)N�bacon�rr�resolve_namersrrr�
test_absolutep�zResolveNameTests.test_absolutecCs|�d|j�dd��dS)Nr��spamr�rsrrr�test_absolute_within_packagetr�z-ResolveNameTests.test_absolute_within_packagecC�>|�t��|j�dd�Wd�dS1swYdS)N�.baconr��r'r(rr�rsrrr�test_no_packagex�"�z ResolveNameTests.test_no_packagecC�|�d|j�dd��dS)Nzspam.eggs.baconr��	spam.eggsr�rsrrr�test_in_package}��z ResolveNameTests.test_in_packagecCr�)Nz
spam.bacon�..baconr�r�rsrrr�test_other_package�r�z#ResolveNameTests.test_other_packagecCr�)Nr�r�r�rsrrr�test_escape�r�zResolveNameTests.test_escapeN)	rrrr�r�r�r�r�r�rrrrr�lsr�c@szeZdZGdd�d�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)�
FindSpecTestsc@seZdZeddd��ZdS)zFindSpecTests.FakeMetaFinderNcCs
|||fSrr)r3�path�targetrrr�	find_spec�r�z&FindSpecTests.FakeMetaFinder.find_spec)NN)rrr�staticmethodr�rrrr�FakeMetaFinder�sr�cCs~d}t�|��.t�|�}d}|j�||�}||_||_|tj	|<|j�
|�}|�||�Wd�dS1s8wYdS�N�some_modz	a loader!)rrir1r2r%r&rAr>rkrlr�r�r
r3rrBr+�foundrrr�test_sys_modules�s

"�zFindSpecTests.test_sys_modulescCs|d}t�|��-t�|�}|`d}|j�||�}||_|tj	|<|j�
|�}|�||�Wd�dS1s7wYdSr�)rrir1r2rAr%r&r>rkrlr�rr�rrr�#test_sys_modules_without___loader__�s

"�z1FindSpecTests.test_sys_modules_without___loader__c	Cs�d}t�|��9t�|�}d|_|tj|<|�t��|j�	|�Wd�n1s+wYWd�dSWd�dS1sCwYdS�Nr�)
rrir1r2r>rkrlr'�
ValueErrorr�ryrrr�test_sys_modules_spec_is_None�s

��"�z+FindSpecTests.test_sys_modules_spec_is_NonecCstd}t�|��)t�|�}|j�|d�}||_|tj|<|j�	|�}|�
||�Wd�dS1s3wYdSr�)rrir1r2r%r&r>rkrlr�r)r
r3rr+r�rrr�test_sys_modules_loader_is_None�s

"�z-FindSpecTests.test_sys_modules_loader_is_Nonec	Cs�d}t�|��Dt�|�}z|`Wn	tyYnw|tj|<|�t	��|j�
|�Wd�n1s6wYWd�dSWd�dS1sNwYdSr�)rrir1r2r>r�rkrlr'r�r�ryrrr� test_sys_modules_spec_is_not_set�s
�
��"�z.FindSpecTests.test_sys_modules_spec_is_not_setc	Cs�d}t�|��6tj|jgd��|�|ddf|j�|��Wd�n1s(wYWd�dSWd�dS1s@wYdS)Nr�)�	meta_path)rriZimport_stater�rr�rprrr�test_success�s
���"�zFindSpecTests.test_successcCs|�|j�d��dS)NZnevergoingtofindthismodule)ZassertIsNonerr�rsrrr�test_nothing�szFindSpecTests.test_nothingcCs�d}d}tj|dd��<}t�|||�\}}|j�|�}|�|d�|�|ttj��|�	|ttj��|j�|�}|�
||�Wd�dS1sJwYdS�Nr��hamT�r��r�temp_module�	submoduler��assertIsNotrj�sortedrkrlrwr�r
r3�subname�pkg_dir�fullname�_r+�
spec_againrrr�test_find_submodule�s"�z!FindSpecTests.test_find_submodulecCs�d}d}tj|dd��B}|j�|�t�|||�\}}|j�|�}|�|d�|�|tt	j
��|�|tt	j
��|j�|�}|�||�Wd�dS1sPwYdSr�)
rr��init�
import_moduler�r�r�rjr�rkrlrwrr�rrr�+test_find_submodule_parent_already_imported�s"�z9FindSpecTests.test_find_submodule_parent_already_importedc	Cs�d}d}tj|dd��A}t�|||�\}}d|}|j�||�}|�|d�|�|ttj��|�	|ttj��|j�|�}|�
||�Wd�dS1sOwYdS�Nr�r�Tr��.r�)	r
r3r�r�r�r��relnamer+r�rrr�test_find_relative_module�s"�z'FindSpecTests.test_find_relative_modulec	Cs�d}d}tj|dd��C}t�|||�\}}d|}|�t��|j�|�Wd�n1s/wY|�|ttj	��|�|ttj	��Wd�dS1sQwYdSr�)
rr�r�r'r(r�rwr�rkrl)r
r3r�r�r�r�r�rrr�)test_find_relative_module_missing_packages�"�z7FindSpecTests.test_find_relative_module_missing_packagecC�<|�t��|j�d�Wd�dS1swYdS)Nzmodule.name)r'�ModuleNotFoundErrorrr�rsrrr�test_find_submodule_in_modules"�z+FindSpecTests.test_find_submodule_in_moduleN)rrrr�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr��s	

r�)r�rr%c@seZdZdd�Zdd�ZdS)�MagicNumberTestscCs|�t|jj�d�dS)N�)r�lenr�MAGIC_NUMBERrsrrr�test_length�zMagicNumberTests.test_lengthcCs|�|jj�d��dS)Ns
)r�rr��endswithrsrrr�test_incorporates_rn!r�z%MagicNumberTests.test_incorporates_rnN)rrrr�r�rrrrr�sr�c@s�eZdZ	ejjZe�ejjdud�dd��Z	dd�Z
dd�Zd	d
�Zdd�Z
d
d�Zdd�Zdd�Zdd�Zdd�Ze�ejdkoFejdkd�dd��Ze�ejjdud�dd��Ze�ejjdud�dd ��Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Z d/d0�Z!d1d2�Z"e�ejjdud�d3d4��Z#e�ejjdud�d5d6��Z$e�ejjdud�d7d8��Z%e�ejjdud�d9d:��Z&e�ejjdud�d;d<��Z'dS)=�PEP3147TestsNz1requires sys.implementation.cache_tag not be Nonec	CsJtj�dddd�}tj�ddddd�|j��}|�|jj|dd�|�dS�	N�foo�bar�baz�qux.py�__pycache__�
qux.{}.pycr���optimization��osr�r�format�tagrr�cache_from_source�r
r�r�rrr�test_cache_from_source1s
��z#PEP3147Tests.test_cache_from_sourcec	Cs|t�tjdd��,|�t��|j�d�Wd�n1swYWd�dSWd�dS1s7wYdS)N�	cache_tagzwhatever.py)r�	swap_attrrk�implementationr'�NotImplementedErrorrrrsrrr�#test_cache_from_source_no_cache_tag<s��"�z0PEP3147Tests.test_cache_from_source_no_cache_tagcCsBtj�dd�}tj�ddd�|j��}|�|jj|dd�|�dS)Nzfoo.bar�filer�z
file{}.pycr�r�r�rrrr�test_cache_from_source_no_dotBs

��z*PEP3147Tests.test_cache_from_source_no_dotc	Cs@tj�dddd�}t���/t�d�|�|j�|d�|jj|dd��|�|j�|d	�|jj|d
d��Wd�n1s?wYt���Nt�d�|�	t
��|j�|d�Wd�n1sewY|�	t
��|j�|d	�Wd�n1s�wYWd�dSWd�dS1s�wYdS)Nr�r�r�r�rTFrr�Tr�r\)r�r�rrUrVrWrrrr'rX�r
r�rrr�%test_cache_from_source_debug_overrideJs*

���

���"�z2PEP3147Tests.test_cache_from_source_debug_overridecC�6d}tj�dd�|j��}|�|jj|dd�|�dS�N�foo.pyr�z
foo.{}.pycr�r�r�rrrr�test_cache_from_source_cwd[s
�z'PEP3147Tests.test_cache_from_source_cwdc	Cs�tj�ddd�}Gdd�d�}t���Vt�d�|�|j�|g�|jj|dd��|�|j�|d	g�|jj|d
d��|�	t
��|j�d|��Wd�n1sTwYWd�dSWd�dS1slwYdS)Nr�r�zbaz.pyc@r)z=PEP3147Tests.test_cache_from_source_override.<locals>.BearishcSrdr)�RuntimeErrorrsrrrr~hr_zFPEP3147Tests.test_cache_from_source_override.<locals>.Bearish.__bool__Nrrrrr�Bearishgr#rrTrr��r�z/foo/bar/baz.py)r�r�rrUrVrWrrrr'r)r
r�rrrr�test_cache_from_source_overrideas 

����"�z,PEP3147Tests.test_cache_from_source_overridecCrrr�rrrr�0test_cache_from_source_optimization_empty_stringss
�z=PEP3147Tests.test_cache_from_source_optimization_empty_stringcCs|d}tjj}tj�dd�|j��}|dkr|d}n|dkr&|d�|�}n
d�|�}|�|�|�	|j
j|dd	�|�dS)
Nrr��foo.{}r�.pyc��.opt-{}.pycz){!r} is a non-standard optimization levelr�)rk�flags�optimizer�r�rrrZskipTestrrr)r
r�Zoptimization_level�
almost_expectr��msgrrr�(test_cache_from_source_optimization_Nonezs


�z5PEP3147Tests.test_cache_from_source_optimization_NonecCs�d}tjtj}tj�dd�|j��}|jj	||d�}|�
||d�|��|�
|jj	|dd�|d�|�t��|jj	|dd�Wd�dS1sMwYdS)	Nrr�rr�rruz.opt-42.pyczpath/is/bad)
�string�
ascii_letters�digitsr�r�rrrrrrr'r�)r
r�Zvalid_charactersrZgotrrr�'test_cache_from_source_optimization_set�s��"�z4PEP3147Tests.test_cache_from_source_optimization_setc	Cs�t���4t�d�|�t��|jjdddd�Wd�n1s#wYWd�dSWd�dS1s;wYdS)NrTrFr�r�)rUrVrWr'�	TypeErrorrrrsrrr�;test_cache_from_source_debug_override_optimization_both_set�s

��"�zHPEP3147Tests.test_cache_from_source_debug_override_optimization_both_set�\�/z/test meaningful only where os.altsep is definedcCs$|�|jjddd�d�|j��dS)Nz\foo\bar\baz/qux.pyr�r�z#\foo\bar\baz\__pycache__\qux.{}.pyc)rrrrrrsrrr�)test_sep_altsep_and_sep_cache_from_source�s
�z6PEP3147Tests.test_sep_altsep_and_sep_cache_from_sourcec	CsHt�dddd�}tj�ddddd�|j��}|�|jj	|dd�|�dSr�)
�pathlib�PurePathr�r�rrrrrrrrrr�$test_cache_from_source_path_like_arg�s
��z1PEP3147Tests.test_cache_from_source_path_like_argz4requires sys.implementation.cache_tag to not be Nonec	CsFtj�ddddd�|j��}tj�dddd�}|�|j�|�|�dS�Nr�r�r�r�r�r��r�r�rrrrr�source_from_cacherrrr�test_source_from_cache�s

�z#PEP3147Tests.test_source_from_cachec	Cs�tj�ddd�}t�tjdd��,|�t��|j	�
|�Wd�n1s'wYWd�dSWd�dS1s?wYdS)Nr�r�zwhatever.pycr)r�r�rrrrkrr'rrr.rrrr�#test_source_from_cache_no_cache_tag�s��"�z0PEP3147Tests.test_source_from_cache_no_cache_tagcC�|�t|jjd�dS)Nz/foo/bar/bazqux.pyc�r'r�rr.rsrrr�test_source_from_cache_bad_path�s
�z,PEP3147Tests.test_source_from_cache_bad_pathcCr1)Nzfoo.cpython-32.pycr2rsrrr�test_source_from_cache_no_slash��
�z,PEP3147Tests.test_source_from_cache_no_slashcCr1)Nz__pycache__/foo.pycr2rsrrr�#test_source_from_cache_too_few_dots�r5z0PEP3147Tests.test_source_from_cache_too_few_dotscCr�)Nz(__pycache__/foo.cpython-32.opt-1.foo.pycr2rsrrr�$test_source_from_cache_too_many_dots�s
�"�z1PEP3147Tests.test_source_from_cache_too_many_dotscCr1)Nz"__pycache__/foo.cpython-32.foo.pycr2rsrrr�test_source_from_cache_not_opt���z+PEP3147Tests.test_source_from_cache_not_optcCr1)Nz/foo/bar/foo.cpython-32.foo.pycr2rsrrr�$test_source_from_cache_no__pycache__�r9z1PEP3147Tests.test_source_from_cache_no__pycache__cCs.tj�dd�|j��}|�|j�|�d�dS)Nr�zfoo.{}.opt-1.pycrr-rrrr�)test_source_from_cache_optimized_bytecode�sz6PEP3147Tests.test_source_from_cache_optimized_bytecodecCsRtj�dd�|j��}|�t��|j�|�Wd�dS1s"wYdS)Nr�zfoo.{}.opt-.pyc)	r�r�rrrr'r�rr.rrrr�+test_source_from_cache_missing_optimization�s"�z8PEP3147Tests.test_source_from_cache_missing_optimizationc	CsDt�ddddd�|j��}tj�dddd�}|�|j�	|�|�dSr,)
r)r*rrr�r�rrrr.rrrr�$test_source_from_cache_path_like_arg�s

�z1PEP3147Tests.test_source_from_cache_path_like_argcs&tj�tjjdd�tj�tjjdd�tj�tjjdd�tjjg}d�tjdkr9d��fdd	�|D�}|d
dg7}|D]U}|j|d��E�tj�tjjd
ddd�}tj�|d
ddd�|j��}t�	|��|�
|jj|dd�|�Wd�n1s|wYWd�n1s�wYq;dS)N�tmp�bytecodeu☃ztrailing-slashr��ntzC:csg|]}��|���qSrr)�.0�prefix��driverr�
<listcomp>s�zOPEP3147Tests.test_cache_from_source_respects_pycache_prefix.<locals>.<listcomp>z
\\?\C:\fooz\\localhost\c$\bar)r�r�r�r�r�r�r�)r�r�r�sepr3ZsubTestrrr�temporary_pycache_prefixrr)r
Zpycache_prefixes�pycache_prefixr�r�rrCr�.test_cache_from_source_respects_pycache_prefix�s<�

��
�������z;PEP3147Tests.test_cache_from_source_respects_pycache_prefixc
Cs�tj�tjjdd�}tj�dddd�}tj�t���dtjj}tj�|tj�t��|�dddd|j�d	��}t�	|��|�
|jj|d
d�|�Wd�dS1sUwYdS)Nr>r?r�r�r�r�r�qux.rr�r�)r�r�rrF�
splitdrive�getcwd�relpathrrrGrr)r
rHr��rootr�rrr�7test_cache_from_source_respects_pycache_prefix_relatives��"�zDPEP3147Tests.test_cache_from_source_respects_pycache_prefix_relativec	Cs�tj�tjjdd�}tj�|dddd|j�d��}tj�tjjdddd�}t�|��|�|j�|�|�Wd�dS1s@wYdS)	Nr>r?r�r�r�rJrr��	r�r�rrFrrrGrr.�r
rHr�r�rrr�,test_source_from_cache_inside_pycache_prefix's�"�z9PEP3147Tests.test_source_from_cache_inside_pycache_prefixc	Cs�tj�tjjdd�}tj�ddddd|j�d��}tj�dddd	�}t�|��|�|j�|�|�Wd�dS1s=wYdS)
Nr>r?r�r�r�r�rJrr�rPrQrrr�-test_source_from_cache_outside_pycache_prefix4s�"�z:PEP3147Tests.test_source_from_cache_outside_pycache_prefix)(rrrrkrrr�unittestZskipIfrr	rr
rrrrr#r%�
skipUnlessr�rF�altsepr(r+r/r0r3r4r6r7r8r:r;r<r=rIrOrRrSrrrrr�+sr�
	�
�
�
�
�
�
�
�r�c@s*eZdZ	e�ejjdvd�dd��ZdS)r�)�	candidate�finalz8only applies to candidate or final python release levelscCs2d}t�tjjdd�d�}d}|�|||�dS)Nio
r�littlea�To avoid breaking backwards compatibility with cached bytecode files that can't be automatically regenerated by the current user, candidate and final releases require the current  importlib.util.MAGIC_NUMBER to match the expected magic number in this test. Set the expected magic number in this test to the current MAGIC_NUMBER to continue with the release.

Changing the MAGIC_NUMBER for a maintenance release requires discussion in python-dev and notification of community stakeholders.)�int�
from_bytesrrr�r)r
ZEXPECTED_MAGIC_NUMBER�actualrrrr�test_magic_numberKs
�z"MagicNumberTests.test_magic_numberN)	rrrrTrUrk�version_info�releaselevelr]rrrrr�Gs
��__main__)2r�rZimport_importlibr/r�r%Zimportlib_util�importlib.utilrr�r)r rkr$rr1rTZ
unittest.mockrUrZ	test_bothZFrozen_DecodeSourceBytesTestsZSource_DecodeSourceBytesTestsrZFrozen_ModuleFromSpecTestsZSource_ModuleFromSpecTestsrSZFrozen_ModuleForLoaderTestsZSource_ModuleForLoaderTestsr�ZFrozen_SetPackageTestsZSource_SetPackageTestsr�ZFrozen_SetLoaderTestsZSource_SetLoaderTestsr�ZFrozen_ResolveNameTestsZSource_ResolveNameTestsr�ZFrozen_FindSpecTestsZSource_FindSpecTestsr�ZFrozen_MagicNumberTestsZSource_MagicNumberTestsr�ZFrozen_PEP3147TestsZSource_PEP3147TestsZTestCaser�mainrrrr�<module>s~



�
J���<�,�#�
��
��)�