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.10/test/test_importlib/frozen/__pycache__/test_loader.cpython-310.pyc
o

�i�#�@s�ddlmZddlmZe�d�ZddlmZddlZddlZddl	Z	Gdd�dej
�Zejeed	�\Z
ZGd
d�dej
�Z
eje
ed	�\ZZGdd
�d
�Zejeed	�\ZZedkrae��dSdS)�)�abc)�utilzimportlib.machinery�)�captured_stdoutNc@sHeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
Z	dd�Z
d
S)�ExecModuleTestsc	Cs�t�|��ft��R}|jj||jjd|jj�|�d�}t�|�}||_	t
|d�r*J�|jj�|�|�|j
�|�t
|d��|�|j	jd�||��fWd�Wd�S1s^wYWd�dS1snwYdS)N�frozen)�origin�
is_package�initialized�__spec__)r�uncacher�	machinery�
ModuleSpec�FrozenImporterr	�types�
ModuleTyper�hasattr�exec_module�
assertTruer
�assertEqualr�getvalue)�self�name�stdout�spec�module�r�C/usr/local/lib/python3.10/test/test_importlib/frozen/test_loader.pyrs
�

R�zExecModuleTests.exec_modulecCs^d}|�|�\}}d|i}|��D]
\}}|�t||�|�q|�|d�|�t|d��dS)N�	__hello__�__name__�
Hello world!
r)r�itemsr�getattrrr)rrr�output�check�attr�valuerrr�test_moduleszExecModuleTests.test_modulecCsbd}|�|�\}}d|i}|��D]\}}t||�}|�||dj||||d��q|�|d�dS)N�
__phello__rz,for {name}.{attr}, {given!r} != {expected!r}�rr%ZgivenZexpectedr )rr!r"r�format�rrrr#r$r%r&�
attr_valuerrr�test_package%s
��zExecModuleTests.test_packagecCs�d}t�d��6|�|�\}}d|i}|��D]\}}t||�}|�||dj||||d��q|�|d�Wd�dS1s@wYdS)N�__phello__.spamr(rz*for {name}.{attr}, {given} != {expected!r}r)r )rrrr!r"rr*r+rrr�test_lacking_parent1s
��"�z#ExecModuleTests.test_lacking_parentcCsdd}|�|�\}}t���t�dt�|jj�|�}Wd�n1s%wY|�|d�dS�Nr�ignore�<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)Nrr2)rr�repr)rrrr#rrr�test_module_repr_indirectGs

�z)ExecModuleTests.test_module_repr_indirectNcCs^|jj�d�dusJ�|�t��
}|�d�Wd�n1s wY|�|jjd�dS)N�	_not_real)	r
r�	find_spec�assertRaises�ImportErrorrr�	exceptionr�r�cmrrr�test_unloadablePs
�zExecModuleTests.test_unloadable)r�
__module__�__qualname__rr'r-r/r9r;�test_state_after_failurerCrrrrrs	
	r)r
c@s@eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdZdd
�Z	dS)�LoaderTestsc
Cs�t�d��ot��S}t���t�dt�|jj�	d�}Wd�n1s&wYdd|jjd�}|�
�D]
\}}|�t||�|�q7|�|�
�d�|�t|d��Wd�n1s_wYWd�dSWd�dS1swwYdS)Nrr1��r�__package__�
__loader__r �__file__)rrrr3r4r5r6r
r�load_moduler!rr"r�assertFalser)rrrr$r%r&rrrr'^s
��P�zLoaderTests.test_modulecCst�d��xt��\}t���t�dt�|jj�	d�}Wd�n1s&wYddg|jjd�}|�
�D]\}}t||�}|�||d|||f�q8|�|�
�d�|�t|d��Wd�n1shwYWd�dSWd�dS1s�wYdS)Nr(r1)rrJ�__path__rKzfor __phello__.%s, %r != %rr rL�rrrr3r4r5r6r
rrMr!r"rrrNr�rrrr$r%r&r,rrrr-ls(
��
��P�zLoaderTests.test_packagecCst�dd��wt��[}t���t�dt�|jj�	d�}Wd�n1s'wYdd|jjd�}|�
�D]\}}t||�}|�||d|||f�q8|�|�
�d�|�t|d��Wd�n1shwYWd�dSWd�dS1s�wYdS)Nr(r.r1rIz for __phello__.spam.%s, %r != %rr rLrPrQrrrr/~s,�
��
��P�zLoaderTests.test_lacking_parentc
Cs�t�d��Zt��>}t���t�dt�|jj�	d�}|jj�	d�}Wd�n1s-wY|�
||�|�|��d�Wd�n1sJwYWd�dSWd�dS1sbwYdS)Nrr1zHello world!
Hello world!
)
rrrr3r4r5r6r
rrMZassertIsrr)rrZmodule1Zmodule2rrr�test_module_reuse�s
�
�P�zLoaderTests.test_module_reusec
Cs�t�d��Rt��6t���t�dt�|jj�	d�}|jj�
|�}Wd�n1s-wY|�|d�Wd�n1sBwYWd�dSWd�dS1sZwYdSr0)rrrr3r4r5r6r
rrMr7r)rrr8rrrr9�s
��P�zLoaderTests.test_module_reprNc	Cs�t���>t�dt�|jj�d�dusJ�|�t��}|jj�	d�Wd�n1s-wY|�
|jjd�Wd�dS1sEwYdS)Nr1r<)
r3r4r5r6r
r�find_moduler>r?rMrr@rrArrrrC�s
�"�zLoaderTests.test_unloadable)
rrDrEr'r-r/rRr9rFrCrrrrrG\s

rGc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�InspectLoaderTestsz7Tests for the InspectLoader methods for FrozenImporter.cCstd}t��+}|jj�|�}t�|�}t||j�|�t	|d��|�
|��d�Wd�dS1s3wYdS)Nrr
r )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_sourcecCs4d}|D]\}}|jj�|�}|�t|�|�qdS)N))rF)r(T)r.F)r
rr	r�bool)rZtest_forrr	r\rrr�test_is_package�s
�z"InspectLoaderTests.test_is_packagec	Cs^dD]*}t|jj|�}|�t��}|d�Wd�n1swY|�|jjd�qdS)N)rUr[r	�	importlib)r"r
rr>r?rr@r)rZ	meth_name�methodrBrrr�test_failure�s
��zInspectLoaderTests.test_failureN)rrDrE�__doc__rZr]r_rbrrrrrT�s
rT�__main__)rHrrZimport_importlibr
Ztest.supportrrZunittestr3rGrZ	test_bothZFrozen_ExecModuleTestsZSource_ExecModuleTestsZFrozen_LoaderTestsZSource_LoaderTestsrTZFrozen_ILTestsZSource_ILTestsr�mainrrrr�<module>s,
M�U�%��