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.opt-2.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�|��_t��K}|jj||jjd|jj�|�d�}t�|�}||_	|jj�
|�|�|j�|�t
|d��|�|j	jd�||��fWd�Wd�S1sWwYWd�dS1sgwYdS)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�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 )rrrr!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_indirectNcCsH|�t��
}|�d�Wd�n1swY|�|jjd�dS)N�	_not_real)�assertRaises�ImportErrorrr�	exceptionr�r�cmrrr�test_unloadablePs�zExecModuleTests.test_unloadable)r�
__module__�__qualname__rr'r-r/r9r;�test_state_after_failurerBrrrrr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__)rrrr3r4r5r6r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)rrI�__path__rJzfor __phello__.%s, %r != %rr rK�rrrr3r4r5r6rrrLr!r"rrrMr�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.r1rHz for __phello__.spam.%s, %r != %rr rKrOrPrrrr/~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!
)
rrrr3r4r5r6rrrLZassertIsrr)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)rrrr3r4r5r6rrrLr7r)rrr8rrrr9�s
��P�zLoaderTests.test_module_reprNc	Cs�t���3t�dt�|�t��}|jj�d�Wd�n1s"wY|�	|j
jd�Wd�dS1s:wYdS)Nr1r<)r3r4r5r6r=r>rrrLrr?rr@rrrrB�s
�"�zLoaderTests.test_unloadable)
rrCrDr'r-r/rQr9rErBrrrrrF\s

rFc@s.eZdZ	dd�Zdd�Zdd�Zdd�Zd	S)
�InspectLoaderTestscCstd}t��+}|jj�|�}t�|�}t||j�|�t	|d��|�
|��d�Wd�dS1s3wYdS)Nrrr )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	rZrrr�test_is_package�s
�z"InspectLoaderTests.test_is_packagec	Cs^dD]*}t|jj|�}|�t��}|d�Wd�n1swY|�|jjd�qdS)N)rSrYr	�	importlib)r"rrr=r>rr?r)rZ	meth_name�methodrArrr�test_failure�s
��zInspectLoaderTests.test_failureN)rrCrDrXr[r]r`rrrrrR�s
rR�__main__)rGrrZimport_importlibrZtest.supportrrZunittestr3rFrZ	test_bothZFrozen_ExecModuleTestsZSource_ExecModuleTestsZFrozen_LoaderTestsZSource_LoaderTestsrRZFrozen_ILTestsZSource_ILTestsr�mainrrrr�<module>s,
M�U�%��