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_abc.cpython-310.opt-1.pyc
o

�iĈ�@s�ddlZddlZddlZddlZddlmZddlmZddlZddl	Z	ddl	m
Z
ddlZddlm
Ze�d�Ze�d�Ze�d	�Ze�d
�Z
Gdd�d�ZGd
d�de�Zejeed�\ZZGdd�de�Zejeed�\ZZGdd�de�Zejeed�\ZZGdd�de�Zejeed�\ZZ Gdd�de�Z!eje!ed�\Z"Z#Gdd�de�Z$eje$ed�\Z%Z&Gdd�de�Z'eje'ed�\Z(Z)d\dd�Z*Gdd �d �Z+Gd!d�d�ZGd"d#�d#e+�Z,e�e,�\Z-Z.Gd$d�d�ZGd%d&�d&e+�Z/e�e/�\Z0Z1Gd'd(�d(�Z2Gd)d*�d*e+�Z3e�e3�\Z4Z5Gd+d�de2�ZGd,d-�d-e+�Z6e�e6�\Z7Z8Gd.d�de2�Ze*e�Z9Gd/d0�d0e+�Z:e�e:�\Z;Z<Gd1d�de�Z!e*e!�Z=Gd2d3�d3e+�Z>e�e:�\Z?Z@Gd4d5�d5�ZAGd6d7�d7e+�ZBe�eB�\ZCZDGd8d9�d9�ZEejeEee
d:�\ZFZGGd;d<�d<�ZHejeHee
ed=�\ZIZJGd>d?�d?�ZKejeKee
d:�\ZLZMGd@dA�dA�ZNejeNe9dB�\ZOZPGdCdD�dD�ZQejeQe9dB�\ZRZSGdEdF�dF�ZTejeTe9ee
dG�\ZUZVGdHdI�dI�ZWejeWe=dJ�\ZXZYGdKdL�dL�ZZe*eZd�Z[GdMd�deZ�Z'e*e'e
edN�Z\GdOdP�dP�Z]GdQdR�dRe]�Z^eje^e
e[dS�\Z_Z`e	�aejbdT�GdUdV�dVe]��Zcejecee
e\dW�\ZdZeGdXdY�dY�Zfejefe[dZ�\ZgZheid[k�rVe	�j�dSdS)]�N)�support)�
import_helper)�mock�)�util�	importlibz
importlib.abczimportlib.machineryzimportlib.utilc@s0eZdZdZgZgZdd�Zdd�Zdd�ZdS)	�InheritanceTestszSTest that the specified class is a subclass/superclass of the expected
    classes.csR�fdd��jD��_t�d�r�jj��fdd��jD��_t�j�j��_	dS)Ncsg|]}t�j|��qS�)�getattr�abc��.0�
class_name��selfr	�9/usr/local/lib/python3.10/test/test_importlib/test_abc.py�
<listcomp>s�z*InheritanceTests.setUp.<locals>.<listcomp>�subclass_namescsg|]}t�|��qSr	�r
r)�	machineryr	rr's�)
�superclass_names�superclasses�hasattrrrr�
subclassesr
Z_NAME�_InheritanceTests__testrr	)rrr�setUps
�

�zInheritanceTests.setUpcCs.|jD]}|�t||j�d�||j��qdS)Nz{0} is not a subclass of {1})r�
assertTrue�
issubclassr�format)r�subclassr	r	r�test_subclasses,�

��z InheritanceTests.test_subclassescCs.|jD]}|�t|j|�d�||j��qdS)Nz{0} is not a superclass of {1})rrrrr)rZ
superclassr	r	r�test_superclasses2r!z"InheritanceTests.test_superclassesN)	�__name__�
__module__�__qualname__�__doc__rrrr r"r	r	r	rrsrc@seZdZgZgd�ZdS)�MetaPathFinder)�BuiltinImporter�FrozenImporter�
PathFinder�WindowsRegistryFinderN�r#r$r%rrr	r	r	rr'9sr')rc@seZdZgZdgZdS)�PathEntryFinder�
FileFinderNr,r	r	r	rr-Ds
r-c@seZdZdgZdS)�ResourceLoader�LoaderN)r#r$r%rr	r	r	rr/Ns
r/c@seZdZdgZgd�ZdS)�
InspectLoaderr0)r(r)�ExtensionFileLoaderNr,r	r	r	rr1Wsr1c@seZdZdgZdgZdS)�ExecutionLoaderr1r2Nr,r	r	r	rr3as
r3c@seZdZddgZddgZdS)�
FileLoaderr/r3�SourceFileLoader�SourcelessFileLoaderNr,r	r	r	rr4ksr4c@seZdZddgZdgZdS)�SourceLoaderr/r3r5Nr,r	r	r	rr7us
r7FcsF�dur|j��fdd�t��D�}�fdd�tj||fi|��D�S)Ncsi|]
\}}|t|���qSr	r)r
�kindZsplitabc)�namer	r�
<dictcomp>�s�z'make_abc_subclasses.<locals>.<dictcomp>csi|]}|j�r|�n|�qSr	)�_KIND)r
�cls)�instr	rr:�s�)r#r�items�	test_utilZsplit_frozen)Z
base_classr9r=�kwargs�baser	)r=r9r�make_abc_subclasses�s
�
�rBc@seZdZedd��ZdS)�ABCTestHarnesscCs|j|j}|�}||j_|S�N)�SPLITr;�	__class__�ins)rr<rGr	r	rrG�szABCTestHarness.insN)r#r$r%�propertyrGr	r	r	rrC�srCc�eZdZ�fdd�Z�ZS)r'cst��||�SrD)�super�find_module)r�fullname�path�rFr	rrK�szMetaPathFinder.find_module)r#r$r%rK�
__classcell__r	r	rNrr'��c@s$eZdZee�Zdd�Zdd�ZdS)�MetaPathFinderDefaultsTestscCsF|�t��|j�dd�}Wd�n1swY|�|�dS�NZ	something)�assertWarns�DeprecationWarningrGrK�assertIsNone�r�foundr	r	r�test_find_module�s�z,MetaPathFinderDefaultsTests.test_find_modulecC�|j��dSrD�rG�invalidate_cachesrr	r	r�test_invalidate_caches��z2MetaPathFinderDefaultsTests.test_invalidate_cachesN)r#r$r%rBr'rErXr\r	r	r	rrQ�srQcrI)r-c�t��|�SrD)rJ�find_loader�rrLrNr	rr_��zPathEntryFinder.find_loader)r#r$r%r_rOr	r	rNrr-�rPc@�,eZdZee�Zdd�Zdd�Zdd�ZdS)�PathEntryFinderDefaultsTestscCsJ|�t��|j�d�}Wd�n1swY|�|dgf�dSrR)rSrTrGr_�assertEqualrVr	r	r�test_find_loader�s�z-PathEntryFinderDefaultsTests.test_find_loadercCs|�d|j�d��dSrR)rdrGrKrr	r	rrK�sz(PathEntryFinderDefaultsTests.find_modulecCrYrDrZrr	r	rr\�r]z3PathEntryFinderDefaultsTests.test_invalidate_cachesN)	r#r$r%rBr-rErerKr\r	r	r	rrc�s
rccrI)r0cr^rD)rJ�load_moduler`rNr	rrf�razLoader.load_module)r#r$r%rfrOr	r	rNrr0�rPr0c@rb)�LoaderDefaultsTestscCsd}|�|j�|��dS)Nza spec)rUrG�
create_module)r�specr	r	r�test_create_module�sz&LoaderDefaultsTests.test_create_modulecC�<|�t��|j�d�Wd�dS1swYdSrR)�assertRaises�ImportErrorrGrfrr	r	r�test_load_module��"�z$LoaderDefaultsTests.test_load_modulec	Cs�t�d�}t���9t�dt�|�t��|j�	|�Wd�n1s&wYt
|�}|j|_|�t
|��Wd�dS1sEwYdS)N�blah�ignore)
�types�
ModuleType�warnings�catch_warnings�simplefilterrTrl�NotImplementedErrorrG�module_repr�repr�
__loader__r)r�modZ
original_reprr	r	r�test_module_repr�s

�"�z$LoaderDefaultsTests.test_module_reprN)	r#r$r%rBr0rErjrnr|r	r	r	rrg�s
rgcrI)r/cr^rD)rJ�get_data�rrMrNr	rr}�razResourceLoader.get_data)r#r$r%r}rOr	r	rNrr/�rPc@seZdZee�Zdd�ZdS)�ResourceLoaderDefaultsTestscCrk)Nz
/some/path)rl�IOErrorrGr}rr	r	r�
test_get_data�roz)ResourceLoaderDefaultsTests.test_get_dataN)r#r$r%rBr/rEr�r	r	r	rr�srcs(eZdZ�fdd�Z�fdd�Z�ZS)r1cr^rD)rJ�
is_packager`rNr	rr�razInspectLoader.is_packagecr^rD)rJ�
get_sourcer`rNr	rr�razInspectLoader.get_source)r#r$r%r�r�rOr	r	rNrr1sc@s eZdZeZdd�Zdd�ZdS)�InspectLoaderDefaultsTestscCrk�Nrp)rlrmrGr�rr	r	r�test_is_packageroz*InspectLoaderDefaultsTests.test_is_packagecCrkr�)rlrmrGr�rr	r	r�test_get_sourceroz*InspectLoaderDefaultsTests.test_get_sourceN)r#r$r%�SPLIT_ILrEr�r�r	r	r	rr�sr�crI)r3cr^rD)rJ�get_filenamer`rNr	rr�"razExecutionLoader.get_filename)r#r$r%r�rOr	r	rNrr3 rPc@seZdZeZdd�ZdS)�ExecutionLoaderDefaultsTestscCrkr�)rlrmrGr�rr	r	r�test_get_filename-roz.ExecutionLoaderDefaultsTests.test_get_filenameN)r#r$r%�SPLIT_ELrEr�r	r	r	rr�)sr�cs@eZdZ�fdd�Z�fdd�Z�fdd�Z�fdd�Z�ZS)	�ResourceReaderc�t�j|i|��SrD)rJ�
open_resource�r�argsr@rNr	rr�9�zResourceReader.open_resourcecr�rD)rJ�
resource_pathr�rNr	rr�<r�zResourceReader.resource_pathcr�rD)rJ�is_resourcer�rNr	rr�?r�zResourceReader.is_resourcecr�rD)rJ�contentsr�rNr	rr�Br�zResourceReader.contents)r#r$r%r�r�r�r�rOr	r	rNrr�7s
r�c@s4eZdZee�Zdd�Zdd�Zdd�Zdd�Z	d	S)
�ResourceReaderDefaultsTestscCrk�NZ
dummy_file)rl�FileNotFoundErrorrGr�rr	r	r�test_open_resourceJroz.ResourceReaderDefaultsTests.test_open_resourcecCrkr�)rlr�rGr�rr	r	r�test_resource_pathNroz.ResourceReaderDefaultsTests.test_resource_pathcCrkr�)rlr�rGr�rr	r	r�test_is_resourceRroz,ResourceReaderDefaultsTests.test_is_resourcecCs:|�t��|j��Wd�dS1swYdSrD)rlr�rGr�rr	r	r�
test_contentsVs"�z)ResourceReaderDefaultsTests.test_contentsN)
r#r$r%rBr�rEr�r�r�r�r	r	r	rr�Fsr�c@s8eZdZedd��Zdd�Zdd�Zdd�Zd	d
�ZdS)�MetaPathFinderFindModuleTestsc�G�fdd�d|jj�}|�S)Nc�eZdZd�fdd�	ZdS)z@MetaPathFinderFindModuleTests.finder.<locals>.MetaPathSpecFinderNcs||f|_�SrD��
called_for)rrLrM�target�rir	r�	find_specgs
zJMetaPathFinderFindModuleTests.finder.<locals>.MetaPathSpecFinder.find_specrD�r#r$r%r�r	r�r	r�MetaPathSpecFindere�r�)rr')r<rir�r	r�r�finderc�z$MetaPathFinderFindModuleTests.findercCsZ|�d�}gd�}d}|�t��|�||�}Wd�n1s!wY|�|�dS)N��a�b�crp)r�rSrTrKrU�rr�rMr9rWr	r	rrXms
�z.MetaPathFinderFindModuleTests.test_find_modulecCs<t�}|j�d|�}|�|�}|�ddd�}|�||�dSr�)�objectr�spec_from_loaderr�r�rd�r�loaderrir�rWr	r	r�#test_find_spec_with_explicit_targetus

zAMetaPathFinderFindModuleTests.test_find_spec_with_explicit_targetcCsV|�d�}gd�}d}|�||d�}|�|�|�||jd�|�||jd�dS)Nr�rprr)r�r�rUrdr�r�r	r	r�test_no_spec|s

z*MetaPathFinderFindModuleTests.test_no_speccCs:t�}|j�d|�}|�|�}|�dd�}|�||�dSr�)r�rr�r�r��assertIsr�r	r	r�	test_spec�s

z'MetaPathFinderFindModuleTests.test_specN)	r#r$r%�classmethodr�rXr�r�r�r	r	r	rr�as
		r�)rrc@s0eZdZedd��Zdd�Zdd�Zdd�Zd	S)
�PathEntryFinderFindLoaderTestscr�)Ncr�)zBPathEntryFinderFindLoaderTests.finder.<locals>.PathEntrySpecFinderNcs
||_�SrDr�)rrLr�r�r	rr��szLPathEntryFinderFindLoaderTests.finder.<locals>.PathEntrySpecFinder.find_specrDr�r	r�r	r�PathEntrySpecFinder�r�r�)rr-)r<rir�r	r�rr��r�z%PathEntryFinderFindLoaderTests.findercCsr|�d�}d}|�t��
|�|�}Wd�n1swY|�|d�|�g|d�|�||j�dS)Nrprr)r�rSrTr_rUrdr�)rr�r9rWr	r	rr��s
�z+PathEntryFinderFindLoaderTests.test_no_speccCsht�}|j�d|�}|�|�}|�t��
|�d�}Wd�n1s$wY|�|d|j�dS)Nrpr)	r�rr�r�rSrTr_r�r�r�r	r	r�test_spec_with_loader�s
�z4PathEntryFinderFindLoaderTests.test_spec_with_loadercCs||j�dd�}gd�}||_|�|�}|�t��
|�d�}Wd�n1s(wY|�|d�|�||d�dS)Nrpr�rr)	r�
ModuleSpec�submodule_search_locationsr�rSrTr_rUrd)rri�pathsr�rWr	r	r�test_spec_with_portions�s
�z6PathEntryFinderFindLoaderTests.test_spec_with_portionsN)r#r$r%r�r�r�r�r�r	r	r	rr��s
		r�)rrrc@�$eZdZdd�Zdd�Zdd�ZdS)�LoaderLoadModuleTestscCsGdd�d|jj�}|�S)Nc@s eZdZdZdd�Zdd�ZdS)z0LoaderLoadModuleTests.loader.<locals>.SpecLoaderNcS�
||_dSrD)rW�r�moduler	r	r�exec_module��
z<LoaderLoadModuleTests.loader.<locals>.SpecLoader.exec_modulecS�dS)z.Force some non-default module state to be set.Tr	r`r	r	rr��sz;LoaderLoadModuleTests.loader.<locals>.SpecLoader.is_package)r#r$r%rWr�r�r	r	r	r�
SpecLoader�sr�)rr0)rr�r	r	rr��s	zLoaderLoadModuleTests.loaderc	Cs�t���ht�dt�|��}d}t�|��|�|�|j}|�	t
j||�Wd�n1s2wY|�||j
�|�||jj�|�||j�|�||jj�|�|j�|�|j|jj�Wd�dS1sowYdS�Nrqrp)rtrurvrTr�r?�uncacherfrWr��sys�modulesrdrz�__spec__r#r9ZassertIsNotNone�__path__r�)rr�r9r�r	r	r�
test_fresh�s$

��"�z LoaderLoadModuleTests.test_freshc	Cs�t���at�dt�d}|��}t�|�}|j�||�|_	||_
t�|��'|t
j|<|�|�|j}|�|t
j|�|�|t
j|�Wd�n1sPwYWd�dSWd�dS1shwYdSr�)rtrurvrTr�rrrsrr�r�rzr?r�r�r�rfrWr�)rr9r�r�rWr	r	r�test_reload�s"



��"�z!LoaderLoadModuleTests.test_reloadN)r#r$r%r�r�r�r	r	r	rr��sr�c@s6eZdZddd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�InspectLoaderSourceToCodeTestsNcCsBt�d�}|��}|dur|�|�}n|�||�}t||j�|S)z!Help with source_to_code() tests.rpN)rrrs�InspectLoaderSubclass�source_to_code�exec�__dict__)r�datarMr�r��coder	r	r�source_to_module�s
z/InspectLoaderSourceToCodeTests.source_to_modulecC�0d}|�|�}|�t|d��|�|jd�dS)N�	attr = 42�attr�*�r�rrrdr��r�sourcer�r	r	r�test_source_to_code_source�
z9InspectLoaderSourceToCodeTests.test_source_to_code_sourcecCr�)Ns	attr = 42r�r�r�r�r	r	r�test_source_to_code_bytesr�z8InspectLoaderSourceToCodeTests.test_source_to_code_bytescCs*d}|��}|�d|�}|�|j|�dS)Nzpath/to/somewhere��r�r�rd�co_filename)rrMr�r�r	r	r�test_source_to_code_pathsz7InspectLoaderSourceToCodeTests.test_source_to_code_pathcCs$|��}|�d�}|�|jd�dS)Nr��<string>r�)rr�r�r	r	r�test_source_to_code_no_paths
z:InspectLoaderSourceToCodeTests.test_source_to_code_no_pathrD)r#r$r%r�r�r�r�r�r	r	r	rr��s
r�)r�c@r�)�InspectLoaderGetCodeTestscCspt�d�}tj�|jd��}d|_|��}|�d�}Wd�n1s$wYt||j	�|�
|jd�dS)Nrpr�r�r�)rrrsr�patchr�r��return_value�get_coder�r�rdr�)rr��mockedr�r�r	r	r�
test_get_code)s
�z'InspectLoaderGetCodeTests.test_get_codecCsVtj�|jd��}d|_|��}|�d�}Wd�n1swY|�|�dS)Nr�rp)rr�r�r�r�r�rU)rr�r�r�r	r	r�test_get_code_source_is_None3s�z6InspectLoaderGetCodeTests.test_get_code_source_is_NonecC�B|��}|�t��|�d�Wd�dS1swYdSr�)r�rlrmr��rr�r	r	r�test_get_code_source_not_found;�"�z8InspectLoaderGetCodeTests.test_get_code_source_not_foundN)r#r$r%r�r�r�r	r	r	rr�'s
r�c@sDeZdZdZdZdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dS)�InspectLoaderLoadModuleTestsz!Test InspectLoader.load_module().rpcCs t�|j�|�tj|j�dSrD)rZunload�module_nameZ
addCleanuprr	r	rrNsz"InspectLoaderLoadModuleTests.setUpcCsV|j�|j|�}t���t�dt�|jj�	|�Wd�S1s$wYdS�Nrq)
rr�r�rtrurvrT�init�
_bootstrap�_load_unlocked)rr�rir	r	r�loadRs

$�z!InspectLoaderLoadModuleTests.loadcCstj�|jd�S)Nr�)rr�r�r�rr	r	r�
mock_get_codeXsz*InspectLoaderLoadModuleTests.mock_get_codec	Cs�|���2}t|_|�t��|��}|�|�Wd�n1s!wYWd�dSWd�dS1s9wYdSrD)r�rm�side_effectrlr�r��r�mocked_get_coder�r	r	r�test_get_code_ImportError[�
��"�z6InspectLoaderLoadModuleTests.test_get_code_ImportErrorc	Cs�|���2}d|_|�t��|��}|�|�Wd�n1s!wYWd�dSWd�dS1s9wYdSrD)r�r�rlrmr�r�r�r	r	r�test_get_code_Nonecr�z/InspectLoaderLoadModuleTests.test_get_code_NonecCsftddd�}|���}||_|��}|�|�}|�|tj|j�Wd�dS1s,wYdS)Nr�r�r�)	�compiler�r�r�r�rdr�r�r�)rr�r�r�r�r	r	r�test_module_returnedks

"�z1InspectLoaderLoadModuleTests.test_module_returnedN)r#r$r%r&r�rr�r�r�rrr	r	r	rr�Hsr�)r�r�rc@s<eZdZddd�dd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�ExecutionLoaderGetCodeTestsF�r�r�cCs8d\}}|rtj�|jd�}|rtj�|jd�}||fS)N)NNr�r�)rr�r��ExecutionLoaderSubclass)rr�r��source_mock_context�filename_mock_contextr	r	r�mock_methods�s
�
�z(ExecutionLoaderGetCodeTests.mock_methodsc		Cs�d}|jddd�\}}|�)}|�}d|_||_|��}|�d�}Wd�n1s*wYWd�n1s9wY|�|j|�t�d�}t||j	�|�|j
d�dS)Nzblah.pyTrr�rpr�)rr�rr�rdr�rrrsr�r�r�)	rrMrr�source_mock�	name_mockr�r�r�r	r	rr��s 
���
z)ExecutionLoaderGetCodeTests.test_get_codecCsZ|jdd�\}}|�}d|_|��}|�d�}Wd�n1s!wY|�|�dS)NT)r�rp)rr�rr�rU)rr�_r�r�r�r	r	rr��s�z8ExecutionLoaderGetCodeTests.test_get_code_source_is_NonecCr�r�)rrlrmr�r�r	r	rr��r�z:ExecutionLoaderGetCodeTests.test_get_code_source_not_foundc	Cs�|jddd�\}}|�)}|�}d|_t|_|��}|�d�}Wd�n1s(wYWd�n1s7wY|�|jd�t�	d�}t
||j�|�|jd�dS)NTrr�rpr�r�)
rr�rmr�rr�rdr�rrrsr�r�r�)rrrr	r
r�r�r�r	r	r�test_get_code_no_path�s
���
z1ExecutionLoaderGetCodeTests.test_get_code_no_pathN)r#r$r%rr�r�r�rr	r	r	rr~s
	r)rc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�SourceOnlyLoadersN_ = '::'.join([__name__, __file__, __cached__, __package__, repr(__loader__)])cCr�rD�rMr~r	r	r�__init__�r�zSourceOnlyLoader.__init__cCs||jkrt�|jSrD)rMr�r�r~r	r	rr}�s
zSourceOnlyLoader.get_datacCs|jSrDrr`r	r	rr��szSourceOnlyLoader.get_filenamecCr�)Nz<module>r	r�r	r	rrx��zSourceOnlyLoader.module_reprN)r#r$r%r�rr}r�rxr	r	r	rr
�sr
cs>eZdZdZd�fdd�	Z�fdd�Zdd�Zd	d
�Z�ZS)r7rNcs�t��|�|j�|j�|_t|j�|_|dur|jj	}t
|�}|�|j�
d��|�|j�
|j��|�|j�
|j��t|j|jddd�}|�t�|��t|�|_i|_dS)Nrr�T)�dont_inherit)rJrr�cache_from_sourcerM�
bytecode_path�lenr��source_size�MAGIC_NUMBER�	bytearray�extendr��_pack_uint32�source_mtimer�marshal�dumps�bytes�bytecode�written)rrM�magicr��code_objectrNr	rr�s�

zSourceLoader.__init__cs*||jkrt��|�S||jkr|jSt�rD)rMrJr}rr�OSErrorr~rNr	rr}�s


zSourceLoader.get_datacCs||jkrt�|j|jd�S)N)�mtime�size)rMr�rrr~r	r	r�
path_stats�s
zSourceLoader.path_statscCst|�|j|<||jkSrD)rrr)rrMr�r	r	r�set_data�s
zSourceLoader.set_datarD)	r#r$r%rrr}r%r&rOr	r	rNrr7�s)rr�c@s*eZdZdd�dd�Zdd�Zdd�Zd	S)
�SourceLoaderTestHarnessT�r�cKs�d|_|rtj�|jd�|_|j|_nd}tj�|jd�ddg��|_d�|j|g�|_|j�|j�|_|j|jfi|��|_	dS)NZpkgz__init__.pyr{�.�py)
�package�osrM�joinr9rr�cached�loader_mockr�)rr�r@r�r	r	rrs
zSourceLoaderTestHarness.setUpcCs�|�|j|j�|�|j|j�|�|j|j�|�|j|j�|�|j	|j
�|j�d�}|�|d|j�|�|d|j�|�|d|j�|�|d|j�|�|dt
|j
��dS)Nz::rr���)rdr#r9�__file__rM�
__cached__r.�__package__r+rzr�r�splitry)rr��valuesr	r	r�
verify_module
sz%SourceLoaderTestHarness.verify_modulecCsLt�|j�}|j|_|j|_|j|_|j	|_
g|_t||j
�|�|�dSrD)rrrsr9rMr3r.r4r+r5r�rzr�r�r�r8)rr!r�r	r	r�verify_codesz#SourceLoaderTestHarness.verify_codeN)r#r$r%rr8r9r	r	r	rr'�s
r'c@sHeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dS)�SourceOnlyLoaderTestsz�Test importlib.abc.SourceLoader for source-only loading.

    Reload testing is subsumed by the tests for
    importlib.util.module_for_loader.

    cCs�|jj�d�}|�|j�|j�|�dd�}||j_|�t��}|j�|j�Wd�n1s1wY|�|j	j|j�dS)N�utf-8cSst�rD)r"rr	r	r�
raise_OSError3rz<SourceOnlyLoaderTests.test_get_source.<locals>.raise_OSError)
r�r��decoderdr�r9r}rlrm�	exception)rZexpected_sourcer<�cmr	r	rr�.s�z%SourceOnlyLoaderTests.test_get_sourcecCs\|jdd�|�|j�|j��|jdd�|�|j�|j��|�|j�|jd��dS)NFr(Tz	.__init__)r�assertFalser�r�r9rrr	r	rr�:s
z%SourceOnlyLoaderTests.test_is_packagecC�|j�|j�}|�|�dSrD�r�r�r9r9�rr!r	r	rr�B�z#SourceOnlyLoaderTests.test_get_codecCs"|j�|jj|j�}|�|�dSrD)r�r�r�rMr9)rr�r	r	r�test_source_to_codeGsz)SourceOnlyLoaderTests.test_source_to_codec
Cs�t���ht�dt�t�|j��Ct���t�dt�|j�	|j�}Wd�n1s.wY|�
|�|�|jt
j�|j�g�|�|jtj�Wd�n1sWwYWd�dSWd�dS1sowYdSr�)rtrurv�
ImportWarningr?r�r9rTr�rfr8rdr�r,rM�dirname�assertInr�r�r�r	r	rrnLs

�
��"�z&SourceOnlyLoaderTests.test_load_modulec
Cs�t���at�dt�|jdd�t�|j��6t���t�dt�|j	�
|j�}Wd�n1s4wY|�|�|�t
|d��Wd�n1sPwYWd�dSWd�dS1shwYdS)NrqFr(r�)rtrurvrFrr?r�r9rTr�rfr8r@rr�r	r	r�test_package_settingsZs

�
��"�z+SourceOnlyLoaderTests.test_package_settingscCs\d}|�d�|j_|j�|j�}|�||�d}|�d�|j_|j�|j�}|�||�dS)Nu_ = 'ü'r;u# coding: latin-1
_ = ü�latin-1)�encoder�r�r�r9rd)rr��returned_sourcer	r	r�test_get_source_encodinghsz.SourceOnlyLoaderTests.test_get_source_encodingN)r#r$r%r&r�r�r�rErnrIrMr	r	r	rr:%sr:)rr/zsys.dont_write_bytecode is truecs^eZdZdZdd��fdd�
Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Z�ZS)�SourceLoaderBytecodeTestszsTest importlib.abc.SourceLoader's use of bytecode.

    Source-only testing handled by SourceOnlyLoaderTests.

    F��bytecode_writtencs�t��|�|rM|�|j|jj�t|jj�}|�	|j
�d��|�	|j
�|jj��|�	|j
�|jj
��|�	t�|��|�|jj|jt|��dSdS)Nr)rJr9rHr.r�rrrrrr�rrrrrrdr)rr!rPr�rNr	rr9�s�z%SourceLoaderBytecodeTests.verify_codecCrArDrBrCr	r	r�test_code_with_everything�rDz3SourceLoaderBytecodeTests.test_code_with_everythingcCsld|j_|�t��|j�|j�}|j�|�Wd�n1s!wY|j�|j	�}|j
|dd�dS)N�<does not exist>TrO)r�rrlr"rrrMr}r�r9r9)rrr!r	r	r�test_no_bytecode�s�z*SourceLoaderBytecodeTests.test_no_bytecodecCsVdD]&}|jj}||j_|jjdd�|j_|j�|j�}|j|dd�||j_qdS)N)rr0�TrO)r�rrr�r9r9)rrZoriginalr!r	r	r�test_code_bad_timestamp�s
�z1SourceLoaderBytecodeTests.test_code_bad_timestampcCs@|jdd�|jjdd�|j_|j�|j�}|j|dd�dS)N�0000�r rTTrO)rr�rr�r9r9rCr	r	r�test_code_bad_magic�sz-SourceLoaderBytecodeTests.test_code_bad_magiccCsDzdt_d|j_|j�|j�}|�|j|jj�Wdt_dSdt_w)NTrRF)	r��dont_write_bytecoder�rr�r9ZassertNotInr.rrCr	r	r�test_dont_write_bytecode�sz2SourceLoaderBytecodeTests.test_dont_write_bytecodec	Cst|jdd�|jj��dj}z |jj��d`|j�|j�}|�|�W||jj��d_dS||jj��d_w)NrVrWr)rr�rF�mror&r�r9r9)rZoriginal_set_datar!r	r	r�test_no_set_data�s*z*SourceLoaderBytecodeTests.test_no_set_datacCs<dd�}|jdd�|t�|j_|j�|j�}|�|�dS)Ncs�fdd�}|S)Ncs��rDr	)r�r@��excr	r�closure�rzcSourceLoaderBytecodeTests.test_set_data_raises_exceptions.<locals>.raise_exception.<locals>.closurer	)r^r_r	r]r�raise_exception�szRSourceLoaderBytecodeTests.test_set_data_raises_exceptions.<locals>.raise_exceptionrVrW)rrwr�r&r�r9r9)rr`r!r	r	r�test_set_data_raises_exceptions�s
z9SourceLoaderBytecodeTests.test_set_data_raises_exceptions)
r#r$r%r&r9rQrSrUrXrZr\rarOr	r	rNrrN{s
rN)r�rr/c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�SourceLoaderGetSourceTestsz2Tests for importlib.abc.SourceLoader.get_source().cC�8d}|�d�}d}|�d�|_|�|�}|�||�dS)Nr{�mod.fileux = "ü"r;��SourceOnlyLoaderMockrKr�r�rd�rr9rr�rLr	r	r�test_default_encoding�s

z0SourceLoaderGetSourceTests.test_default_encodingcCrc)Nr{rdu# coding: Latin-1
x='ü'rJrergr	r	r�test_decoded_source�s

z.SourceLoaderGetSourceTests.test_decoded_sourcecCsFd}|�d�}d}|�d�|_t�dd��|�}|�|�|�|�dS)Nr{rdzx = 42
y = -13
r;T)rfrKr��io�IncrementalNewlineDecoderr=rdr�)rr9rr��expectr	r	r�test_universal_newlines�s
z2SourceLoaderGetSourceTests.test_universal_newlinesN)r#r$r%r&rhrirmr	r	r	rrb�s
	
rb)rf�__main__)NF)krjrr,r��testrZtest.supportrrrZunittestrrtr�rr?Zimport_importlibr�rrrr'Z	test_bothZ%Frozen_MetaPathFinderInheritanceTestsZ%Source_MetaPathFinderInheritanceTestsr-Z&Frozen_PathEntryFinderInheritanceTestsZ&Source_PathEntryFinderInheritanceTestsr/Z%Frozen_ResourceLoaderInheritanceTestsZ%Source_ResourceLoaderInheritanceTestsr1Z$Frozen_InspectLoaderInheritanceTestsZ$Source_InspectLoaderInheritanceTestsr3Z&Frozen_ExecutionLoaderInheritanceTestsZ&Source_ExecutionLoaderInheritanceTestsr4Z!Frozen_FileLoaderInheritanceTestsZ!Source_FileLoaderInheritanceTestsr7Z#Frozen_SourceLoaderInheritanceTestsZ#Source_SourceLoaderInheritanceTestsrBrCrQZFrozen_MPFDefaultTestsZSource_MPFDefaultTestsrcZFrozen_PEFDefaultTestsZSource_PEFDefaultTestsr0rgZFrozen_LDefaultTestsZSourceLDefaultTestsrZFrozen_RLDefaultTestsZSource_RLDefaultTestsr�r�ZFrozen_ILDefaultTestsZSource_ILDefaultTestsr�r�ZFrozen_ELDefaultTestsZSource_ELDefaultsTestsr�r�ZFrozen_RRDefaultTestsZSource_RRDefaultsTestsr�ZFrozen_MPFFindModuleTestsZSource_MPFFindModuleTestsr�ZFrozen_PEFFindLoaderTestsZSource_PEFFindLoaderTestsr�ZFrozen_LoaderLoadModuleTestsZSource_LoaderLoadModuleTestsr�ZFrozen_ILSourceToCodeTestsZSource_ILSourceToCodeTestsr�ZFrozen_ILGetCodeTestsZSource_ILGetCodeTestsr�ZFrozen_ILLoadModuleTestsZSource_ILLoadModuleTestsrZFrozen_ELGetCodeTestsZSource_ELGetCodeTestsr
Z	SPLIT_SOLZSPLIT_SLr'r:ZFrozen_SourceOnlyLoaderTestsZSource_SourceOnlyLoaderTestsZskipIfrYrNZFrozen_SLBytecodeTestsZSourceSLBytecodeTestsrbZ%Frozen_SourceOnlyLoaderGetSourceTestsZ%Source_SourceOnlyLoaderGetSourceTestsr#�mainr	r	r	r�<module>s,



$�������
	����	���.�
*��1�,����/��;��
&&R��
[��#��
�