HEX
Server: LiteSpeed
System: Linux server.nevid-deploma.com 4.18.0-553.111.1.lve.el8.x86_64 #1 SMP Fri Mar 13 13:42:17 UTC 2026 x86_64
User: smilepac (1037)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //opt/cppython/lib/python3.8/test/test_importlib/__pycache__/test_abc.cpython-38.opt-2.pyc
U

/D�gC��@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�;/opt/cppython/lib/python3.8/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@seZdZdgZddddgZdS)�MetaPathFinder�Finder�BuiltinImporter�FrozenImporter�
PathFinder�WindowsRegistryFinderN�r!r"r#rrrrrrr$8s�r$)r
c@seZdZdgZdgZdS)�PathEntryFinderr%�
FileFinderNr*rrrrr+Csr+c@seZdZdgZdS)�ResourceLoader�LoaderN)r!r"r#rrrrrr-Msr-c@seZdZdgZdddgZdS)�
InspectLoaderr.r&r'�ExtensionFileLoaderNr*rrrrr/Vsr/c@seZdZdgZdgZdS)�ExecutionLoaderr/r0Nr*rrrrr1`sr1c@seZdZddgZddgZdS)�
FileLoaderr-r1�SourceFileLoader�SourcelessFileLoaderNr*rrrrr2jsr2c@seZdZddgZdgZdS)�SourceLoaderr-r1r3Nr*rrrrr5tsr5FcsB�dkr|j��fdd�t��D�}�fdd�tj||f|�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)�MetaPathFinderDefaultsTestsc	Cs2|�t��|j�dd�}W5QRX|�|�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)�PathEntryFinderDefaultsTestsc	Cs6|�t��|j�d�}W5QRX|�|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_modulec	Cs&|�t��|j�d�W5QRXdSrN)�assertRaises�ImportErrorrEr]rrrr�test_load_module�sz$LoaderDefaultsTests.test_load_modulec	CsNt�d�}|�t��|j�|�W5QRXt|�}|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)�ResourceLoaderDefaultsTestsc	Cs&|�t��|j�d�W5QRXdS)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)�InspectLoaderDefaultsTestsc	Cs&|�t��|j�d�W5QRXdSre)rbrcrErtrrrr�test_is_packagesz*InspectLoaderDefaultsTests.test_is_packagec	Cs&|�t��|j�d�W5QRXdSre)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)�ExecutionLoaderDefaultsTestsc	Cs&|�t��|j�d�W5QRXdSre)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||�SrB)rG�
open_resource�r�argsr>rKrrr6szResourceReader.open_resourcecst�j||�SrB)rG�
resource_pathr�rKrrr�9szResourceReader.resource_pathcst�j||�SrB)rG�is_resourcer�rKrrr�<szResourceReader.is_resourcecst�j||�SrB)rG�contentsr�rKrrr�?szResourceReader.contents)r!r"r#rr�r�r�rLrrrKrr~4sr~c@s4eZdZee�Zdd�Zdd�Zdd�Zdd�Z	d	S)
�ResourceReaderDefaultsTestsc	Cs&|�t��|j�d�W5QRXdS�NZ
dummy_file)rb�FileNotFoundErrorrErrrrr�test_open_resourceGsz.ResourceReaderDefaultsTests.test_open_resourcec	Cs&|�t��|j�d�W5QRXdSr�)rbr�rEr�rrrr�test_resource_pathKsz.ResourceReaderDefaultsTests.test_resource_pathc	Cs&|�t��|j�d�W5QRXdSr�)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@s(eZdZedd��Zdd�Zdd�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.finderc	Csl|�d�}dddg}d}|�t��|�||�}W5QRX|�|�|�||jd�|�||jd�dS)N�a�b�crfrr)r�rOrPrHrQr[r�)rr�rJr7rSrrr�test_no_spechs


z*MetaPathFinderFindModuleTests.test_no_specc	CsRt�}|j�d|�}|�|�}|�t��|�dd�}W5QRX|�||j�dSre)	�objectr�spec_from_loaderr�rOrPrH�assertIs�loader�rr�r`r�rSrrr�	test_specrs
z'MetaPathFinderFindModuleTests.test_specN)r!r"r#�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
||_�SrBr�)rrIr�r�rrr��szLPathEntryFinderFindLoaderTests.finder.<locals>.PathEntrySpecFinder.find_spec)Nr�rr�rr�PathEntrySpecFinder�sr�)r
r+)r:r`r�rr�rr��sz%PathEntryFinderFindLoaderTests.finderc	Cs^|�d�}d}|�t��|�|�}W5QRX|�|d�|�g|d�|�||j�dS)Nrfrr)r�rOrPrXrQr[r�)rr�r7rSrrrr��s
z+PathEntryFinderFindLoaderTests.test_no_specc	CsTt�}|j�d|�}|�|�}|�t��|�d�}W5QRX|�|d|j�dS)Nrfr)	r�rr�r�rOrPrXr�r�r�rrr�test_spec_with_loader�s
z4PathEntryFinderFindLoaderTests.test_spec_with_loaderc	Csj|j�dd�}dddg}||_|�|�}|�t��|�d�}W5QRX|�|d�|�||d�dS)Nrfr�r�r�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.loaderc	Cs�|��}d}t�|��(|�|�|j}|�tj||�W5QRX|�||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
�z LoaderLoadModuleTests.test_freshc	Cs�d}|��}t�|�}|j�||�|_||_t�|��D|t	j
|<|�|�|j}|�
|t	j
|�|�
|t	j
|�W5QRXdSre)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�}|��}|dkr&|�|�}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_bytes�s
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)�InspectLoaderGetCodeTestsc	Cs\t�d�}tj�|jd��}d|_|��}|�d�}W5QRXt||j	�|�
|jd�dS)Nrfrur�r�)rgrhr�patchr�r��return_value�get_coder�r�r[r�)rr��mockedr�r�rrr�
test_get_codes
z'InspectLoaderGetCodeTests.test_get_codec	CsBtj�|jd��}d|_|��}|�d�}W5QRX|�|�dS)Nrurf)rr�r�r�r�r�rQ)rr�r�r�rrr�test_get_code_source_is_Nones
z6InspectLoaderGetCodeTests.test_get_code_source_is_Nonec	Cs,|��}|�t��|�d�W5QRXdSre)r�rbrcr��rr�rrr�test_get_code_source_not_found%s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
addCleanuprrrrr8sz"InspectLoaderLoadModuleTests.setUpc
CsJ|j�|j|�}t���(t�dt�|jj�	|�W5QR�SQRXdS�N�ignore)
rr�r��warnings�catch_warnings�simplefilterrP�init�
_bootstrap�_load_unlocked)rr�r`rrr�load<s
z!InspectLoaderLoadModuleTests.loadcCstj�|jd�S)Nr�)rr�r�r�rrrr�
mock_get_codeBsz*InspectLoaderLoadModuleTests.mock_get_codec
CsF|���4}t|_|�t��|��}|�|�W5QRXW5QRXdSrB)r�rc�side_effectrbr�r��r�mocked_get_coder�rrr�test_get_code_ImportErrorEs

z6InspectLoaderLoadModuleTests.test_get_code_ImportErrorc
CsF|���4}d|_|�t��|��}|�|�W5QRXW5QRXdSrB)r�r�rbrcr�r�r�rrr�test_get_code_NoneMs

z/InspectLoaderLoadModuleTests.test_get_code_Nonec	CsPtddd�}|���2}||_|��}|�|�}|�|tj|j�W5QRXdS)Nr�r�r�)	�compiler�r�r�r�r[r�r�r�)rr�r�r�r�rrr�test_module_returnedUs

z1InspectLoaderLoadModuleTests.test_module_returnedN)
r!r"r#r�rr�r�r�r�r�rrrrr�2sr�)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_methodsjs
�
�z(ExecutionLoaderGetCodeTests.mock_methodsc	
Cs�d}|jddd�\}}|�4}|�$}d|_||_|��}|�d�}W5QRXW5QRX|�|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�ts�

z)ExecutionLoaderGetCodeTests.test_get_codec	CsF|jdd�\}}|�}d|_|��}|�d�}W5QRX|�|�dS)NT)rurf)r�r�r�r�rQ)rr��_r�r�r�rrrr��sz8ExecutionLoaderGetCodeTests.test_get_code_source_is_Nonec	Cs,|��}|�t��|�d�W5QRXdSre)r�rbrcr�r�rrrr��sz:ExecutionLoaderGetCodeTests.test_get_code_source_not_foundc
Cs�|jddd�\}}|�4}|�$}d|_t|_|��}|�d�}W5QRXW5QRX|�|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�

z1ExecutionLoaderGetCodeTests.test_get_code_no_pathN)r!r"r#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
||_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�|_|dkr8|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)r�rr�)rrJr�rrr�set_data�szSourceLoader.set_data)N)	r!r"r#r�r�rorrrLrrrKrr5�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|jf|�|_	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__r
rlr�r��splitrk)rr��valuesrrr�
verify_module�sz%SourceLoaderTestHarness.verify_modulecCsLt�|j�}|j|_|j|_|j|_|j	|_
g|_t||j
�|�|�dSrB)rgrhr7rJrrrr
rr�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)�SourceOnlyLoaderTestsc	Csn|jj�d�}|�|j�|j�|�dd�}||j_|�t��}|j�|j�W5QRX|�|j	j|j�dS)N�utf-8cSst�dSrB)rr�rrr�
raise_OSErrorsz<SourceOnlyLoaderTests.test_get_source.<locals>.raise_OSError)
r�r��decoder[rur7rorbrc�	exception)rZexpected_sourcer�cmrrrrxsz%SourceOnlyLoaderTests.test_get_sourcecCs\|jdd�|�|j�|j��|jdd�|�|j�|j��|�|j�|jd��dS)NFr
Tz	.__init__)r�assertFalser�rtr7rrrrrrw$s
z%SourceOnlyLoaderTests.test_is_packagecCs|j�|j�}|�|�dSrB�r�r�r7r�rrrrrr�,sz#SourceOnlyLoaderTests.test_get_codecCs"|j�|jj|j�}|�|�dSrB)r�r�r�rJr)rr�rrr�test_source_to_code1sz)SourceOnlyLoaderTests.test_source_to_codec
Cs~t�|j��ht��� t�dt�|j�|j�}W5QRX|�	|�|�
|jtj
�|j
�g�|�|jtj�W5QRXdSr�)r=r�r7r�r�r�rPr�r]rr[r�rrJ�dirname�assertInr�r�r�rrrrd6s

z&SourceOnlyLoaderTests.test_load_modulec
Csp|jdd�t�|j��Nt��� t�dt�|j�	|j�}W5QRX|�
|�|�t|d��W5QRXdS)NFr
r�r�)
rr=r�r7r�r�r�rPr�r]rr"rr�rrr�test_package_settingsBs

z+SourceOnlyLoaderTests.test_package_settingscCs\d}|�d�|j_|j�|j�}|�||�d}|�d�|j_|j�|j�}|�||�dS)Nu_ = 'ü'ru# coding: latin-1
_ = ü�latin-1)�encoder�r�rur7r[)rr��returned_sourcerrr�test_get_source_encodingNs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�r�r�r[r�)rrr/r�rKrrrjsz%SourceLoaderBytecodeTests.verify_codecCs|j�|j�}|�|�dSrBr#r$rrr�test_code_with_everythingusz3SourceLoaderBytecodeTests.test_code_with_everythingc	CsXd|j_|�t�� |j�|j�}|j�|�W5QRX|j�|j	�}|j
|dd�dS)N�<does not exist>Tr.)r�r�rbrrr�rJror�r7r)rr�rrrr�test_no_bytecodezsz*SourceLoaderBytecodeTests.test_no_bytecodecCsVdD]L}|jj}||j_|jjdd�|j_|j�|j�}|j|dd�||j_qdS)N)rr�Tr.)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�rr3Tr.)rr�rr�r7rr$rrr�test_code_bad_magic�sz-SourceLoaderBytecodeTests.test_code_bad_magiccCs@z2dt_d|j_|j�|j�}|�|j|jj�W5dt_XdS)NFTr1)	r��dont_write_bytecoder�r�r�r7ZassertNotInrrr$rrr�test_dont_write_bytecode�sz2SourceLoaderBytecodeTests.test_dont_write_bytecodec	Csd|jdd�|jj��dj}z,|jj��d`|j�|j�}|�|�W5||jj��d_XdS)Nr5r6r)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_exceptionr5r6)rrir�rr�r7r)rr?rrrr�test_set_data_raises_exceptions�s
z9SourceLoaderBytecodeTests.test_set_data_raises_exceptions)r!r"r#rr0r2r4r7r9r;r@rLrrrKrr-as	
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)NrmrBu# coding: Latin-1
x='ü'r)rCrErrr�test_decoded_source�s

z.SourceLoaderGetSourceTests.test_decoded_sourcecCsFd}|�d�}d}|�d�|_t�dd��|�}|�|�|�|�dS)NrmrBzx = 42
y = -13
rT)rDr*r��io�IncrementalNewlineDecoderrr[ru)rr7rr��expectrrr�test_universal_newlines�s
z2SourceLoaderGetSourceTests.test_universal_newlinesN)r!r"r#rFrGrKrrrrrA�s	
rA)rD�__main__)NF)irHr�rr��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_SourceOnlyLoaderTestsZskipIfr8r-ZFrozen_SLBytecodeTestsZSourceSLBytecodeTestsrAZ%Frozen_SourceOnlyLoaderGetSourceTestsZ%Source_SourceOnlyLoaderGetSourceTestsr!�mainrrrr�<module>s&



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