Uname:Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64

403WebShell
403Webshell
Server IP : 3.111.61.48  /  Your IP : 216.73.216.67
Web Server : Apache
System : Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64
User : ubuntu ( 1000)
PHP Version : 8.2.31
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3.10/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3.10/test/__pycache__/test_code_module.cpython-310.pyc
o

�9j#�@sxdZddlZddlZddlmZddlmZddlmZddlm	Z	e	�
d�ZGdd	�d	ej�Z
ed
kr:e��dSdS)zCTest InteractiveConsole and InteractiveInterpreter from code module�N)�dedent)�	ExitStack)�mock)�
import_helper�codec@sdeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�TestInteractiveConsolecCst��|_|��dS)N)r�InteractiveConsole�console�mock_sys��self�r
�,/usr/lib/python3.10/test/test_code_module.py�setUps
zTestInteractiveConsole.setUpcCs�t�}|�|j�|�tjddd��|_|�t�d��|_|�t�d��|_tjdt	j
t	j
d�}|�|�|_t
jt
j
urB|jj
|j_|j`|j`dS)	z.Mock system environment for InteractiveConsolez
code.inputT)�createzcode.sys.stdoutzcode.sys.stderrzcode.sys)�wraps�specN)r�
addCleanup�close�
enter_contextr�patch�infunc�stdout�stderrr�sys�sysmod�
excepthook�__excepthook__�ps1�ps2)r�stack�prepatchr
r
rr
s

�
zTestInteractiveConsole.mock_syscCsLtd�|j_|j��|�|jjd�d|j_|j��|�|jjd�dS)N�Finishedz>>> z	custom1> )�EOFErrorr�side_effectr	�interact�assertEqualrrrr
r
r�test_ps1#�

zTestInteractiveConsole.test_ps1cCsLtd�|j_|j��|�|jjd�d|j_|j��|�|jjd�dS)Nr"z... z	custom2> )	r#rr$r	r%r&rrrrr
r
r�test_ps2+r(zTestInteractiveConsole.test_ps2cCsNddtd�g|j_|j��t|jj�D]}dd�|d�vr"dSqt	d��)Nz	'antioch'�r"�antioch�zno console stdout)
r#rr$r	r%�listr�method_calls�join�AssertionError�r�callr
r
r�test_console_stderr3s
�z*TestInteractiveConsole.test_console_stderrcCsHdtd�g|j_|j��|jjD]}dd�|d�vrdSqtd��)N�	undefinedr"�	NameErrorr*r,zNo syntax error from console)	r#rr$r	r%rr.r/r0r1r
r
r�test_syntax_error<s
�z(TestInteractiveConsole.test_syntax_errorcCs:dtd�g|j_t��}||j_|j��|�	|j
�dS)Nzraise ValueError('')r")r#rr$r�Mockrrr	r%�
assertTrue�called)r�hookr
r
r�test_sysexcepthookEs�
z)TestInteractiveConsole.test_sysexcepthookcCs�td�|j_|jjdd�|�t|jj�d�|jjd}|�|ddig�|j�	�td�|j_|jjdd�|�t|jj�d	�dS)
Nr"�Foo��banner�r�write)zFoo
r*��
r#rr$r	r%r&�lenrr.�
reset_mock)r�banner_callr
r
r�test_bannerMs
z"TestInteractiveConsole.test_bannercCs�td�|j_|jjdd�|�t|jj�d�|jjd}d}|�|d|fig�|j�	�td�|j_|jjddd�|�t|jj�d�|j�	�d	}td�|j_|jjd|d�|�t|jj�d�|jjd}|d
}|�|d|fig�dS)Nr"r*r=rAr,z"now exiting InteractiveConsole...
r@)r>�exitmsgu	bye! ζж�
rB)r�err_msg�expected�messager
r
r�
test_exit_msg[s&

�z$TestInteractiveConsole.test_exit_msgcC�Jdtd�g|j_|j��d�dd�|jjD��}td�}|�	||�dS)Nz(raise ValueError('') from AttributeErrorr"r*cs��|]
}d�|d�VqdS�r*r,N�r/��.0r2r
r
r�	<genexpr>{��z7TestInteractiveConsole.test_cause_tb.<locals>.<genexpr>z�
        AttributeError

        The above exception was the direct cause of the following exception:

        Traceback (most recent call last):
          File "<console>", line 1, in <module>
        ValueError
        �
r#rr$r	r%r/rr.r�assertIn�r�outputrJr
r
r�
test_cause_tbws�
	z$TestInteractiveConsole.test_cause_tbcCrM)Nztry: ham
except: eggs
r"r*csrNrOrPrQr
r
rrS�rTz9TestInteractiveConsole.test_context_tb.<locals>.<genexpr>ah
        Traceback (most recent call last):
          File "<console>", line 1, in <module>
        NameError: name 'ham' is not defined

        During handling of the above exception, another exception occurred:

        Traceback (most recent call last):
          File "<console>", line 2, in <module>
        NameError: name 'eggs' is not defined
        rUrWr
r
r�test_context_tb�s�
z&TestInteractiveConsole.test_context_tbN)�__name__�
__module__�__qualname__rr
r'r)r3r6r;rFrLrYrZr
r
r
rr
s		r�__main__)�__doc__r�unittest�textwrapr�
contextlibrr�test.supportr�
import_moduler�TestCaserr[�mainr
r
r
r�<module>s
�

Youez - 2016 - github.com/yon3zu
LinuXploit