Your IP : 216.73.216.85


Current Path : /opt/alt/python39/lib64/python3.9/test/test_importlib/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/test/test_importlib/__pycache__/test_abc.cpython-39.opt-2.pyc

a

XC?h؅�@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�A/opt/alt/python39/lib64/python3.9/test/test_importlib/test_abc.py�
<listcomp>s�z*InheritanceTests.setUp.<locals>.<listcomp>�subclass_namescsg|]}t�|��qSr�r	r)�	machineryrrr&s�)
�superclass_names�superclasses�hasattrr
rr�
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�subclassrrr�test_subclasses+s
�z InheritanceTests.test_subclassescCs.|jD]"}|�t|j|�d�||j��qdS)Nz{0} is not a superclass of {1})rrrrr)rZ
superclassrrr�test_superclasses1s
�z"InheritanceTests.test_superclassesN)�__name__�
__module__�__qualname__rrrrr rrrrrs
rc@seZdZdgZgd�ZdS)�MetaPathFinder�Finder)�BuiltinImporter�FrozenImporter�
PathFinder�WindowsRegistryFinderN�r!r"r#rrrrrrr$8sr$)r
c@seZdZdgZdgZdS)�PathEntryFinderr%�
FileFinderNr*rrrrr+Csr+c@seZdZdgZdS)�ResourceLoader�LoaderN)r!r"r#rrrrrr-Msr-c@seZdZdgZgd�ZdS)�
InspectLoaderr.)r&r'�ExtensionFileLoaderNr*rrrrr/Vsr/c@seZdZdgZdgZdS)�ExecutionLoaderr/r0Nr*rrrrr1`sr1c@seZdZddgZddgZdS)�
FileLoaderr-r1�SourceFileLoader�SourcelessFileLoaderNr*rrrrr2jsr2c@seZdZddgZdgZdS)�SourceLoaderr-r1r3Nr*rrrrr5tsr5FcsF�dur|j��fdd�t��D�}�fdd�tj||fi|��D�S)Ncsi|]\}}|t|���qSrr)r�kindZsplitabc)�namerr�
<dictcomp>�s�z'make_abc_subclasses.<locals>.<dictcomp>csi|]}|j�r|�n|�qSr)�_KIND)r�cls)�instrrr8�s�)r!r
�items�	test_utilZsplit_frozen)Z
base_classr7r;�kwargs�baser)r;r7r�make_abc_subclasses�s
�
�r@c@seZdZedd��ZdS)�ABCTestHarnesscCs|j|j}|�}||j_|S�N)�SPLITr9�	__class__�ins)rr:rErrrrE�szABCTestHarness.insN)r!r"r#�propertyrErrrrrA�srAcseZdZ�fdd�Z�ZS)r$cst��||�SrB)�super�find_module)r�fullname�path�rDrrrH�szMetaPathFinder.find_module)r!r"r#rH�
__classcell__rrrKrr$�sc@s$eZdZee�Zdd�Zdd�ZdS)�MetaPathFinderDefaultsTestscCsF|�t��|j�dd�}Wd�n1s.0Y|�|�dS�NZ	something)�assertWarns�DeprecationWarningrErH�assertIsNone�r�foundrrr�test_find_module�s,z,MetaPathFinderDefaultsTests.test_find_modulecCs|j��dSrB�rE�invalidate_cachesrrrr�test_invalidate_caches�sz2MetaPathFinderDefaultsTests.test_invalidate_cachesN)r!r"r#r@r$rCrTrWrrrrrM�srMcseZdZ�fdd�Z�ZS)r+cst��|�SrB)rG�find_loader�rrIrKrrrX�szPathEntryFinder.find_loader)r!r"r#rXrLrrrKrr+�sc@s,eZdZee�Zdd�Zdd�Zdd�ZdS)�PathEntryFinderDefaultsTestscCsJ|�t��|j�d�}Wd�n1s,0Y|�|dgf�dSrN)rOrPrErX�assertEqualrRrrr�test_find_loader�s*z-PathEntryFinderDefaultsTests.test_find_loadercCs|�d|j�d��dSrN)r[rErHrrrrrH�sz(PathEntryFinderDefaultsTests.find_modulecCs|j��dSrBrUrrrrrW�sz3PathEntryFinderDefaultsTests.test_invalidate_cachesN)	r!r"r#r@r+rCr\rHrWrrrrrZ�srZcseZdZ�fdd�Z�ZS)r.cst��|�SrB)rG�load_modulerYrKrrr]�szLoader.load_module)r!r"r#r]rLrrrKrr.�sr.c@s,eZdZee�Zdd�Zdd�Zdd�ZdS)�LoaderDefaultsTestscCsd}|�|j�|��dS)Nza spec)rQrE�
create_module)r�specrrr�test_create_module�sz&LoaderDefaultsTests.test_create_modulecCs:|�t��|j�d�Wd�n1s,0YdSrN)�assertRaises�ImportErrorrEr]rrrr�test_load_module�sz$LoaderDefaultsTests.test_load_modulecCsbt�d�}|�t��|j�|�Wd�n1s60Yt|�}|j|_|�t|��dS�N�blah)	�types�
ModuleTyperb�NotImplementedErrorrE�module_repr�repr�
__loader__r)r�modZ
original_reprrrr�test_module_repr�s
*z$LoaderDefaultsTests.test_module_reprN)	r!r"r#r@r.rCrardrnrrrrr^�sr^cseZdZ�fdd�Z�ZS)r-cst��|�SrB)rG�get_data�rrJrKrrro�szResourceLoader.get_data)r!r"r#rorLrrrKrr-�sc@seZdZee�Zdd�ZdS)�ResourceLoaderDefaultsTestscCs:|�t��|j�d�Wd�n1s,0YdS)Nz
/some/path)rb�IOErrorrErorrrr�
test_get_data�sz)ResourceLoaderDefaultsTests.test_get_dataN)r!r"r#r@r-rCrsrrrrrq�srqcs(eZdZ�fdd�Z�fdd�Z�ZS)r/cst��|�SrB)rG�
is_packagerYrKrrrtszInspectLoader.is_packagecst��|�SrB)rG�
get_sourcerYrKrrruszInspectLoader.get_source)r!r"r#rtrurLrrrKrr/�sc@s eZdZeZdd�Zdd�ZdS)�InspectLoaderDefaultsTestscCs:|�t��|j�d�Wd�n1s,0YdSre)rbrcrErtrrrr�test_is_packagesz*InspectLoaderDefaultsTests.test_is_packagecCs:|�t��|j�d�Wd�n1s,0YdSre)rbrcrErurrrr�test_get_sourcesz*InspectLoaderDefaultsTests.test_get_sourceN)r!r"r#�SPLIT_ILrCrwrxrrrrrvsrvcseZdZ�fdd�Z�ZS)r1cst��|�SrB)rG�get_filenamerYrKrrrzszExecutionLoader.get_filename)r!r"r#rzrLrrrKrr1sc@seZdZeZdd�ZdS)�ExecutionLoaderDefaultsTestscCs:|�t��|j�d�Wd�n1s,0YdSre)rbrcrErzrrrr�test_get_filename*sz.ExecutionLoaderDefaultsTests.test_get_filenameN)r!r"r#�SPLIT_ELrCr|rrrrr{&sr{cs@eZdZ�fdd�Z�fdd�Z�fdd�Z�fdd�Z�ZS)	�ResourceReadercst�j|i|��SrB)rG�
open_resource�r�argsr>rKrrr6szResourceReader.open_resourcecst�j|i|��SrB)rG�
resource_pathr�rKrrr�9szResourceReader.resource_pathcst�j|i|��SrB)rG�is_resourcer�rKrrr�<szResourceReader.is_resourcecst�j|i|��SrB)rG�contentsr�rKrrr�?szResourceReader.contents)r!r"r#rr�r�r�rLrrrKrr~4sr~c@s4eZdZee�Zdd�Zdd�Zdd�Zdd�Z	d	S)
�ResourceReaderDefaultsTestscCs:|�t��|j�d�Wd�n1s,0YdS�NZ
dummy_file)rb�FileNotFoundErrorrErrrrr�test_open_resourceGsz.ResourceReaderDefaultsTests.test_open_resourcecCs:|�t��|j�d�Wd�n1s,0YdSr�)rbr�rEr�rrrr�test_resource_pathKsz.ResourceReaderDefaultsTests.test_resource_pathcCs:|�t��|j�d�Wd�n1s,0YdSr�)rbr�rEr�rrrr�test_is_resourceOsz,ResourceReaderDefaultsTests.test_is_resourcecCs|�gt|j����dSrB)r[�listrEr�rrrr�
test_contentsSsz)ResourceReaderDefaultsTests.test_contentsN)
r!r"r#r@r~rCr�r�r�r�rrrrr�Cs
r�c@s8eZdZedd��Zdd�Zdd�Zdd�Zd	d
�ZdS)�MetaPathFinderFindModuleTestscsG�fdd�d|jj�}|�S)NcseZdZd�fdd�	ZdS)z@MetaPathFinderFindModuleTests.finder.<locals>.MetaPathSpecFinderNcs||f|_�SrB��
called_for)rrIrJ�target�r`rr�	find_specbs
zJMetaPathFinderFindModuleTests.finder.<locals>.MetaPathSpecFinder.find_spec)N�r!r"r#r�rr�rr�MetaPathSpecFinder`sr�)r
r$)r:r`r�rr�r�finder^sz$MetaPathFinderFindModuleTests.findercCsZ|�d�}gd�}d}|�t��|�||�}Wd�n1sB0Y|�|�dS)N��a�b�crf)r�rOrPrHrQ�rr�rJr7rSrrrrThs
*z.MetaPathFinderFindModuleTests.test_find_modulecCs<t�}|j�d|�}|�|�}|�ddd�}|�||�dSre)�objectr�spec_from_loaderr�r�r[�r�loaderr`r�rSrrr�#test_find_spec_with_explicit_targetps

zAMetaPathFinderFindModuleTests.test_find_spec_with_explicit_targetcCsV|�d�}gd�}d}|�||d�}|�|�|�||jd�|�||jd�dS)Nr�rfrr)r�r�rQr[r�r�rrr�test_no_specws

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

z'MetaPathFinderFindModuleTests.test_specN)	r!r"r#�classmethodr�rTr�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
||_�SrBr�)rrIr�r�rrr��szLPathEntryFinderFindLoaderTests.finder.<locals>.PathEntrySpecFinder.find_spec)Nr�rr�rr�PathEntrySpecFinder�sr�)r
r+)r:r`r�rr�rr��sz%PathEntryFinderFindLoaderTests.findercCsr|�d�}d}|�t��|�|�}Wd�n1s80Y|�|d�|�g|d�|�||j�dS)Nrfrr)r�rOrPrXrQr[r�)rr�r7rSrrrr��s
(z+PathEntryFinderFindLoaderTests.test_no_speccCsht�}|j�d|�}|�|�}|�t��|�d�}Wd�n1sH0Y|�|d|j�dS)Nrfr)	r�rr�r�rOrPrXr�r�r�rrr�test_spec_with_loader�s
(z4PathEntryFinderFindLoaderTests.test_spec_with_loadercCs||j�dd�}gd�}||_|�|�}|�t��|�d�}Wd�n1sP0Y|�|d�|�||d�dS)Nrfr�rr)	r�
ModuleSpec�submodule_search_locationsr�rOrPrXrQr[)rr`�pathsr�rSrrr�test_spec_with_portions�s
(z6PathEntryFinderFindLoaderTests.test_spec_with_portionsN)r!r"r#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
||_dSrB)rS�r�modulerrr�exec_module�sz<LoaderLoadModuleTests.loader.<locals>.SpecLoader.exec_modulecSsdS)NTrrYrrrrt�sz;LoaderLoadModuleTests.loader.<locals>.SpecLoader.is_package)r!r"r#rSr�rtrrrr�
SpecLoader�sr�)r
r.)rr�rrrr��s	zLoaderLoadModuleTests.loadercCs�|��}d}t�|��2|�|�|j}|�tj||�Wd�n1sN0Y|�||j	�|�||j
j�|�||j�|�||j
j�|�
|j�|�
|j|j
j�dSre)r�r=�uncacher]rSr��sys�modulesr[rl�__spec__r!r7ZassertIsNotNone�__path__r�)rr�r7r�rrr�
test_fresh�s
0�z LoaderLoadModuleTests.test_freshcCs�d}|��}t�|�}|j�||�|_||_t�|��N|t	j
|<|�|�|j}|�
|t	j
|�|�
|t	j
|�Wd�n1s�0YdSre)r�rgrhrr�r�rlr=r�r�r�r]rSr�)rr7r�r�rSrrr�test_reload�s


z!LoaderLoadModuleTests.test_reloadN)r!r"r#r�r�r�rrrrr��sr�c@s6eZdZddd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�InspectLoaderSourceToCodeTestsNcCsBt�d�}|��}|dur&|�|�}n|�||�}t||j�|Sre)rgrh�InspectLoaderSubclass�source_to_code�exec�__dict__)r�datarJr�r��coderrr�source_to_module�s
z/InspectLoaderSourceToCodeTests.source_to_modulecCs0d}|�|�}|�t|d��|�|jd�dS)N�	attr = 42�attr�*�r�rrr[r��r�sourcer�rrr�test_source_to_code_source�s
z9InspectLoaderSourceToCodeTests.test_source_to_code_sourcecCs0d}|�|�}|�t|d��|�|jd�dS)Ns	attr = 42r�r�r�r�rrr�test_source_to_code_bytess
z8InspectLoaderSourceToCodeTests.test_source_to_code_bytescCs*d}|��}|�d|�}|�|j|�dS)Nzpath/to/somewhere��r�r�r[�co_filename)rrJr�r�rrr�test_source_to_code_path	sz7InspectLoaderSourceToCodeTests.test_source_to_code_pathcCs$|��}|�d�}|�|jd�dS)Nr��<string>r�)rr�r�rrr�test_source_to_code_no_paths
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)�InspectLoaderGetCodeTestscCspt�d�}tj�|jd��(}d|_|��}|�d�}Wd�n1sH0Yt||j	�|�
|jd�dS)Nrfrur�r�)rgrhr�patchr�r��return_value�get_coder�r�r[r�)rr��mockedr�r�rrr�
test_get_code s
(z'InspectLoaderGetCodeTests.test_get_codecCsVtj�|jd��(}d|_|��}|�d�}Wd�n1s>0Y|�|�dS)Nrurf)rr�r�r�r�r�rQ)rr�r�r�rrr�test_get_code_source_is_None*s
(z6InspectLoaderGetCodeTests.test_get_code_source_is_NonecCs@|��}|�t��|�d�Wd�n1s20YdSre)r�rbrcr��rr�rrr�test_get_code_source_not_found2sz8InspectLoaderGetCodeTests.test_get_code_source_not_foundN)r!r"r#r�r�r�rrrrr�s
r�c@s@eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)�InspectLoaderLoadModuleTestsrfcCs t�|j�|�tj|j�dSrB)rZunload�module_nameZ
addCleanuprrrrrEsz"InspectLoaderLoadModuleTests.setUpcCsV|j�|j|�}t���*t�dt�|jj�	|�Wd�S1sH0YdS�N�ignore)
rr�r��warnings�catch_warnings�simplefilterrP�init�
_bootstrap�_load_unlocked)rr�r`rrr�loadIs
z!InspectLoaderLoadModuleTests.loadcCstj�|jd�S)Nr�)rr�r�r�rrrr�
mock_get_codeOsz*InspectLoaderLoadModuleTests.mock_get_codec	Csn|���R}t|_|�t��"|��}|�|�Wd�n1sB0YWd�n1s`0YdSrB)r�rc�side_effectrbr�r��r�mocked_get_coder�rrr�test_get_code_ImportErrorRs

z6InspectLoaderLoadModuleTests.test_get_code_ImportErrorc	Csn|���R}d|_|�t��"|��}|�|�Wd�n1sB0YWd�n1s`0YdSrB)r�r�rbrcr�r�r�rrr�test_get_code_NoneZs

z/InspectLoaderLoadModuleTests.test_get_code_NonecCsdtddd�}|���<}||_|��}|�|�}|�|tj|j�Wd�n1sV0YdS)Nr�r�r�)	�compiler�r�r�r�r[r�r�r�)rr�r�r�r�rrr�test_module_returnedbs

z1InspectLoaderLoadModuleTests.test_module_returnedN)
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�rurzcCs8d\}}|rtj�|jd�}|r0tj�|jd�}||fS)N)NNrurz)rr�r��ExecutionLoaderSubclass)rrurz�source_mock_context�filename_mock_contextrrr�mock_methodsws
�
�z(ExecutionLoaderGetCodeTests.mock_methodsc		Cs�d}|jddd�\}}|�R}|�.}d|_||_|��}|�d�}Wd�n1sT0YWd�n1sr0Y|�|j|�t�d�}t||j	�|�|j
d�dS)Nzblah.pyTr�r�rfr�)r�r�r�r�r[r�rgrhr�r�r�)	rrJr�r��source_mock�	name_mockr�r�r�rrrr��s�
F
z)ExecutionLoaderGetCodeTests.test_get_codecCsZ|jdd�\}}|�(}d|_|��}|�d�}Wd�n1sB0Y|�|�dS)NT)rurf)r�r�r�r�rQ)rr��_r�r�r�rrrr��s(z8ExecutionLoaderGetCodeTests.test_get_code_source_is_NonecCs@|��}|�t��|�d�Wd�n1s20YdSre)r�rbrcr�r�rrrr��sz:ExecutionLoaderGetCodeTests.test_get_code_source_not_foundc	Cs�|jddd�\}}|�R}|�.}d|_t|_|��}|�d�}Wd�n1sP0YWd�n1sn0Y|�|jd�t�	d�}t
||j�|�|jd�dS)NTr�r�rfr�r�)
r�r�rcr�r�r�r[r�rgrhr�r�r�)rr�r�r�r�r�r�r�rrr�test_get_code_no_path�s�
F
z1ExecutionLoaderGetCodeTests.test_get_code_no_pathN)r!r"r#r�r�r�r�r�rrrrr�us

	r�)r�c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�SourceOnlyLoadersN_ = '::'.join([__name__, __file__, __cached__, __package__, repr(__loader__)])cCs
||_dSrB�rJrprrr�__init__�szSourceOnlyLoader.__init__cCs||jkrt�|jSrB)rJrrr�rprrrro�s
zSourceOnlyLoader.get_datacCs|jSrBr�rYrrrrz�szSourceOnlyLoader.get_filenamecCsdS)Nz<module>rr�rrrrj�szSourceOnlyLoader.module_reprN)r!r"r#r�r�rorzrjrrrrr��s
r�cs>eZdZdZd�fdd�	Z�fdd�Zdd�Zd	d
�Z�ZS)r5rNcs�t��|�|j�|j�|_t|j�|_|dur8|jj	}t
|�}|�|j�
d��|�|j�
|j��|�|j�
|j��t|j|jddd�}|�t�|��t|�|_i|_dS)Nrr�T)�dont_inherit)rGr�r�cache_from_sourcerJ�
bytecode_path�lenr��source_size�MAGIC_NUMBER�	bytearray�extendr��_pack_uint32�source_mtimer��marshal�dumps�bytes�bytecode�written)rrJ�magicr��code_objectrKrrr��s�
zSourceLoader.__init__cs.||jkrt��|�S||jkr&|jSt�dSrB)rJrGror�r�OSErrorrprKrrro�s


zSourceLoader.get_datacCs||jkrt�|j|jd�S)N)�mtime�size)rJrrr�r�rprrr�
path_stats�s
zSourceLoader.path_statscCst|�|j|<||jkSrB)rrr�)rrJr�rrr�set_data�szSourceLoader.set_data)N)	r!r"r#r�r�ror
rrLrrrKrr5�s
)rr�c@s*eZdZdd�dd�Zdd�Zdd�Zd	S)
�SourceLoaderTestHarnessT�rtcKs�d|_|r&tj�|jd�|_|j|_n2d}tj�|jd�ddg��|_d�|j|g�|_|j�|j�|_|j|jfi|��|_	dS)NZpkgz__init__.pyrm�.�py)
�package�osrJ�joinr7rr��cached�loader_mockr�)rrtr>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���)r[r!r7�__file__rJ�
__cached__r�__package__rrlr�r��splitrk)rr��valuesrrr�
verify_modulesz%SourceLoaderTestHarness.verify_modulecCsLt�|j�}|j|_|j|_|j|_|j	|_
g|_t||j
�|�|�dSrB)rgrhr7rJrrrrrr�rlr�r�r�r)rrr�rrr�verify_codesz#SourceLoaderTestHarness.verify_codeN)r!r"r#rrrrrrrr�s
rc@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�SourceOnlyLoaderTestscCs�|jj�d�}|�|j�|j�|�dd�}||j_|�t��}|j�|j�Wd�n1sb0Y|�|j	j|j�dS)N�utf-8cSst�dSrB)rr�rrr�
raise_OSError*sz<SourceOnlyLoaderTests.test_get_source.<locals>.raise_OSError)
r�r��decoder[rur7rorbrcZ	exception)rZexpected_sourcer!�cmrrrrx%s,z%SourceOnlyLoaderTests.test_get_sourcecCs\|jdd�|�|j�|j��|jdd�|�|j�|j��|�|j�|jd��dS)NFr
Tz	.__init__)r�assertFalser�rtr7rrrrrrw1s
z%SourceOnlyLoaderTests.test_is_packagecCs|j�|j�}|�|�dSrB�r�r�r7r�rrrrrr�9sz#SourceOnlyLoaderTests.test_get_codecCs"|j�|jj|j�}|�|�dSrB)r�r�r�rJr)rr�rrr�test_source_to_code>sz)SourceOnlyLoaderTests.test_source_to_codec	Cs�t�|j���t���*t�dt�|j�|j�}Wd�n1sF0Y|�	|�|�
|jtj
�|j
�g�|�|jtj�Wd�n1s�0YdSr�)r=r�r7r�r�r�rPr�r]rr[r�rrJ�dirname�assertInr�r�r�rrrrdCs
,
z&SourceOnlyLoaderTests.test_load_modulec	Cs�|jdd�t�|j��lt���*t�dt�|j�	|j�}Wd�n1sR0Y|�
|�|�t|d��Wd�n1s�0YdS)NFr
r�r�)
rr=r�r7r�r�r�rPr�r]rr$rr�rrr�test_package_settingsOs
,
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�rur7r[)rr��returned_sourcerrr�test_get_source_encoding[sz.SourceOnlyLoaderTests.test_get_source_encodingN)
r!r"r#rxrwr�r'rdr*r.rrrrrs	r)rrzsys.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)rGrr)rr�rr�rr�r�r�r�r�r�rrr[r)rrr1r�rKrrrwsz%SourceLoaderBytecodeTests.verify_codecCs|j�|j�}|�|�dSrBr%r&rrr�test_code_with_everything�sz3SourceLoaderBytecodeTests.test_code_with_everythingcCsld|j_|�t��*|j�|j�}|j�|�Wd�n1sB0Y|j�|j	�}|j
|dd�dS)N�<does not exist>Tr0)r�r�rbrrr�rJror�r7r)rr�rrrr�test_no_bytecode�s*z*SourceLoaderBytecodeTests.test_no_bytecodecCsVdD]L}|jj}||j_|jjdd�|j_|j�|j�}|j|dd�||j_qdS)N)rr�Tr0)r�r�rr�r7r)rr�Zoriginalrrrr�test_code_bad_timestamp�sz1SourceLoaderBytecodeTests.test_code_bad_timestampcCs@|jdd�|jjdd�|j_|j�|j�}|j|dd�dS)N�0000�rr5Tr0)rr�rr�r7rr&rrr�test_code_bad_magic�sz-SourceLoaderBytecodeTests.test_code_bad_magiccCsFz8dt_d|j_|j�|j�}|�|j|jj�Wdt_ndt_0dS)NTr3F)	r��dont_write_bytecoder�r�r�r7ZassertNotInrrr&rrr�test_dont_write_bytecode�sz2SourceLoaderBytecodeTests.test_dont_write_bytecodec	Csv|jdd�|jj��dj}z>|jj��d`|j�|j�}|�|�W||jj��d_n||jj��d_0dS)Nr7r8r)rr�rD�mrorr�r7r)rZoriginal_set_datarrrr�test_no_set_data�sz*SourceLoaderBytecodeTests.test_no_set_datacCs<dd�}|jdd�|t�|j_|j�|j�}|�|�dS)Ncs�fdd�}|S)Ncs��dSrBr)r�r>��excrr�closure�szcSourceLoaderBytecodeTests.test_set_data_raises_exceptions.<locals>.raise_exception.<locals>.closurer)r?r@rr>r�raise_exception�szRSourceLoaderBytecodeTests.test_set_data_raises_exceptions.<locals>.raise_exceptionr7r8)rrir�rr�r7r)rrArrrr�test_set_data_raises_exceptions�s
z9SourceLoaderBytecodeTests.test_set_data_raises_exceptions)r!r"r#rr2r4r6r9r;r=rBrLrrrKrr/ns	
r/)r�rrc@s$eZdZdd�Zdd�Zdd�ZdS)�SourceLoaderGetSourceTestscCs8d}|�d�}d}|�d�|_|�|�}|�||�dS)Nrm�mod.fileux = "ü"r ��SourceOnlyLoaderMockr,r�rur[�rr7rr�r-rrr�test_default_encoding�s

z0SourceLoaderGetSourceTests.test_default_encodingcCs8d}|�d�}d}|�d�|_|�|�}|�||�dS)NrmrDu# coding: Latin-1
x='ü'r+rErGrrr�test_decoded_source�s

z.SourceLoaderGetSourceTests.test_decoded_sourcecCsFd}|�d�}d}|�d�|_t�dd��|�}|�|�|�|�dS)NrmrDzx = 42
y = -13
r T)rFr,r��io�IncrementalNewlineDecoderr"r[ru)rr7rr�Zexpectrrr�test_universal_newlines�s
z2SourceLoaderGetSourceTests.test_universal_newlinesN)r!r"r#rHrIrLrrrrrC�s	
rC)rF�__main__)NF)irJrrr��testrrgZunittestrr�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_InspectLoaderInheritanceTestsr1Z&Frozen_ExecutionLoaderInheritanceTestsZ&Source_ExecutionLoaderInheritanceTestsr2Z!Frozen_FileLoaderInheritanceTestsZ!Source_FileLoaderInheritanceTestsr5Z#Frozen_SourceLoaderInheritanceTestsZ#Source_SourceLoaderInheritanceTestsr@rArMZFrozen_MPFDefaultTestsZSource_MPFDefaultTestsrZZFrozen_PEFDefaultTestsZSource_PEFDefaultTestsr.r^ZFrozen_LDefaultTestsZSourceLDefaultTestsrqZFrozen_RLDefaultTestsZSource_RLDefaultTestsryrvZFrozen_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_ILLoadModuleTestsr�ZFrozen_ELGetCodeTestsZSource_ELGetCodeTestsr�Z	SPLIT_SOLZSPLIT_SLrrZFrozen_SourceOnlyLoaderTestsZSource_SourceOnlyLoaderTestsZskipIfr:r/ZFrozen_SLBytecodeTestsZSourceSLBytecodeTestsrCZ%Frozen_SourceOnlyLoaderGetSourceTestsZ%Source_SourceOnlyLoaderGetSourceTestsr!�mainrrrr�<module>s&



$�������
	����	���.�*
��-�,����/��;��
&&N��[
��#��