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.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���}|jj||jjd|jj�|�d�}t�|�}||_	t
|d�rTt�|jj�|�|�
|j�|�
t
|d��|�|j	jd�||��fSQRXWdQRXdS)N�frozen)�origin�
is_package�initialized�__spec__)r�uncacher�	machinery�
ModuleSpec�FrozenImporterr	�types�
ModuleTyper�hasattr�AssertionError�exec_module�
assertTruer
�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__r z,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(r z*for {name}.{attr}, {given} != {expected!r})rr%r)r*z
Hello world!
)rrrr!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	CsJ|jj�d�dkst�|�t��}|�d�WdQRX|�|jj	d�dS)N�	_not_real)
r
r�find_moduler�assertRaises�ImportErrorrr�	exceptionr)r�cmrrr�test_unloadablePszExecModuleTests.test_unloadable)r �
__module__�__qualname__rr'r-r.r6r8�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__)rrrr0r1r2r3r
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/)r rE�__path__rFzfor __phello__.%s, %r != %rz
Hello world!
rG)rrrr0r1r2r3r
rrHr!r"rrrIr)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/)r rErFz for __phello__.spam.%s, %r != %rz
Hello world!
rG)rrrr0r1r2r3r
rrHr!r"rrrIr)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!
)
rrrr0r1r2r3r
rrHZassertIsrr)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)>)rrrr0r1r2r3r
rrHr4r)rrr5rrrr6�s
zLoaderTests.test_module_reprc
CsJt�d��&t��|jj�d�}WdQRXWdQRX|�t|�d�dS)Nrz<module '__hello__' (frozen)>)rrrr
rrHrr7)rrrrrr8�s"
z%LoaderTests.test_module_repr_indirectNc	CsN|jj�d�dkst�|�t��}|jj�d�WdQRX|�|jj	d�dS)Nr9)
r
rr:rr;r<rHrr=r)rr>rrrr?�szLoaderTests.test_unloadable)r r@rAr'r-r.rKr6r8rBr?rrrrrC\s
	rCc@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)Nrr
z
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	rTrrr�test_is_package�sz"InspectLoaderTests.test_is_packagec
CsNxHdD]@}t|jj|�}|�t��}|d�WdQRX|�|jjd�qWdS)N)rMrSr	�	importlib)r"r
rr;r<rr=r)rZ	meth_name�methodr>rrr�test_failure�s

zInspectLoaderTests.test_failureN)r r@rA�__doc__rRrUrWrZrrrrrL�s

rL�__main__)rDrrZimport_importlibr
Ztest.supportrrZunittestr0rCrZ	test_bothZFrozen_ExecModuleTestsZSource_ExecModuleTestsZFrozen_LoaderTestsZSource_LoaderTestsrLZFrozen_ILTestsZSource_ILTestsr �mainrrrr�<module>s
MY%