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/frozen/__pycache__/test_loader.cpython-37.opt-1.pyc
B

��g{$�@s�ddlmZddlmZe�d�ZddlmZddlZddlZddl	Z	Gdd�dej
�Zejeed	�\Z
ZGd
d�dej
�Z
eje
ed	�\ZZGdd
�d
�Zejeed	�\ZZedkr�e��dS)�)�abc)�utilzimportlib.machinery�)�captured_stdoutNc@sHeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
Z	dd�Z
d
S)�ExecModuleTestsc
Cs�t�|���t��z}|jj||jjd|jj�|�d�}t�|�}||_	|jj�
|�|�|j�|�t
|d��|�|j	jd�||��fSQRXWdQRXdS)N�frozen)�origin�
is_package�__spec__)r�uncacher�	machinery�
ModuleSpec�FrozenImporterr	�types�
ModuleTyper
�exec_module�
assertTrue�initialized�hasattr�assertEqualr�getvalue)�self�name�stdout�spec�module�r�B/usr/local/lib/python3.7/test/test_importlib/frozen/test_loader.pyrs

zExecModuleTests.exec_modulecCsbd}|�|�\}}d|i}x&|��D]\}}|�t||�|�q$W|�|d�|�t|d��dS)N�	__hello__�__name__z
Hello world!
r
)r�itemsr�getattrrr)rrr�output�check�attr�valuerrr�test_moduleszExecModuleTests.test_modulecCsfd}|�|�\}}d|i}x:|��D].\}}t||�}|�||dj||||d��q$W|�|d�dS)N�
__phello__rz,for {name}.{attr}, {given!r} != {expected!r})rr$�given�expectedz
Hello world!
)rr r!r�format)rrrr"r#r$r%�
attr_valuerrr�test_package%s
zExecModuleTests.test_packagecCs|d}t�d��d|�|�\}}d|i}x:|��D].\}}t||�}|�||dj||||d��q0W|�|d�WdQRXdS)Nz__phello__.spamr'rz*for {name}.{attr}, {given} != {expected!r})rr$r(r)z
Hello world!
)rrrr r!rr*)rrrr"r#r$r%r+rrr�test_lacking_parent1s
z#ExecModuleTests.test_lacking_parentc	CsPd}|�|�\}}t��� t�dt�|jj�|�}WdQRX|�|d�dS)Nr�ignorez<module '__hello__' (frozen)>)	r�warnings�catch_warnings�simplefilter�DeprecationWarningrr�module_reprr)rrrr"�repr_strrrr�test_module_repr>s
z ExecModuleTests.test_module_reprcCs&d}|�|�\}}|�t|�d�dS)Nrz<module '__hello__' (frozen)>)rr�repr)rrrr"rrr�test_module_repr_indirectGs
z)ExecModuleTests.test_module_repr_indirectNc	Cs4|�t��}|�d�WdQRX|�|jjd�dS)N�	_not_real)�assertRaises�ImportErrorrr�	exceptionr)r�cmrrr�test_unloadablePszExecModuleTests.test_unloadable)r�
__module__�__qualname__rr&r,r-r5r7�test_state_after_failurer=rrrrrs	
	r)rc@sHeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
Z	dd�Z
d
S)�LoaderTestscCs�t�d���t���}t��� t�dt�|jj�	d�}WdQRXdd|jjd�}x&|�
�D]\}}|�t||�|�q\W|�|�
�d�|�t|d��WdQRXWdQRXdS)Nrr.�)r�__package__�
__loader__z
Hello world!
�__file__)rrrr/r0r1r2rr�load_moduler rr!r�assertFalser)rrrr#r$r%rrrr&^s
zLoaderTests.test_modulecCs�t�d���t���}t��� t�dt�|jj�	d�}WdQRXddg|jjd�}x6|�
�D]*\}}t||�}|�||d|||f�q^W|�|�
�d�|�t|d��WdQRXWdQRXdS)Nr'r.)rrC�__path__rDzfor __phello__.%s, %r != %rz
Hello world!
rE)rrrr/r0r1r2rrrFr r!rrrGr)rrrr#r$r%r+rrrr,ls

zLoaderTests.test_packagecCs�t�dd���t���}t��� t�dt�|jj�	d�}WdQRXdd|jjd�}x6|�
�D]*\}}t||�}|�||d|||f�q^W|�|�
�d�|�t|d��WdQRXWdQRXdS)Nr'z__phello__.spamr.)rrCrDz for __phello__.spam.%s, %r != %rz
Hello world!
rE)rrrr/r0r1r2rrrFr r!rrrGr)rrrr#r$r%r+rrrr-~s

zLoaderTests.test_lacking_parentcCs�t�d��pt��^}t���.t�dt�|jj�	d�}|jj�	d�}WdQRX|�
||�|�|��d�WdQRXWdQRXdS)Nrr.zHello world!
Hello world!
)
rrrr/r0r1r2rrrFZassertIsrr)rrZmodule1Zmodule2rrr�test_module_reuse�s

zLoaderTests.test_module_reusecCstt�d��`t��Nt���.t�dt�|jj�	d�}|jj�
|�}WdQRX|�|d�WdQRXWdQRXdS)Nrr.z<module '__hello__' (frozen)>)rrrr/r0r1r2rrrFr3r)rrr4rrrr5�s
zLoaderTests.test_module_reprc
CsJt�d��&t��|jj�d�}WdQRXWdQRX|�t|�d�dS)Nrz<module '__hello__' (frozen)>)rrrrrrFrr6)rrrrrr7�s"
z%LoaderTests.test_module_repr_indirectNc	Cs8|�t��}|jj�d�WdQRX|�|jjd�dS)Nr8)r9r:rrrFrr;r)rr<rrrr=�szLoaderTests.test_unloadable)rr>r?r&r,r-rIr5r7r@r=rrrrrA\s
	rAc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�InspectLoaderTestsz7Tests for the InspectLoader methods for FrozenImporter.c	Cs^d}t��J}|jj�|�}t�|�}t||j�|�t	|d��|�
|��d�WdQRXdS)Nrrz
Hello world!
)rrr�get_coderr�exec�__dict__rrrr)rrr�code�modrrr�
test_get_code�s
z InspectLoaderTests.test_get_codecCs|jj�d�}|�|�dS)Nr)rr�
get_sourceZassertIsNone)r�resultrrr�test_get_source�sz"InspectLoaderTests.test_get_sourcecCs8d}x.|D]&\}}|jj�|�}|�t|�|�q
WdS)N))rF)r'T)z__phello__.spamF)rrr	r�bool)rZtest_forrr	rRrrr�test_is_package�sz"InspectLoaderTests.test_is_packagec
CsNxHdD]@}t|jj|�}|�t��}|d�WdQRX|�|jjd�qWdS)N)rKrQr	�	importlib)r!rrr9r:rr;r)rZ	meth_name�methodr<rrr�test_failure�s

zInspectLoaderTests.test_failureN)rr>r?�__doc__rPrSrUrXrrrrrJ�s

rJ�__main__)rBrrZimport_importlibrZtest.supportrrZunittestr/rArZ	test_bothZFrozen_ExecModuleTestsZSource_ExecModuleTestsZFrozen_LoaderTestsZSource_LoaderTestsrJZFrozen_ILTestsZSource_ILTestsr�mainrrrr�<module>s
MY%