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.7/test/test_importlib/__pycache__/test_abc.cpython-37.opt-2.pyc
B

��g%��@s�ddlZddlZddlZddlZddlmZddlZddlZddlmZddl	Z	ddl
mZe�
d�Ze�
d�Ze�
d�Ze�
d	�ZGd
d�d�ZGdd
�d
e�Zejeed�\ZZGdd�de�Zejeed�\ZZGdd�de�Zejeed�\ZZGdd�de�Zejeed�\ZZGdd�de�Zejeed�\Z Z!Gdd�de�Z"eje"ed�\Z#Z$Gdd�de�Z%eje%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-�\Z.Z/Gd&d'�d'�Z0Gd(d)�d)e)�Z1e�e1�\Z2Z3Gd*d�de0�ZGd+d,�d,e)�Z4e�e4�\Z5Z6Gd-d�de0�Ze(e�Z7Gd.d/�d/e)�Z8e�e8�\Z9Z:Gd0d�de�Ze(e�Z;Gd1d2�d2e)�Z<e�e8�\Z=Z>Gd3d4�d4�Z?Gd5d6�d6e)�Z@e�e@�\ZAZBGd7d8�d8�ZCejeCeed9�\ZDZEGd:d;�d;�ZFejeFeeed<�\ZGZHGd=d>�d>�ZIejeIeed9�\ZJZKGd?d@�d@�ZLejeLe7dA�\ZMZNGdBdC�dC�ZOejeOe7dA�\ZPZQGdDdE�dE�ZRejeRe7eedF�\ZSZTGdGdH�dH�ZUejeUe;dI�\ZVZWGdJdK�dK�ZXe(eXd�ZYGdLd�deX�Z%e(e%eedM�ZZGdNdO�dO�Z[GdPdQ�dQe[�Z\eje\eeYdR�\Z]Z^e�_ej`dS�GdTdU�dUe[��ZaejeaeeeZdV�\ZbZcGdWdX�dX�ZdejedeYdY�\ZeZfegdZk�r�e�h�dS)\�N)�support)�mock�)�util�	importlibz
importlib.abczimportlib.machineryzimportlib.utilc@s,eZdZgZgZdd�Zdd�Zdd�ZdS)�InheritanceTestscsR�fdd��jD��_t�d�r>�jj��fdd��jD��_t�j�j��_	dS)Ncsg|]}t�j|��qS�)�getattr�abc)�.0�
class_name)�selfr�8/usr/local/lib/python3.7/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�
subclassesr	Z_NAME�_InheritanceTests__test)r
r)rr
r�setUps


zInheritanceTests.setUpcCs2x,|jD]"}|�t||j�d�||j��qWdS)Nz{0} is not a subclass of {1})r�
assertTrue�
issubclassr�format)r
�subclassrrr�test_subclasses+sz InheritanceTests.test_subclassescCs2x,|jD]"}|�t|j|�d�||j��qWdS)Nz{0} is not a superclass of {1})rrrrr)r
Z
superclassrrr�test_superclasses1sz"InheritanceTests.test_superclassesN)�__name__�
__module__�__qualname__rrrrrrrrrrs
rc@seZdZdgZddddgZdS)�MetaPathFinder�Finder�BuiltinImporter�FrozenImporter�
PathFinder�WindowsRegistryFinderN)rrr rrrrrrr!8sr!)r
c@seZdZdgZdgZdS)�PathEntryFinderr"�
FileFinderN)rrr rrrrrrr'Csr'c@seZdZdgZdS)�ResourceLoader�LoaderN)rrr rrrrrr)Msr)c@seZdZdgZdddgZdS)�
InspectLoaderr*r#r$�ExtensionFileLoaderN)rrr rrrrrrr+Vsr+c@seZdZdgZdgZdS)�ExecutionLoaderr+r,N)rrr rrrrrrr-`sr-c@seZdZddgZddgZdS)�
FileLoaderr)r-�SourceFileLoader�SourcelessFileLoaderN)rrr rrrrrrr.jsr.c@seZdZddgZdgZdS)�SourceLoaderr)r-r/N)rrr rrrrrrr1tsr1FcsB�dkr|j��fdd�t��D�}�fdd�tj||f|�D�S)Ncsi|]\}}t|��|�qSr)r	)r�kindZsplitabc)�namerr�
<dictcomp>�sz'make_abc_subclasses.<locals>.<dictcomp>csi|]}�r|�n||j�qSr)�_KIND)r�cls)�instrrr4�s)rr
�items�	test_utilZsplit_frozen)Z
base_classr3r7�kwargs�baser)r7r3r�make_abc_subclasses�s

r<c@seZdZedd��ZdS)�ABCTestHarnesscCs|j|j}|�}||j_|S)N)�SPLITr5�	__class__�ins)r
r6r@rrrr@�szABCTestHarness.insN)rrr �propertyr@rrrrr=�sr=cseZdZ�fdd�Z�ZS)r!cst��||�S)N)�super�find_module)r
�fullname�path)r?rrrC�szMetaPathFinder.find_module)rrr rC�
__classcell__rr)r?rr!�sc@s$eZdZee�Zdd�Zdd�ZdS)�MetaPathFinderDefaultsTestsc	Cs2|�t��|j�dd�}WdQRX|�|�dS)N�	something)�assertWarns�DeprecationWarningr@rC�assertIsNone)r
�foundrrr�test_find_module�sz,MetaPathFinderDefaultsTests.test_find_modulecCs|j��dS)N)r@�invalidate_caches)r
rrr�test_invalidate_caches�sz2MetaPathFinderDefaultsTests.test_invalidate_cachesN)rrr r<r!r>rMrOrrrrrG�srGcseZdZ�fdd�Z�ZS)r'cst��|�S)N)rB�find_loader)r
rD)r?rrrP�szPathEntryFinder.find_loader)rrr rPrFrr)r?rr'�sc@s,eZdZee�Zdd�Zdd�Zdd�ZdS)�PathEntryFinderDefaultsTestsc	Cs6|�t��|j�d�}WdQRX|�|dgf�dS)NrH)rIrJr@rP�assertEqual)r
rLrrr�test_find_loader�sz-PathEntryFinderDefaultsTests.test_find_loadercCs|�d|j�d��dS)NrH)rRr@rC)r
rrrrC�sz(PathEntryFinderDefaultsTests.find_modulecCs|j��dS)N)r@rN)r
rrrrO�sz3PathEntryFinderDefaultsTests.test_invalidate_cachesN)	rrr r<r'r>rSrCrOrrrrrQ�srQcseZdZ�fdd�Z�ZS)r*cst��|�S)N)rB�load_module)r
rD)r?rrrT�szLoader.load_module)rrr rTrFrr)r?rr*�sr*c@s,eZdZee�Zdd�Zdd�Zdd�ZdS)�LoaderDefaultsTestscCsd}|�|j�|��dS)Nza spec)rKr@�
create_module)r
�specrrr�test_create_module�sz&LoaderDefaultsTests.test_create_modulec	Cs&|�t��|j�d�WdQRXdS)NrH)�assertRaises�ImportErrorr@rT)r
rrr�test_load_module�sz$LoaderDefaultsTests.test_load_modulec	CsNt�d�}|�t��|j�|�WdQRXt|�}|j|_|�t|��dS)N�blah)	�types�
ModuleTyperY�NotImplementedErrorr@�module_repr�repr�
__loader__r)r
�modZ
original_reprrrr�test_module_repr�s
z$LoaderDefaultsTests.test_module_reprN)	rrr r<r*r>rXr[rdrrrrrU�srUcseZdZ�fdd�Z�ZS)r)cst��|�S)N)rB�get_data)r
rE)r?rrre�szResourceLoader.get_data)rrr rerFrr)r?rr)�sc@seZdZee�Zdd�ZdS)�ResourceLoaderDefaultsTestsc	Cs&|�t��|j�d�WdQRXdS)Nz
/some/path)rY�IOErrorr@re)r
rrr�
test_get_data�sz)ResourceLoaderDefaultsTests.test_get_dataN)rrr r<r)r>rhrrrrrf�srfcs(eZdZ�fdd�Z�fdd�Z�ZS)r+cst��|�S)N)rB�
is_package)r
rD)r?rrriszInspectLoader.is_packagecst��|�S)N)rB�
get_source)r
rD)r?rrrjszInspectLoader.get_source)rrr rirjrFrr)r?rr+�sc@s eZdZeZdd�Zdd�ZdS)�InspectLoaderDefaultsTestsc	Cs&|�t��|j�d�WdQRXdS)Nr\)rYrZr@ri)r
rrr�test_is_packagesz*InspectLoaderDefaultsTests.test_is_packagec	Cs&|�t��|j�d�WdQRXdS)Nr\)rYrZr@rj)r
rrr�test_get_sourcesz*InspectLoaderDefaultsTests.test_get_sourceN)rrr �SPLIT_ILr>rlrmrrrrrksrkcseZdZ�fdd�Z�ZS)r-cst��|�S)N)rB�get_filename)r
rD)r?rrroszExecutionLoader.get_filename)rrr rorFrr)r?rr-sc@seZdZeZdd�ZdS)�ExecutionLoaderDefaultsTestsc	Cs&|�t��|j�d�WdQRXdS)Nr\)rYrZr@ro)r
rrr�test_get_filename*sz.ExecutionLoaderDefaultsTests.test_get_filenameN)rrr �SPLIT_ELr>rqrrrrrp&srpcs@eZdZ�fdd�Z�fdd�Z�fdd�Z�fdd�Z�ZS)	�ResourceReadercst�j||�S)N)rB�
open_resource)r
�argsr:)r?rrrt6szResourceReader.open_resourcecst�j||�S)N)rB�
resource_path)r
rur:)r?rrrv9szResourceReader.resource_pathcst�j||�S)N)rB�is_resource)r
rur:)r?rrrw<szResourceReader.is_resourcecst�j||�S)N)rB�contents)r
rur:)r?rrrx?szResourceReader.contents)rrr rtrvrwrxrFrr)r?rrs4srsc@s4eZdZee�Zdd�Zdd�Zdd�Zdd�Z	d	S)
�ResourceReaderDefaultsTestsc	Cs&|�t��|j�d�WdQRXdS)N�
dummy_file)rY�FileNotFoundErrorr@rt)r
rrr�test_open_resourceGsz.ResourceReaderDefaultsTests.test_open_resourcec	Cs&|�t��|j�d�WdQRXdS)Nrz)rYr{r@rv)r
rrr�test_resource_pathKsz.ResourceReaderDefaultsTests.test_resource_pathc	Cs&|�t��|j�d�WdQRXdS)Nrz)rYr{r@rw)r
rrr�test_is_resourceOsz,ResourceReaderDefaultsTests.test_is_resourcecCs|�gt|j����dS)N)rR�listr@rx)r
rrr�
test_contentsSsz)ResourceReaderDefaultsTests.test_contentsN)
rrr r<rsr>r|r}r~r�rrrrryCs
ryc@s(eZdZedd��Zdd�Zdd�ZdS)�MetaPathFinderFindModuleTestscsG�fdd�d|jj�}|�S)NcseZdZd�fdd�	ZdS)z@MetaPathFinderFindModuleTests.finder.<locals>.MetaPathSpecFinderNcs||f|_�S)N)�
called_for)r
rDrE�target)rWrr�	find_specbs
zJMetaPathFinderFindModuleTests.finder.<locals>.MetaPathSpecFinder.find_spec)N)rrr r�r)rWrr�MetaPathSpecFinder`sr�)r
r!)r6rWr�r)rWr�finder^sz$MetaPathFinderFindModuleTests.finderc	Csl|�d�}dddg}d}|�t��|�||�}WdQRX|�|�|�||jd�|�||jd�dS)N�a�b�cr\rr)r�rIrJrCrKrRr�)r
r�rEr3rLrrr�test_no_spechs


z*MetaPathFinderFindModuleTests.test_no_specc	CsRt�}|j�d|�}|�|�}|�t��|�dd�}WdQRX|�||j�dS)Nr\)	�objectr�spec_from_loaderr�rIrJrC�assertIs�loader)r
r�rWr�rLrrr�	test_specrs
z'MetaPathFinderFindModuleTests.test_specN)rrr �classmethodr�r�r�rrrrr�\s

r�)r
rc@s0eZdZedd��Zdd�Zdd�Zdd�Zd	S)
�PathEntryFinderFindLoaderTestscsG�fdd�d|jj�}|�S)NcseZdZd�fdd�	ZdS)zBPathEntryFinderFindLoaderTests.finder.<locals>.PathEntrySpecFinderNcs
||_�S)N)r�)r
rDr�)rWrrr��szLPathEntryFinderFindLoaderTests.finder.<locals>.PathEntrySpecFinder.find_spec)N)rrr r�r)rWrr�PathEntrySpecFinder�sr�)r
r')r6rWr�r)rWrr��sz%PathEntryFinderFindLoaderTests.finderc	Cs^|�d�}d}|�t��|�|�}WdQRX|�|d�|�g|d�|�||j�dS)Nr\rr)r�rIrJrPrKrRr�)r
r�r3rLrrrr��s
z+PathEntryFinderFindLoaderTests.test_no_specc	CsTt�}|j�d|�}|�|�}|�t��|�d�}WdQRX|�|d|j�dS)Nr\r)	r�rr�r�rIrJrPr�r�)r
r�rWr�rLrrr�test_spec_with_loader�s
z4PathEntryFinderFindLoaderTests.test_spec_with_loaderc	Csj|j�dd�}dddg}||_|�|�}|�t��|�d�}WdQRX|�|d�|�||d�dS)Nr\r�r�r�rr)	r�
ModuleSpec�submodule_search_locationsr�rIrJrPrKrR)r
rW�pathsr�rLrrr�test_spec_with_portions�s

z6PathEntryFinderFindLoaderTests.test_spec_with_portionsN)rrr r�r�r�r�r�rrrrr��s
	r�)r
rrc@s$eZdZdd�Zdd�Zdd�ZdS)�LoaderLoadModuleTestscCsGdd�d|jj�}|�S)Nc@s eZdZdZdd�Zdd�ZdS)z0LoaderLoadModuleTests.loader.<locals>.SpecLoaderNcSs
||_dS)N)rL)r
�modulerrr�exec_module�sz<LoaderLoadModuleTests.loader.<locals>.SpecLoader.exec_modulecSsdS)NTr)r
rDrrrri�sz;LoaderLoadModuleTests.loader.<locals>.SpecLoader.is_package)rrr rLr�rirrrr�
SpecLoader�sr�)r
r*)r
r�rrrr��s	zLoaderLoadModuleTests.loaderc	Cs�|��}d}t�|��(|�|�|j}|�tj||�WdQRX|�||j	�|�||j
j�|�||j�|�||j
j�|�
|j�|�
|j|j
j�dS)Nr\)r�r9�uncacherTrLr��sys�modulesrRrb�__spec__rr3ZassertIsNotNone�__path__r�)r
r�r3r�rrr�
test_fresh�s
z LoaderLoadModuleTests.test_freshc	Cs�d}|��}t�|�}|j�||�|_||_t�|��D|t	j
|<|�|�|j}|�
|t	j
|�|�
|t	j
|�WdQRXdS)Nr\)r�r]r^rr�r�rbr9r�r�r�rTrLr�)r
r3r�r�rLrrr�test_reload�s


z!LoaderLoadModuleTests.test_reloadN)rrr r�r�r�rrrrr��sr�c@s6eZdZddd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�InspectLoaderSourceToCodeTestsNcCsBt�d�}|��}|dkr&|�|�}n|�||�}t||j�|S)Nr\)r]r^�InspectLoaderSubclass�source_to_code�exec�__dict__)r
�datarEr�r��coderrr�source_to_module�s
z/InspectLoaderSourceToCodeTests.source_to_modulecCs0d}|�|�}|�t|d��|�|jd�dS)Nz	attr = 42�attr�*)r�rrrRr�)r
�sourcer�rrr�test_source_to_code_source�s
z9InspectLoaderSourceToCodeTests.test_source_to_code_sourcecCs0d}|�|�}|�t|d��|�|jd�dS)Ns	attr = 42r�r�)r�rrrRr�)r
r�r�rrr�test_source_to_code_bytes�s
z8InspectLoaderSourceToCodeTests.test_source_to_code_bytescCs*d}|��}|�d|�}|�|j|�dS)Nzpath/to/somewhere�)r�r�rR�co_filename)r
rEr�r�rrr�test_source_to_code_path�sz7InspectLoaderSourceToCodeTests.test_source_to_code_pathcCs$|��}|�d�}|�|jd�dS)Nr�z<string>)r�r�rRr�)r
r�r�rrr�test_source_to_code_no_paths
z:InspectLoaderSourceToCodeTests.test_source_to_code_no_path)N)rrr r�r�r�r�r�rrrrr��s

r�)r�c@s$eZdZdd�Zdd�Zdd�ZdS)�InspectLoaderGetCodeTestsc	Cs\t�d�}tj�|jd��}d|_|��}|�d�}WdQRXt||j	�|�
|jd�dS)Nr\rjz	attr = 42r�)r]r^r�patchr�r��return_value�get_coder�r�rRr�)r
r��mockedr�r�rrr�
test_get_codes
z'InspectLoaderGetCodeTests.test_get_codec	CsBtj�|jd��}d|_|��}|�d�}WdQRX|�|�dS)Nrjr\)rr�r�r�r�r�rK)r
r�r�r�rrr�test_get_code_source_is_Nones
z6InspectLoaderGetCodeTests.test_get_code_source_is_Nonec	Cs,|��}|�t��|�d�WdQRXdS)Nr\)r�rYrZr�)r
r�rrr�test_get_code_source_not_found%sz8InspectLoaderGetCodeTests.test_get_code_source_not_foundN)rrr r�r�r�rrrrr�s
r�c@s@eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)�InspectLoaderLoadModuleTestsr\cCs t�|j�|�tj|j�dS)N)rZunload�module_nameZ
addCleanup)r
rrrr8sz"InspectLoaderLoadModuleTests.setUpc	Cs>|j�|j|�}t���t�dt�|jj�	|�SQRXdS)N�ignore)
rr�r��warnings�catch_warnings�simplefilterrJ�init�
_bootstrap�_load_unlocked)r
r�rWrrr�load<s
z!InspectLoaderLoadModuleTests.loadcCstj�|jd�S)Nr�)rr�r�r�)r
rrr�
mock_get_codeBsz*InspectLoaderLoadModuleTests.mock_get_codec
CsF|���4}t|_|�t��|��}|�|�WdQRXWdQRXdS)N)r�rZ�side_effectrYr�r�)r
�mocked_get_coder�rrr�test_get_code_ImportErrorEs

z6InspectLoaderLoadModuleTests.test_get_code_ImportErrorc
CsF|���4}d|_|�t��|��}|�|�WdQRXWdQRXdS)N)r�r�rYrZr�r�)r
r�r�rrr�test_get_code_NoneMs

z/InspectLoaderLoadModuleTests.test_get_code_Nonec	CsPtddd�}|���2}||_|��}|�|�}|�|tj|j�WdQRXdS)Nz	attr = 42z<string>r�)	�compiler�r�r�r�rRr�r�r�)r
r�r�r�r�rrr�test_module_returnedUs

z1InspectLoaderLoadModuleTests.test_module_returnedN)
rrr r�rr�r�r�r�r�rrrrr�2sr�)r�r�rc@s<eZdZddd�dd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�ExecutionLoaderGetCodeTestsF)rjrocCs8d\}}|rtj�|jd�}|r0tj�|jd�}||fS)N)NNrjro)rr�r��ExecutionLoaderSubclass)r
rjro�source_mock_context�filename_mock_contextrrr�mock_methodsjs

z(ExecutionLoaderGetCodeTests.mock_methodsc	
Cs�d}|jddd�\}}|�4}|�$}d|_||_|��}|�d�}WdQRXWdQRX|�|j|�t�d�}t||j	�|�|j
d�dS)Nzblah.pyT)rjroz	attr = 42r\r�)r�r�r�r�rRr�r]r^r�r�r�)	r
rEr�r��source_mock�	name_mockr�r�r�rrrr�ts
z)ExecutionLoaderGetCodeTests.test_get_codec	CsF|jdd�\}}|�}d|_|��}|�d�}WdQRX|�|�dS)NT)rjr\)r�r�r�r�rK)r
r��_r�r�r�rrrr��sz8ExecutionLoaderGetCodeTests.test_get_code_source_is_Nonec	Cs,|��}|�t��|�d�WdQRXdS)Nr\)r�rYrZr�)r
r�rrrr��sz:ExecutionLoaderGetCodeTests.test_get_code_source_not_foundc
Cs�|jddd�\}}|�4}|�$}d|_t|_|��}|�d�}WdQRXWdQRX|�|jd�t�	d�}t
||j�|�|jd�dS)NT)rjroz	attr = 42r\z<string>r�)
r�r�rZr�r�r�rRr�r]r^r�r�r�)r
r�r�r�r�r�r�r�rrr�test_get_code_no_path�s
z1ExecutionLoaderGetCodeTests.test_get_code_no_pathN)rrr r�r�r�r�r�rrrrr�hs

	r�)r�c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�SourceOnlyLoadersN_ = '::'.join([__name__, __file__, __cached__, __package__, repr(__loader__)])cCs
||_dS)N)rE)r
rErrr�__init__�szSourceOnlyLoader.__init__cCs||jkrt�|jS)N)rErgr�)r
rErrrre�s
zSourceOnlyLoader.get_datacCs|jS)N)rE)r
rDrrrro�szSourceOnlyLoader.get_filenamecCsdS)Nz<module>r)r
r�rrrr`�szSourceOnlyLoader.module_reprN)rrr r�r�reror`rrrrr��s
r�cs>eZdZdZd�fdd�	Z�fdd�Zdd�Zd	d
�Z�ZS)r1rNcs�t��|�|j�|j�|_t|j�|_|dkr8|jj	}t
|�}|�|j�
d��|�|j�
|j��|�|j�
|j��t|j|jddd�}|�t�|��t|�|_i|_dS)Nrr�T)�dont_inherit)rBr�r�cache_from_sourcerE�
bytecode_path�lenr��source_size�MAGIC_NUMBER�	bytearray�extendr��_w_long�source_mtimer��marshal�dumps�bytes�bytecode�written)r
rE�magicr��code_object)r?rrr��s
zSourceLoader.__init__cs.||jkrt��|�S||jkr&|jSt�dS)N)rErBrer�r��OSError)r
rE)r?rrre�s


zSourceLoader.get_datacCs||jkrt�|j|jd�S)N)�mtime�size)rErgr�r�)r
rErrr�
path_stats�s
zSourceLoader.path_statscCst|�|j|<||jkS)N)r�r�r�)r
rEr�rrr�set_data�szSourceLoader.set_data)N)	rrr r�r�rer�r�rFrr)r?rr1�s
)rr�c@s*eZdZdd�dd�Zdd�Zdd�Zd	S)
�SourceLoaderTestHarnessT)ricKs~d|_|r&tj�|jd�|_|j|_n2d}tj�|jd�ddg��|_d�|j|g�|_|j�|j�|_|j|jf|�|_	dS)NZpkgz__init__.pyrc�.�py)
�package�osrE�joinr3rr��cached�loader_mockr�)r
rir:r�rrrr�s
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���)rRrr3�__file__rE�
__cached__r��__package__r�rbr�r��splitra)r
r��valuesrrr�
verify_module�sz%SourceLoaderTestHarness.verify_modulecCsLt�|j�}|j|_|j|_|j|_|j	|_
g|_t||j
�|�|�dS)N)r]r^r3rEr�r�r�r�r�r�rbr�r�r�r�)r
r�r�rrr�verify_codesz#SourceLoaderTestHarness.verify_codeN)rrr rr�r�rrrrr��s
r�c@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�SourceOnlyLoaderTestsc	Csn|jj�d�}|�|j�|j�|�dd�}||j_|�t��}|j�|j�WdQRX|�|j	j|j�dS)Nzutf-8cSst�dS)N)r�)rErrr�
raise_OSErrorsz<SourceOnlyLoaderTests.test_get_source.<locals>.raise_OSError)
r�r��decoderRrjr3rerYrZZ	exception)r
Zexpected_sourcer�cmrrrrmsz%SourceOnlyLoaderTests.test_get_sourcecCs\|jdd�|�|j�|j��|jdd�|�|j�|j��|�|j�|jd��dS)NF)riTz	.__init__)r�assertFalser�rir3r)r
rrrrl$s
z%SourceOnlyLoaderTests.test_is_packagecCs|j�|j�}|�|�dS)N)r�r�r3r�)r
r�rrrr�,sz#SourceOnlyLoaderTests.test_get_codecCs"|j�|jj|j�}|�|�dS)N)r�r�r�rEr�)r
r�rrr�test_source_to_code1sz)SourceOnlyLoaderTests.test_source_to_codec
Cs~t�|j��ht��� t�dt�|j�|j�}WdQRX|�	|�|�
|jtj
�|j
�g�|�|jtj�WdQRXdS)Nr�)r9r�r3r�r�r�rJr�rTr�rRr�r�rE�dirname�assertInr�r�)r
r�rrrr[6s

z&SourceOnlyLoaderTests.test_load_modulec
Csp|jdd�t�|j��Nt��� t�dt�|j�	|j�}WdQRX|�
|�|�t|d��WdQRXdS)NF)rir�r�)
rr9r�r3r�r�r�rJr�rTr�rr)r
r�rrr�test_package_settingsBs

z+SourceOnlyLoaderTests.test_package_settingscCs\d}|�d�|j_|j�|j�}|�||�d}|�d�|j_|j�|j�}|�||�dS)Nu_ = 'ü'zutf-8u# coding: latin-1
_ = üzlatin-1)�encoder�r�rjr3rR)r
r��returned_sourcerrr�test_get_source_encodingNsz.SourceOnlyLoaderTests.test_get_source_encodingN)
rrr rmrlr�rr[rrrrrrrs	r)rr�zsys.dont_write_bytecode is truecsZeZdZdd��fdd�
Zdd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
�ZS)�SourceLoaderBytecodeTestsF)�bytecode_writtencs�t��|�|r�|�|j|jj�t|jj�}|�	|j
�d��|�	|j
�|jj��|�	|j
�|jj
��|�	t�|��|�|jj|jt|��dS)Nr)rBr�rr�r�r�r�rr�r�r�r�r�r�r�r�rRr�)r
r�r
r�)r?rrr�jsz%SourceLoaderBytecodeTests.verify_codecCs|j�|j�}|�|�dS)N)r�r�r3r�)r
r�rrr�test_code_with_everythingusz3SourceLoaderBytecodeTests.test_code_with_everythingc	CsXd|j_|�t�� |j�|j�}|j�|�WdQRX|j�|j	�}|j
|dd�dS)Nz<does not exist>T)r
)r�r�rYr�rr�rErer�r3r�)r
r�r�rrr�test_no_bytecodezsz*SourceLoaderBytecodeTests.test_no_bytecodecCsZxTdD]L}|jj}||j_|jjdd�|j_|j�|j�}|j|dd�||j_qWdS)N)rr��T)r
)r�r�r�r�r3r�)r
r�Zoriginalr�rrr�test_code_bad_timestamp�s
z1SourceLoaderBytecodeTests.test_code_bad_timestampcCs@|jdd�|jjdd�|j_|j�|j�}|j|dd�dS)Ns0000)r�rT)r
)rr�r�r�r3r�)r
r�rrr�test_code_bad_magic�sz-SourceLoaderBytecodeTests.test_code_bad_magiccCs@z2dt_d|j_|j�|j�}|�|j|jj�Wddt_XdS)NTz<does not exist>F)	r��dont_write_bytecoder�r�r�r3ZassertNotInr�r�)r
r�rrr�test_dont_write_bytecode�sz2SourceLoaderBytecodeTests.test_dont_write_bytecodec	Csd|jdd�|jj��dj}z,|jj��d`|j�|j�}|�|�Wd||jj��d_XdS)Ns0000)r�r)rr�r?�mror�r�r3r�)r
Zoriginal_set_datar�rrr�test_no_set_data�sz*SourceLoaderBytecodeTests.test_no_set_datacCs<dd�}|jdd�|t�|j_|j�|j�}|�|�dS)Ncs�fdd�}|S)Ncs��dS)Nr)rur:)�excrr�closure�szcSourceLoaderBytecodeTests.test_set_data_raises_exceptions.<locals>.raise_exception.<locals>.closurer)rrr)rr�raise_exception�szRSourceLoaderBytecodeTests.test_set_data_raises_exceptions.<locals>.raise_exceptions0000)r�)rr_r�r�r�r3r�)r
rr�rrr�test_set_data_raises_exceptions�s
z9SourceLoaderBytecodeTests.test_set_data_raises_exceptions)rrr r�rrrrrrrrFrr)r?rras	
r)r�rr�c@s$eZdZdd�Zdd�Zdd�ZdS)�SourceLoaderGetSourceTestscCs8d}|�d�}d}|�d�|_|�|�}|�||�dS)Nrczmod.fileux = "ü"zutf-8)�SourceOnlyLoaderMockr	r�rjrR)r
r3rr�r
rrr�test_default_encoding�s

z0SourceLoaderGetSourceTests.test_default_encodingcCs8d}|�d�}d}|�d�|_|�|�}|�||�dS)Nrczmod.fileu# coding: Latin-1
x='ü'zlatin-1)rr	r�rjrR)r
r3rr�r
rrr�test_decoded_source�s

z.SourceLoaderGetSourceTests.test_decoded_sourcecCsFd}|�d�}d}|�d�|_t�dd��|�}|�|�|�|�dS)Nrczmod.filezx = 42
y = -13
zutf-8T)rr	r��io�IncrementalNewlineDecoderrrRrj)r
r3rr��expectrrr�test_universal_newlines�s
z2SourceLoaderGetSourceTests.test_universal_newlinesN)rrr rrr"rrrrr�s	
r)r�__main__)NF)irr�r�r�Ztestrr]Zunittestrr�r�rr9Zimport_importlibr�r
rrr!Z	test_bothZ%Frozen_MetaPathFinderInheritanceTestsZ%Source_MetaPathFinderInheritanceTestsr'Z&Frozen_PathEntryFinderInheritanceTestsZ&Source_PathEntryFinderInheritanceTestsr)Z%Frozen_ResourceLoaderInheritanceTestsZ%Source_ResourceLoaderInheritanceTestsr+Z$Frozen_InspectLoaderInheritanceTestsZ$Source_InspectLoaderInheritanceTestsr-Z&Frozen_ExecutionLoaderInheritanceTestsZ&Source_ExecutionLoaderInheritanceTestsr.Z!Frozen_FileLoaderInheritanceTestsZ!Source_FileLoaderInheritanceTestsr1Z#Frozen_SourceLoaderInheritanceTestsZ#Source_SourceLoaderInheritanceTestsr<r=rGZFrozen_MPFDefaultTestsZSource_MPFDefaultTestsrQZFrozen_PEFDefaultTestsZSource_PEFDefaultTestsr*rUZFrozen_LDefaultTestsZSourceLDefaultTestsrfZFrozen_RLDefaultTestsZSource_RLDefaultTestsrnrkZFrozen_ILDefaultTestsZSource_ILDefaultTestsrrrpZFrozen_ELDefaultTestsZSource_ELDefaultsTestsrsryZFrozen_RRDefaultTestsZSource_RRDefaultsTestsr�ZFrozen_MPFFindModuleTestsZSource_MPFFindModuleTestsr�ZFrozen_PEFFindLoaderTestsZSource_PEFFindLoaderTestsr�ZFrozen_LoaderLoadModuleTestsZSource_LoaderLoadModuleTestsr�ZFrozen_ILSourceToCodeTestsZSource_ILSourceToCodeTestsr�ZFrozen_ILGetCodeTestsZSource_ILGetCodeTestsr�ZFrozen_ILLoadModuleTestsZSource_ILLoadModuleTestsr�ZFrozen_ELGetCodeTestsZSource_ELGetCodeTestsr�Z	SPLIT_SOLZSPLIT_SLr�rZFrozen_SourceOnlyLoaderTestsZSource_SourceOnlyLoaderTestsZskipIfrrZFrozen_SLBytecodeTestsZSourceSLBytecodeTestsrZ%Frozen_SourceOnlyLoaderGetSourceTestsZ%Source_SourceOnlyLoaderGetSourceTestsr�mainrrrr�<module>s�



$
		!*
-,/;
&&N[
#