403Webshell
Server IP : 118.27.122.248  /  Your IP : 216.73.216.124
Web Server : Apache
System : Linux web0264.sh.tyo1 4.18.0-553.79.1.lve.el7h.x86_64 #1 SMP Wed Oct 15 16:34:46 UTC 2025 x86_64
User : c9415830 ( 11735)
PHP Version : 8.4.17
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python36/lib64/python3.6/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python36/lib64/python3.6/test/__pycache__/test_code_module.cpython-36.opt-1.pyc
3

�w2_�@stdZddlZddlZddlmZddlmZddlmZddlm	Z	e	j
d�ZGdd	�d	ej�Z
ed
krpej�dS)zCTest InteractiveConsole and InteractiveInterpreter from code module�N)�dedent)�	ExitStack)�mock)�support�codec@sdeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dS)�TestInteractiveConsolecCstj�|_|j�dS)N)rZInteractiveConsole�console�mock_sys)�self�r�:/opt/alt/python36/lib64/python3.6/test/test_code_module.py�setUps
zTestInteractiveConsole.setUpcCs�t�}|j|j�|jtjddd��|_|jtjd��|_|jtjd��|_tjdt	j
t	j
d�}|j|�|_t
jt
j
kr�|jj
|j_|j`|j`dS)	z.Mock system environment for InteractiveConsolez
code.inputT)Zcreatezcode.sys.stdoutzcode.sys.stderrzcode.sys)�wraps�specN)rZ
addCleanup�close�
enter_contextrZpatch�infunc�stdout�stderrr�sys�sysmod�
excepthook�__excepthook__�ps1�ps2)r
�stackZprepatchrrrr	s
zTestInteractiveConsole.mock_syscCsLtd�|j_|jj�|j|jjd�d|j_|jj�|j|jjd�dS)N�Finishedz>>> z	custom1> )�EOFErrorr�side_effectr�interact�assertEqualrr)r
rrr�test_ps1"s

zTestInteractiveConsole.test_ps1cCsLtd�|j_|jj�|j|jjd�d|j_|jj�|j|jjd�dS)Nrz... z	custom2> )	rrrrrr rrr)r
rrr�test_ps2*s

zTestInteractiveConsole.test_ps2cCsRddtd�g|j_|jj�x0t|jj�D]}ddj|d�kr*Pq*Wt	d��dS)Nz	'antioch'�rZantioch�zno console stdout)
rrrrr�listr�method_calls�join�AssertionError)r
�callrrr�test_console_stderr2s
z*TestInteractiveConsole.test_console_stderrcCsLdtd�g|j_|jj�x,|jjD]}ddj|d�kr$Pq$Wtd��dS)NZ	undefinedr�	NameErrorr#r$zNo syntax error from console)	rrrrrrr&r'r()r
r)rrr�test_syntax_error;s
z(TestInteractiveConsole.test_syntax_errorcCs:dtd�g|j_tj�}||j_|jj�|j	|j
�dS)Nzraise ValueError('')r)rrrrZMockrrrrZ
assertTrueZcalled)r
�hookrrr�test_sysexcepthookDs
z)TestInteractiveConsole.test_sysexcepthookcCs�td�|j_|jjdd�|jt|jj�d�|jjd}|j|dd
ig�|jj	�td�|j_|jjdd�|jt|jj�d	�dS)NrZFoo)�banner�r�write�Foo
r#�)r2)
rrrrrr �lenrr&�
reset_mock)r
Zbanner_callrrr�test_bannerLs
z"TestInteractiveConsole.test_bannercCs�td�|j_|jjdd�|jt|jj�d�|jjd}d}|j|d|fig�|jj	�td�|j_|jjddd�|jt|jj�d�|jj	�d	}td�|j_|jjd|d�|jt|jj�d�|jjd}|d
}|j|d|fig�dS)Nrr#)r/r3r$z"now exiting InteractiveConsole...
r1)r/Zexitmsgu	bye! ζж�
)
rrrrrr r4rr&r5)r
Zerr_msg�expected�messagerrr�
test_exit_msgZs$

z$TestInteractiveConsole.test_exit_msgcCsJdtd�g|j_|jj�djdd�|jjD��}td�}|j	||�dS)Nz(raise ValueError('') from AttributeErrorrr#css|]}dj|d�VqdS)r#r$N)r')�.0r)rrr�	<genexpr>zsz7TestInteractiveConsole.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
        )
rrrrrr'rr&r�assertIn)r
�outputr8rrr�
test_cause_tbvs
z$TestInteractiveConsole.test_cause_tbcCsJdtd�g|j_|jj�djdd�|jjD��}td�}|j	||�dS)Nztry: ham
except: eggs
rr#css|]}dj|d�VqdS)r#r$N)r')r;r)rrrr<�sz9TestInteractiveConsole.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
        )
rrrrrr'rr&rr=)r
r>r8rrr�test_context_tb�s

z&TestInteractiveConsole.test_context_tbN)�__name__�
__module__�__qualname__r
r	r!r"r*r,r.r6r:r?r@rrrrrs		r�__main__)�__doc__rZunittest�textwrapr�
contextlibrrZtestr�
import_modulerZTestCaserrA�mainrrrr�<module>s


Youez - 2016 - github.com/yon3zu
LinuXploit