403Webshell
Server IP : 118.27.122.248  /  Your IP : 216.73.216.153
Web Server : Apache
System : Linux web0264.sh.tyo1 4.18.0-553.79.1.lve.el7h.x86_64 #1 SMP Wed Oct 15 16:34:46 UTC 2025 x86_64
User : c9415830 ( 11735)
PHP Version : 8.4.17
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python36/lib64/python3.6/test/test_importlib/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python36/lib64/python3.6/test/test_importlib/__pycache__/test_abc.cpython-36.pyc
3

�w2_�}�@s�ddlZddlZddlZddlZddlZddlZddlmZddlZddl	Z	ddl	m
Z
ddlZddlm
Zejd�Zejd�Zejd�Zejd	�Z
Gd
d�d�ZGdd
�d
e�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)dWdd�Z*Gdd�d�Z+Gd d
�d
�ZGd!d"�d"e+�Z,eje,�\Z-Z.Gd#d�d�ZGd$d%�d%e+�Z/eje/�\Z0Z1Gd&d'�d'�Z2Gd(d)�d)e+�Z3eje3�\Z4Z5Gd*d�de2�ZGd+d,�d,e+�Z6eje6�\Z7Z8Gd-d�de2�Ze*e�Z9Gd.d/�d/e+�Z:eje:�\Z;Z<Gd0d�de�Z!e*e!�Z=Gd1d2�d2e+�Z>eje:�\Z?Z@Gd3d4�d4�ZAejeAee
d5�\ZBZCGd6d7�d7�ZDejeDee
ed8�\ZEZFGd9d:�d:�ZGejeGee
d5�\ZHZIGd;d<�d<�ZJejeJe9d=�\ZKZLGd>d?�d?�ZMejeMe9d=�\ZNZOGd@dA�dA�ZPejePe9ee
dB�\ZQZRGdCdD�dD�ZSejeSe=dE�\ZTZUGdFdG�dG�ZVe*eVd�ZWGdHd�deV�Z'e*e'e
edI�ZXGdJdK�dK�ZYGdLdM�dMeY�ZZejeZe
eWdN�\Z[Z\e	j]ej^dO�GdPdQ�dQeY��Z_eje_ee
eXdR�\Z`ZaGdSdT�dT�ZbejebeWdU�\ZcZdeedVk�r�e	jf�dS)X�N)�support)�mock�)�util�	importlibz
importlib.abczimportlib.machineryzimportlib.utilc@s0eZdZdZgZgZdd�Zdd�Zdd�ZdS)	�InheritanceTestszSTest that the specified class is a subclass/superclass of the expected
    classes.csh�fdd��jD��_t�d�r>�jj��fdd��jD��_�jsT�jsTt�j��t	�j�j
��_dS)Ncsg|]}t�j|��qS�)�getattr�abc)�.0�
class_name)�selfr�A/opt/alt/python36/lib64/python3.6/test/test_importlib/test_abc.py�
<listcomp>sz*InheritanceTests.setUp.<locals>.<listcomp>�subclass_namescsg|]}t�|��qSr)r	)rr)�	machineryrrr(s)�superclass_names�superclasses�hasattrr
rr�
subclasses�AssertionError�	__class__r	Z_NAME�_InheritanceTests__test)r
r)rr
r�setUps


zInheritanceTests.setUpcCs2x,|jD]"}|jt||j�dj||j��qWdS)Nz{0} is not a subclass of {1})r�
assertTrue�
issubclassr�format)r
�subclassrrr�test_subclasses-sz InheritanceTests.test_subclassescCs2x,|jD]"}|jt|j|�dj||j��qWdS)Nz{0} is not a superclass of {1})rrrrr)r
Z
superclassrrr�test_superclasses3sz"InheritanceTests.test_superclassesN)	�__name__�
__module__�__qualname__�__doc__rrrrrrrrrrsrc@seZdZdgZddddgZdS)�MetaPathFinder�Finder�BuiltinImporter�FrozenImporter�
PathFinder�WindowsRegistryFinderN)r r!r"rrrrrrr$:sr$)r
c@seZdZdgZdgZdS)�PathEntryFinderr%�
FileFinderN)r r!r"rrrrrrr*Esr*c@seZdZdgZdS)�ResourceLoader�LoaderN)r r!r"rrrrrr,Osr,c@seZdZdgZdddgZdS)�
InspectLoaderr-r&r'�ExtensionFileLoaderN)r r!r"rrrrrrr.Xsr.c@seZdZdgZdgZdS)�ExecutionLoaderr.r/N)r r!r"rrrrrrr0bsr0c@seZdZddgZddgZdS)�
FileLoaderr,r0�SourceFileLoader�SourcelessFileLoaderN)r r!r"rrrrrrr1lsr1c@seZdZddgZdgZdS)�SourceLoaderr,r0r2N)r r!r"rrrrrrr4vsr4FcsB�dkr|j��fdd�tj�D�}�fdd�tj||f|�D�S)Ncsi|]\}}t|��|�qSr)r	)rZkindZsplitabc)�namerr�
<dictcomp>�sz'make_abc_subclasses.<locals>.<dictcomp>csi|]}�r|�n||j�qSr)�_KIND)r�cls)�instrrr6�s)r r
�items�	test_utilZsplit_frozen)Z
base_classr5r9�kwargs�baser)r9r5r�make_abc_subclasses�s

r>c@seZdZedd��ZdS)�ABCTestHarnesscCs|j|j}|�}||j_|S)N)�SPLITr7r�ins)r
r8rArrrrA�szABCTestHarness.insN)r r!r"�propertyrArrrrr?�sr?cseZdZ�fdd�Z�ZS)r$cst�j||�S)N)�super�find_module)r
�fullname�path)rrrrD�szMetaPathFinder.find_module)r r!r"rD�
__classcell__rr)rrr$�sc@s$eZdZee�Zdd�Zdd�ZdS)�MetaPathFinderDefaultsTestscCs|j|jjdd��dS)N�	something)�assertIsNonerArD)r
rrr�test_find_module�sz,MetaPathFinderDefaultsTests.test_find_modulecCs|jj�dS)N)rA�invalidate_caches)r
rrr�test_invalidate_caches�sz2MetaPathFinderDefaultsTests.test_invalidate_cachesN)r r!r"r>r$r@rKrMrrrrrH�srHcseZdZ�fdd�Z�ZS)r*cst�j|�S)N)rC�find_loader)r
rE)rrrrN�szPathEntryFinder.find_loader)r r!r"rNrGrr)rrr*�sc@s,eZdZee�Zdd�Zdd�Zdd�ZdS)�PathEntryFinderDefaultsTestscCs|jdgf|jjd��dS)NrI)�assertEqualrArN)r
rrr�test_find_loader�sz-PathEntryFinderDefaultsTests.test_find_loadercCs|jd|jjd��dS)NrI)rPrArD)r
rrrrD�sz(PathEntryFinderDefaultsTests.find_modulecCs|jj�dS)N)rArL)r
rrrrM�sz3PathEntryFinderDefaultsTests.test_invalidate_cachesN)	r r!r"r>r*r@rQrDrMrrrrrO�srOcseZdZ�fdd�Z�ZS)r-cst�j|�S)N)rC�load_module)r
rE)rrrrR�szLoader.load_module)r r!r"rRrGrr)rrr-�sr-c@s,eZdZee�Zdd�Zdd�Zdd�ZdS)�LoaderDefaultsTestscCsd}|j|jj|��dS)Nza spec)rJrA�
create_module)r
�specrrr�test_create_module�sz&LoaderDefaultsTests.test_create_modulec	Cs&|jt��|jjd�WdQRXdS)NrI)�assertRaises�ImportErrorrArR)r
rrr�test_load_module�sz$LoaderDefaultsTests.test_load_modulec
CsNtjd�}|jt��|jj|�WdQRXt|�}|j|_|jt|��dS)N�blah)	�types�
ModuleTyperW�NotImplementedErrorrA�module_repr�repr�
__loader__r)r
�modZ
original_reprrrr�test_module_repr�s
z$LoaderDefaultsTests.test_module_reprN)	r r!r"r>r-r@rVrYrbrrrrrS�srScseZdZ�fdd�Z�ZS)r,cst�j|�S)N)rC�get_data)r
rF)rrrrc�szResourceLoader.get_data)r r!r"rcrGrr)rrr,�sc@seZdZee�Zdd�ZdS)�ResourceLoaderDefaultsTestsc	Cs&|jt��|jjd�WdQRXdS)Nz
/some/path)rW�IOErrorrArc)r
rrr�
test_get_data�sz)ResourceLoaderDefaultsTests.test_get_dataN)r r!r"r>r,r@rfrrrrrd�srdcs(eZdZ�fdd�Z�fdd�Z�ZS)r.cst�j|�S)N)rC�
is_package)r
rE)rrrrg�szInspectLoader.is_packagecst�j|�S)N)rC�
get_source)r
rE)rrrrhszInspectLoader.get_source)r r!r"rgrhrGrr)rrr.�sc@s eZdZeZdd�Zdd�ZdS)�InspectLoaderDefaultsTestsc	Cs&|jt��|jjd�WdQRXdS)NrZ)rWrXrArg)r
rrr�test_is_package
sz*InspectLoaderDefaultsTests.test_is_packagec	Cs&|jt��|jjd�WdQRXdS)NrZ)rWrXrArh)r
rrr�test_get_sourcesz*InspectLoaderDefaultsTests.test_get_sourceN)r r!r"�SPLIT_ILr@rjrkrrrrri	sricseZdZ�fdd�Z�ZS)r0cst�j|�S)N)rC�get_filename)r
rE)rrrrmszExecutionLoader.get_filename)r r!r"rmrGrr)rrr0sc@seZdZeZdd�ZdS)�ExecutionLoaderDefaultsTestsc	Cs&|jt��|jjd�WdQRXdS)NrZ)rWrXrArm)r
rrr�test_get_filename(sz.ExecutionLoaderDefaultsTests.test_get_filenameN)r r!r"�SPLIT_ELr@rorrrrrn$srnc@s(eZdZedd��Zdd�Zdd�ZdS)�MetaPathFinderFindModuleTestscsG�fdd�d|jj�}|�S)NcseZdZd�fdd�	ZdS)z@MetaPathFinderFindModuleTests.finder.<locals>.MetaPathSpecFinderNcs||f|_�S)N)�
called_for)r
rErF�target)rUrr�	find_spec9s
zJMetaPathFinderFindModuleTests.finder.<locals>.MetaPathSpecFinder.find_spec)N)r r!r"rtr)rUrr�MetaPathSpecFinder7sru)r
r$)r8rUrur)rUr�finder5sz$MetaPathFinderFindModuleTests.findercCsV|jd�}dddg}d}|j||�}|j|�|j||jd�|j||jd�dS)N�a�b�crZrr)rvrDrJrPrr)r
rvrFr5�foundrrr�test_no_spec?s


z*MetaPathFinderFindModuleTests.test_no_speccCs<t�}|jjd|�}|j|�}|jdd�}|j||j�dS)NrZ)�objectr�spec_from_loaderrvrD�assertIs�loader)r
rrUrvrzrrr�	test_specHs

z'MetaPathFinderFindModuleTests.test_specN)r r!r"�classmethodrvr{r�rrrrrq3s
	rq)r
rc@s0eZdZedd��Zdd�Zdd�Zdd�Zd	S)
�PathEntryFinderFindLoaderTestscsG�fdd�d|jj�}|�S)NcseZdZd�fdd�	ZdS)zBPathEntryFinderFindLoaderTests.finder.<locals>.PathEntrySpecFinderNcs
||_�S)N)rr)r
rErs)rUrrrt\szLPathEntryFinderFindLoaderTests.finder.<locals>.PathEntrySpecFinder.find_spec)N)r r!r"rtr)rUrr�PathEntrySpecFinderZsr�)r
r*)r8rUr�r)rUrrvXsz%PathEntryFinderFindLoaderTests.findercCsH|jd�}d}|j|�}|j|d�|jg|d�|j||j�dS)NrZrr)rvrNrJrPrr)r
rvr5rzrrrr{bs

z+PathEntryFinderFindLoaderTests.test_no_speccCs>t�}|jjd|�}|j|�}|jd�}|j|d|j�dS)NrZr)r|rr}rvrNr~r)r
rrUrvrzrrr�test_spec_with_loaderjs


z4PathEntryFinderFindLoaderTests.test_spec_with_loadercCsT|jjdd�}dddg}||_|j|�}|jd�}|j|d�|j||d�dS)NrZrwrxryrr)r�
ModuleSpec�submodule_search_locationsrvrNrJrP)r
rU�pathsrvrzrrr�test_spec_with_portionsqs


z6PathEntryFinderFindLoaderTests.test_spec_with_portionsN)r r!r"r�rvr{r�r�rrrrr�Vs
r�)r
rrc@s$eZdZdd�Zdd�Zdd�ZdS)�LoaderLoadModuleTestscCsGdd�d|jj�}|�S)Nc@s eZdZdZdd�Zdd�ZdS)z0LoaderLoadModuleTests.loader.<locals>.SpecLoaderNcSs
||_dS)N)rz)r
�modulerrr�exec_module�sz<LoaderLoadModuleTests.loader.<locals>.SpecLoader.exec_modulecSsdS)z.Force some non-default module state to be set.Tr)r
rErrrrg�sz;LoaderLoadModuleTests.loader.<locals>.SpecLoader.is_package)r r!r"rzr�rgrrrr�
SpecLoader�sr�)r
r-)r
r�rrrr�s	zLoaderLoadModuleTests.loaderc
Cs�|j�}d}tj|��(|j|�|j}|jtj||�WdQRX|j||j	�|j||j
j�|j||j�|j||j
j�|j
|j�|j
|j|j
j�dS)NrZ)rr;�uncacherRrzr~�sys�modulesrPr`�__spec__r r5ZassertIsNotNone�__path__r�)r
rr5r�rrr�
test_fresh�s
z LoaderLoadModuleTests.test_freshcCs�d}|j�}tj|�}|jj||�|_||_tj|��D|t	j
|<|j|�|j}|j
|t	j
|�|j
|t	j
|�WdQRXdS)NrZ)rr[r\rr}r�r`r;r�r�r�rRrzr~)r
r5rr�rzrrr�test_reload�s


z!LoaderLoadModuleTests.test_reloadN)r r!r"rr�r�rrrrr��sr�c@s6eZdZddd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�InspectLoaderSourceToCodeTestsNcCsBtjd�}|j�}|dkr&|j|�}n|j||�}t||j�|S)z!Help with source_to_code() tests.rZN)r[r\�InspectLoaderSubclass�source_to_code�exec�__dict__)r
�datarFr�r�coderrr�source_to_module�s
z/InspectLoaderSourceToCodeTests.source_to_modulecCs0d}|j|�}|jt|d��|j|jd�dS)Nz	attr = 42�attr�*)r�rrrPr�)r
�sourcer�rrr�test_source_to_code_source�s
z9InspectLoaderSourceToCodeTests.test_source_to_code_sourcecCs0d}|j|�}|jt|d��|j|jd�dS)Ns	attr = 42r�r�)r�rrrPr�)r
r�r�rrr�test_source_to_code_bytes�s
z8InspectLoaderSourceToCodeTests.test_source_to_code_bytescCs*d}|j�}|jd|�}|j|j|�dS)Nzpath/to/somewhere�)r�r�rP�co_filename)r
rFrr�rrr�test_source_to_code_path�sz7InspectLoaderSourceToCodeTests.test_source_to_code_pathcCs$|j�}|jd�}|j|jd�dS)Nr�z<string>)r�r�rPr�)r
rr�rrr�test_source_to_code_no_path�s
z:InspectLoaderSourceToCodeTests.test_source_to_code_no_path)N)r r!r"r�r�r�r�r�rrrrr��s

r�)r�c@s$eZdZdd�Zdd�Zdd�ZdS)�InspectLoaderGetCodeTestsc
Cs\tjd�}tjj|jd��}d|_|j�}|jd�}WdQRXt||j	�|j
|jd�dS)NrZrhz	attr = 42r�)r[r\r�patchr|r��return_value�get_coder�r�rPr�)r
r��mockedrr�rrr�
test_get_code�s
z'InspectLoaderGetCodeTests.test_get_codec	CsBtjj|jd��}d|_|j�}|jd�}WdQRX|j|�dS)NrhrZ)rr�r|r�r�r�rJ)r
r�rr�rrr�test_get_code_source_is_None�s
z6InspectLoaderGetCodeTests.test_get_code_source_is_Nonec	Cs,|j�}|jt��|jd�WdQRXdS)NrZ)r�rWrXr�)r
rrrr�test_get_code_source_not_found�sz8InspectLoaderGetCodeTests.test_get_code_source_not_foundN)r r!r"r�r�r�rrrrr��s
r�c@sDeZdZdZdZdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dS)�InspectLoaderLoadModuleTestsz!Test InspectLoader.load_module().rZcCs tj|j�|jtj|j�dS)N)rZunload�module_nameZ
addCleanup)r
rrrr
sz"InspectLoaderLoadModuleTests.setUpc
Cs>|jj|j|�}tj��tjdt�|jjj	|�SQRXdS)N�ignore)
rr}r��warnings�catch_warnings�simplefilter�DeprecationWarning�init�
_bootstrap�_load_unlocked)r
rrUrrr�loads
z!InspectLoaderLoadModuleTests.loadcCstjj|jd�S)Nr�)rr�r|r�)r
rrr�
mock_get_codesz*InspectLoaderLoadModuleTests.mock_get_codecCsF|j��4}t|_|jt��|j�}|j|�WdQRXWdQRXdS)N)r�rX�side_effectrWr�r�)r
�mocked_get_coderrrr�test_get_code_ImportErrors

z6InspectLoaderLoadModuleTests.test_get_code_ImportErrorcCsF|j��4}d|_|jt��|j�}|j|�WdQRXWdQRXdS)N)r�r�rWrXr�r�)r
r�rrrr�test_get_code_Nones

z/InspectLoaderLoadModuleTests.test_get_code_NonecCsPtddd�}|j��2}||_|j�}|j|�}|j|tj|j�WdQRXdS)Nz	attr = 42z<string>r�)	�compiler�r�r�r�rPr�r�r�)r
r�r�rr�rrr�test_module_returned's

z1InspectLoaderLoadModuleTests.test_module_returnedN)r r!r"r#r�rr�r�r�r�r�rrrrr�sr�)r�r�rc@s<eZdZddd�dd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�ExecutionLoaderGetCodeTestsF)rhrmcCs8d\}}|rtjj|jd�}|r0tjj|jd�}||fS)Nrhrm)NN)rr�r|�ExecutionLoaderSubclass)r
rhrm�source_mock_context�filename_mock_contextrrr�mock_methods<s

z(ExecutionLoaderGetCodeTests.mock_methodsc	Cs�d}|jddd�\}}|�4}|�$}d|_||_|j�}|jd�}WdQRXWdQRX|j|j|�tjd�}t||j	�|j|j
d�dS)Nzblah.pyT)rhrmz	attr = 42rZr�)r�r�r�r�rPr�r[r\r�r�r�)	r
rFr�r��source_mock�	name_mockrr�r�rrrr�Fs
z)ExecutionLoaderGetCodeTests.test_get_codec	CsF|jdd�\}}|�}d|_|j�}|jd�}WdQRX|j|�dS)NT)rhrZ)r�r�r�r�rJ)r
r��_r�rr�rrrr�Tsz8ExecutionLoaderGetCodeTests.test_get_code_source_is_Nonec	Cs,|j�}|jt��|jd�WdQRXdS)NrZ)r�rWrXr�)r
rrrrr�]sz:ExecutionLoaderGetCodeTests.test_get_code_source_not_foundcCs�|jddd�\}}|�4}|�$}d|_t|_|j�}|jd�}WdQRXWdQRX|j|jd�tj	d�}t
||j�|j|jd�dS)NT)rhrmz	attr = 42rZz<string>r�)
r�r�rXr�r�r�rPr�r[r\r�r�r�)r
r�r�r�r�rr�r�rrr�test_get_code_no_pathcs
z1ExecutionLoaderGetCodeTests.test_get_code_no_pathN)r r!r"r�r�r�r�r�rrrrr�:s

	r�)r�c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�SourceOnlyLoadersN_ = '::'.join([__name__, __file__, __cached__, __package__, repr(__loader__)])cCs
||_dS)N)rF)r
rFrrr�__init__�szSourceOnlyLoader.__init__cCs||jkrt�|jS)N)rFrer�)r
rFrrrrc�s
zSourceOnlyLoader.get_datacCs|jS)N)rF)r
rErrrrm�szSourceOnlyLoader.get_filenamecCsdS)Nz<module>r)r
r�rrrr^�szSourceOnlyLoader.module_reprN)r r!r"r�r�rcrmr^rrrrr�zs
r�cs>eZdZdZd�fdd�	Z�fdd�Zdd�Zd	d
�Z�ZS)r4rNcs�t�j|�|jj|j�|_t|j�|_|dkr8|jj	}t
|�}|j|jj
|j��|j|jj
|j��t|j|jddd�}|jtj|��t|�|_i|_dS)Nr�T)�dont_inherit)rCr�r�cache_from_sourcerF�
bytecode_path�lenr��source_size�MAGIC_NUMBER�	bytearray�extendr��_w_long�source_mtimer��marshal�dumps�bytes�bytecode�written)r
rF�magicr��code_object)rrrr��s
zSourceLoader.__init__cs.||jkrt�j|�S||jkr&|jSt�dS)N)rFrCrcr�r��OSError)r
rF)rrrrc�s


zSourceLoader.get_datacCs||jkrt�|j|jd�S)N)�mtime�size)rFrer�r�)r
rFrrr�
path_stats�s
zSourceLoader.path_statscCst|�|j|<||jkS)N)r�r�r�)r
rFr�rrr�set_data�szSourceLoader.set_data)N)	r r!r"r�r�rcr�r�rGrr)rrr4�s
)rr�c@s*eZdZdd�dd�Zdd�Zdd�Zd	S)
�SourceLoaderTestHarnessT)rgcKs~d|_|r&tjj|jd�|_|j|_n2d}tjj|jdjddg��|_dj|j|g�|_|jj|j�|_|j|jf|�|_	dS)NZpkgz__init__.pyra�.�py)
�package�osrF�joinr5rr��cached�loader_mockr)r
rgr<r�rrrr�s
zSourceLoaderTestHarness.setUpcCs�|j|j|j�|j|j|j�|j|j|j�|j|j|j�|j|j	|j
�|jjd�}|j|d|j�|j|d|j�|j|d|j�|j|d|j�|j|dt
|j
��dS)Nz::rr���)rPr r5�__file__rF�
__cached__r��__package__r�r`rr��splitr_)r
r��valuesrrr�
verify_module�sz%SourceLoaderTestHarness.verify_modulecCsLtj|j�}|j|_|j|_|j|_|j	|_
g|_t||j
�|j|�dS)N)r[r\r5rFr�r�r�r�r�rr`r�r�r�r�)r
r�r�rrr�verify_code�sz#SourceLoaderTestHarness.verify_codeN)r r!r"rr�r�rrrrr��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.

    c
Csn|jjjd�}|j|jj|j�|�dd�}||j_|jt��}|jj|j�WdQRX|j|j	j|j�dS)Nzutf-8cSst�dS)N)r�)rFrrr�
raise_OSError�sz<SourceOnlyLoaderTests.test_get_source.<locals>.raise_OSError)
rr��decoderPrhr5rcrWrXZ	exception)r
Zexpected_sourcer��cmrrrrk�sz%SourceOnlyLoaderTests.test_get_sourcecCs\|jdd�|j|jj|j��|jdd�|j|jj|j��|j|jj|jd��dS)NF)rgTz	.__init__)r�assertFalserrgr5r)r
rrrrj�s
z%SourceOnlyLoaderTests.test_is_packagecCs|jj|j�}|j|�dS)N)rr�r5r�)r
r�rrrr��sz#SourceOnlyLoaderTests.test_get_codecCs"|jj|jj|j�}|j|�dS)N)rr�r�rFr�)r
r�rrr�test_source_to_codesz)SourceOnlyLoaderTests.test_source_to_codecCs~tj|j��htj�� tjdt�|jj|j�}WdQRX|j	|�|j
|jtj
j|j
�g�|j|jtj�WdQRXdS)Nr�)r;r�r5r�r�r�r�rrRr�rPr�r�rF�dirname�assertInr�r�)r
r�rrrrYs

z&SourceOnlyLoaderTests.test_load_modulecCsp|jdd�tj|j��Ntj�� tjdt�|jj	|j�}WdQRX|j
|�|jt|d��WdQRXdS)NF)rgr�r�)
rr;r�r5r�r�r�r�rrRr�r�r)r
r�rrr�test_package_settingss

z+SourceOnlyLoaderTests.test_package_settingscCs\d}|jd�|j_|jj|j�}|j||�d}|jd�|j_|jj|j�}|j||�dS)Nu_ = 'ü'zutf-8u# coding: latin-1
_ = üzlatin-1)�encoderr�rhr5rP)r
r��returned_sourcerrr�test_get_source_encodingsz.SourceOnlyLoaderTests.test_get_source_encodingN)r r!r"r#rkrjr�r�rYr�r�rrrrr��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�j|�|r�|j|j|jj�t|jj�}|j	|j
j|jj��|j	|j
j|jj
��|j	tj|��|j|jj|jt|��dS)N)rCr�r�r�rr�r�rr�r�r�r�r�r�r�r�rPr�)r
r�r�r�)rrrr�;sz%SourceLoaderBytecodeTests.verify_codecCs|jj|j�}|j|�dS)N)rr�r5r�)r
r�rrr�test_code_with_everythingEsz3SourceLoaderBytecodeTests.test_code_with_everythingcCsXd|j_|jt�� |jj|j�}|jj|�WdQRX|jj|j	�}|j
|dd�dS)Nz<does not exist>T)r�)rr�rWr�rr�rFrcr�r5r�)r
r�r�rrr�test_no_bytecodeJsz*SourceLoaderBytecodeTests.test_no_bytecodecCsjxddD]\}||jjkst�|jj}||j_|jjdd�|j_|jj|j�}|j|dd�||j_qWdS)Nrr��T)r�)rr�)rr�rr�r�r5r�)r
r�Zoriginalr�rrr�test_code_bad_timestampTs
z1SourceLoaderBytecodeTests.test_code_bad_timestampcCs@|jdd�|jjdd�|j_|jj|j�}|j|dd�dS)Ns0000)r�rT)r�)rrr�r�r5r�)r
r�rrr�test_code_bad_magic`sz-SourceLoaderBytecodeTests.test_code_bad_magiccCs@z2dt_d|j_|jj|j�}|j|j|jj�Wddt_XdS)NTz<does not exist>F)	r��dont_write_bytecoderr�r�r5ZassertNotInr�r�)r
r�rrr�test_dont_write_bytecodehsz2SourceLoaderBytecodeTests.test_dont_write_bytecodecCsd|jdd�|jjj�dj}z,|jjj�d`|jj|j�}|j|�Wd||jjj�d_XdS)Ns0000)r�r)rrr�mror�r�r5r�)r
Zoriginal_set_datar�rrr�test_no_set_datassz*SourceLoaderBytecodeTests.test_no_set_datacCs<dd�}|jdd�|t�|j_|jj|j�}|j|�dS)Ncs�fdd�}|S)Ncs��dS)Nr)�argsr<)�excrr�closure�szcSourceLoaderBytecodeTests.test_set_data_raises_exceptions.<locals>.raise_exception.<locals>.closurer)r
rr)r
r�raise_exception�szRSourceLoaderBytecodeTests.test_set_data_raises_exceptions.<locals>.raise_exceptions0000)r�)rr]rr�r�r5r�)r
rr�rrr�test_set_data_raises_exceptions~s
z9SourceLoaderBytecodeTests.test_set_data_raises_exceptions)
r r!r"r#r�rrrrrrr
rGrr)rrr�2s

r�)r�rr�c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�SourceLoaderGetSourceTestsz2Tests for importlib.abc.SourceLoader.get_source().cCs8d}|jd�}d}|jd�|_|j|�}|j||�dS)Nrazmod.fileux = "ü"zutf-8)�SourceOnlyLoaderMockr�r�rhrP)r
r5rr�r�rrr�test_default_encoding�s

z0SourceLoaderGetSourceTests.test_default_encodingcCsPd}|jd�}d}|jd�|jd�ks*t�|jd�|_|j|�}|j||�dS)Nrazmod.fileu# coding: Latin-1
x='ü'zlatin-1zutf-8)rr�rr�rhrP)r
r5rr�r�rrr�test_decoded_source�s

z.SourceLoaderGetSourceTests.test_decoded_sourcecCsFd}|jd�}d}|jd�|_tjdd�j|�}|j|j|�|�dS)Nrazmod.filezx = 42
y = -13
zutf-8T)rr�r��io�IncrementalNewlineDecoderr�rPrh)r
r5rr�Zexpectrrr�test_universal_newlines�s
z2SourceLoaderGetSourceTests.test_universal_newlinesN)r r!r"r#rrrrrrrr�s	
r)r�__main__)NF)g�
contextlib�inspectrr�r�r�Ztestrr[Zunittestrr�r�rr;Zimport_importlibr�r
rrr$Z	test_bothZ%Frozen_MetaPathFinderInheritanceTestsZ%Source_MetaPathFinderInheritanceTestsr*Z&Frozen_PathEntryFinderInheritanceTestsZ&Source_PathEntryFinderInheritanceTestsr,Z%Frozen_ResourceLoaderInheritanceTestsZ%Source_ResourceLoaderInheritanceTestsr.Z$Frozen_InspectLoaderInheritanceTestsZ$Source_InspectLoaderInheritanceTestsr0Z&Frozen_ExecutionLoaderInheritanceTestsZ&Source_ExecutionLoaderInheritanceTestsr1Z!Frozen_FileLoaderInheritanceTestsZ!Source_FileLoaderInheritanceTestsr4Z#Frozen_SourceLoaderInheritanceTestsZ#Source_SourceLoaderInheritanceTestsr>r?rHZFrozen_MPFDefaultTestsZSource_MPFDefaultTestsrOZFrozen_PEFDefaultTestsZSource_PEFDefaultTestsr-rSZFrozen_LDefaultTestsZSourceLDefaultTestsrdZFrozen_RLDefaultTestsZSource_RLDefaultTestsrlriZFrozen_ILDefaultTestsZSource_ILDefaultTestsrprnZFrozen_ELDefaultTestsZSource_ELDefaultsTestsrqZFrozen_MPFFindModuleTestsZSource_MPFFindModuleTestsr�ZFrozen_PEFFindLoaderTestsZSource_PEFFindLoaderTestsr�ZFrozen_LoaderLoadModuleTestsZSource_LoaderLoadModuleTestsr�ZFrozen_ILSourceToCodeTestsZSource_ILSourceToCodeTestsr�ZFrozen_ILGetCodeTestsZSource_ILGetCodeTestsr�ZFrozen_ILLoadModuleTestsZSource_ILLoadModuleTestsr�ZFrozen_ELGetCodeTestsZSource_ELGetCodeTestsr�Z	SPLIT_SOLZSPLIT_SLr�r�ZFrozen_SourceOnlyLoaderTestsZSource_SourceOnlyLoaderTestsZskipIfrr�ZFrozen_SLBytecodeTestsZSourceSLBytecodeTestsrZ%Frozen_SourceOnlyLoaderGetSourceTestsZ%Source_SourceOnlyLoaderGetSourceTestsr �mainrrrr�<module>s�



$
		'
-,/;
%&NZ
#


Youez - 2016 - github.com/yon3zu
LinuXploit