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_lazy.cpython-37.opt-1.pyc
B

��gA�@s�ddlZddlmZddlmZddlZddlZddlZddlmZGdd�d�ZGdd�dej	�Z
Gd	d
�d
ejej�Z
Gdd�dej	�Zed
kr�e��dS)�N)�abc)�util�c@seZdZdd�Zdd�ZdS)�CollectInitcOs||_||_dS)N)�args�kwargs)�selfrr�r	�9/usr/local/lib/python3.7/test/test_importlib/test_lazy.py�__init__
szCollectInit.__init__cCs|S)Nr	)r�moduler	r	r
�exec_moduleszCollectInit.exec_moduleN)�__name__�
__module__�__qualname__rr
r	r	r	r
rsrc@seZdZdd�Zdd�ZdS)�LazyLoaderFactoryTestscCsDtj�t�}|dddd�}|j}|�d|j�|�ddi|j�dS)Nzmodule namezmodule path�kw)r)zmodule namezmodule path)r�
LazyLoader�factoryr�loader�assertEqualrr)rrZlazy_loaderrr	r	r
�	test_inits
z LazyLoaderFactoryTests.test_initc	Cs&|�t��tj�t�WdQRXdS)N)�assertRaises�	TypeErrorrrr�object)rr	r	r
�test_validation sz&LazyLoaderFactoryTests.test_validationN)rrrrrr	r	r	r
rs	rc@s4eZdZdZdZdZd�e�Zd	dd�Zdd�Z	dS)
�TestingImporterZlazy_loader_testZchangedNzattr = 42; __name__ = {!r}cCs ||jkrdSt�|t�|��S)N)�module_namer�spec_from_loaderr)r�name�path�targetr	r	r
�	find_spec-s
zTestingImporter.find_speccCst|j|j�||_dS)N)�exec�source_code�__dict__�loaded)rrr	r	r
r
2szTestingImporter.exec_module)N)
rrrr�mutated_namer&�formatr$r"r
r	r	r	r
r&s

rc@sfeZdZdd�Zddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�LazyLoaderTestsc	Cs$|�t��t�t�WdQRXdS)N)rrrrr)rr	r	r
r9szLazyLoaderTests.test_initNcCsrt�}|dk	r||_t�tjt�|��}|j�|�}|dkrHt�	tj�}||_
|j|_|j�|�|�
|j�|S)N)rr$rrrrr�
create_module�types�
ModuleType�__spec__�
__loader__r
�assertIsNoner&)rr$r�specrr	r	r
�
new_module>szLazyLoaderTests.new_modulec
Cs|t�}t�|j��,tj|gd��t�|j�}WdQRXWdQRX|�|j�|�	|j
|�|�|j�|�	||j�dS)N)�	meta_path)r�	test_util�uncacherZimport_state�	importlib�
import_moduler/r&rr.ZassertIsNotNone)rZimporterrr	r	r
�test_e2eNs zLazyLoaderTests.test_e2ecCs|��}|�tj|j�dS)N)r1rrr'r)rrr	r	r
�test_attr_unchanged[sz#LazyLoaderTests.test_attr_unchangedcCs |��}d|_|�d|j�dS)N�*)r1Znew_attrr)rrr	r	r
�
test_new_attraszLazyLoaderTests.test_new_attrcCs |��}d|_|�d|j�dS)NZbogus)r1rr)rrr	r	r
�test_mutated_preexisting_attrgsz-LazyLoaderTests.test_mutated_preexisting_attrcCs |��}d|_|�d|j�dS)N�)r1�attrr)rrr	r	r
�test_mutated_attrnsz!LazyLoaderTests.test_mutated_attrcCs |��}|`|�t|d��dS)Nr=)r1r=�assertFalse�hasattr)rrr	r	r
�test_delete_eventual_attrusz)LazyLoaderTests.test_delete_eventual_attrcCs |��}|`|�t|d��dS)Nr)r1rr?r@)rrr	r	r
�test_delete_preexisting_attr{sz,LazyLoaderTests.test_delete_preexisting_attrc
CsZt�tj��Dt�tj�}|tjtj<|��}|�	t
d��|jWdQRXWdQRXdS)NZsubstituted)r3r4rrr+r,�sys�modulesr1ZassertRaisesRegex�
ValueErrorr)rZfresh_modulerr	r	r
�test_module_substitution_error�sz.LazyLoaderTests.test_module_substitution_errorc	Cs6t�tj�� |��}|tjtj<|jWdQRXdS)N)r3r4rrr1rCrDr)rrr	r	r
�test_module_already_in_sys�sz*LazyLoaderTests.test_module_already_in_sys)N)rrrrr1r7r8r:r;r>rArBrFrGr	r	r	r
r)7s

r)�__main__)r5rrrCr+Zunittest�r3rZTestCaser�MetaPathFinder�Loaderrr)r�mainr	r	r	r
�<module>s
Y