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_cmd.cpython-310.pyc
o

�9ji�@s�dZddlZddlZddlZddlZddlmZGdd�dej�ZGdd�dej	�Z
ddd	�Zd
d�Ze
dkrSd
ejvrBed�dSdejvrNe���dSe�dSdS)z@
Test script for the 'cmd' module
Original by Michael Schneider
�N)�supportc@sPeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�ZdS)�samplecmdclassa-
    Instance the sampleclass:
    >>> mycmd = samplecmdclass()

    Test for the function parseline():
    >>> mycmd.parseline("")
    (None, None, '')
    >>> mycmd.parseline("?")
    ('help', '', 'help ')
    >>> mycmd.parseline("?help")
    ('help', 'help', 'help help')
    >>> mycmd.parseline("!")
    ('shell', '', 'shell ')
    >>> mycmd.parseline("!command")
    ('shell', 'command', 'shell command')
    >>> mycmd.parseline("func")
    ('func', '', 'func')
    >>> mycmd.parseline("func arg1")
    ('func', 'arg1', 'func arg1')


    Test for the function onecmd():
    >>> mycmd.onecmd("")
    >>> mycmd.onecmd("add 4 5")
    9
    >>> mycmd.onecmd("")
    9
    >>> mycmd.onecmd("test")
    *** Unknown syntax: test

    Test for the function emptyline():
    >>> mycmd.emptyline()
    *** Unknown syntax: test

    Test for the function default():
    >>> mycmd.default("default")
    *** Unknown syntax: default

    Test for the function completedefault():
    >>> mycmd.completedefault()
    This is the completedefault method
    >>> mycmd.completenames("a")
    ['add']

    Test for the function completenames():
    >>> mycmd.completenames("12")
    []
    >>> mycmd.completenames("help")
    ['help']

    Test for the function complete_help():
    >>> mycmd.complete_help("a")
    ['add']
    >>> mycmd.complete_help("he")
    ['help']
    >>> mycmd.complete_help("12")
    []
    >>> sorted(mycmd.complete_help(""))
    ['add', 'exit', 'help', 'shell']

    Test for the function do_help():
    >>> mycmd.do_help("testet")
    *** No help on testet
    >>> mycmd.do_help("add")
    help text for add
    >>> mycmd.onecmd("help add")
    help text for add
    >>> mycmd.do_help("")
    <BLANKLINE>
    Documented commands (type help <topic>):
    ========================================
    add  help
    <BLANKLINE>
    Undocumented commands:
    ======================
    exit  shell
    <BLANKLINE>

    Test for the function print_topics():
    >>> mycmd.print_topics("header", ["command1", "command2"], 2 ,10)
    header
    ======
    command1
    command2
    <BLANKLINE>

    Test for the function columnize():
    >>> mycmd.columnize([str(i) for i in range(20)])
    0  1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17  18  19
    >>> mycmd.columnize([str(i) for i in range(20)], 10)
    0  7   14
    1  8   15
    2  9   16
    3  10  17
    4  11  18
    5  12  19
    6  13

    This is an interactive test, put some commands in the cmdqueue attribute
    and let it execute
    This test includes the preloop(), postloop(), default(), emptyline(),
    parseline(), do_help() functions
    >>> mycmd.use_rawinput=0
    >>> mycmd.cmdqueue=["", "add", "add 4 5", "help", "help add","exit"]
    >>> mycmd.cmdloop()
    Hello from preloop
    help text for add
    *** invalid number of arguments
    9
    <BLANKLINE>
    Documented commands (type help <topic>):
    ========================================
    add  help
    <BLANKLINE>
    Undocumented commands:
    ======================
    exit  shell
    <BLANKLINE>
    help text for add
    Hello from postloop
    cC�td�dS)NzHello from preloop��print��self�r	�$/usr/lib/python3.10/test/test_cmd.py�preloop��zsamplecmdclass.preloopcCr)NzHello from postlooprrr	r	r
�postloop�rzsamplecmdclass.postloopcGr)Nz"This is the completedefault methodr)r�ignoredr	r	r
�completedefault�rzsamplecmdclass.completedefaultcCr)Nzcomplete commandrrr	r	r
�complete_command�rzsamplecmdclass.complete_commandcCsdS�Nr	)r�sr	r	r
�do_shell��zsamplecmdclass.do_shellcCsh|��}t|�dkrtd�dSz	dd�|D�}Wnty'td�YdSwt|d|d�dS)N�z*** invalid number of argumentscSsg|]}t|��qSr	)�int)�.0�ir	r	r
�
<listcomp>�sz)samplecmdclass.do_add.<locals>.<listcomp>z*** arguments should be numbersr�)�split�lenr�
ValueError)rr�lr	r	r
�do_add�s�zsamplecmdclass.do_addcCr)Nzhelp text for addrrr	r	r
�help_add�szsamplecmdclass.help_addcC�dS�NTr	)r�argr	r	r
�do_exit�rzsamplecmdclass.do_exitN)�__name__�
__module__�__qualname__�__doc__rr
rrrrr r$r	r	r	r
r
szrc@s>eZdZGdd�dej�ZGdd�de�Zdd�Zdd�Zd	S)
�TestAlternateInputc@seZdZdd�Zdd�ZdS)zTestAlternateInput.simplecmdcCst||jd�dS)N��file�r�stdout�r�argsr	r	r
�do_print�sz%TestAlternateInput.simplecmd.do_printcCr!r"r	r.r	r	r
�do_EOF�rz#TestAlternateInput.simplecmd.do_EOFN)r%r&r'r0r1r	r	r	r
�	simplecmd�sr2c@seZdZdd�ZdS)zTestAlternateInput.simplecmd2cCstd|jd�dS)Nz*** Unknown syntax: EOFr*Tr,r.r	r	r
r1�sz$TestAlternateInput.simplecmd2.do_EOFN)r%r&r'r1r	r	r	r
�
simplecmd2�sr3cCsBt�d�}t��}|j||d�}d|_|��|�|��d�dS)N�print test
print test2��stdinr-Fz(Cmd) test
(Cmd) test2
(Cmd) )�io�StringIOr2�use_rawinput�cmdloop�assertMultiLineEqual�getvalue�r�input�output�cmdr	r	r
�test_file_with_missing_final_nl�s

�z2TestAlternateInput.test_file_with_missing_final_nlcCsxt�d�}t��}|j||d�}d|_|��|�|��d�t�d�}t��}||_||_|��|�|��d�dS)Nr4r5Fz5(Cmd) test
(Cmd) test2
(Cmd) *** Unknown syntax: EOF
zprint 

z,(Cmd) 
(Cmd) 
(Cmd) *** Unknown syntax: EOF
)	r7r8r3r9r:r;r<r6r-r=r	r	r
�test_input_reset_at_EOF�s 

�

�z*TestAlternateInput.test_input_reset_at_EOFN)	r%r&r'r@�Cmdr2r3rArBr	r	r	r
r)�s
	r)cCs&ddlm}t�||�t�t�dS)Nr)�test_cmd)�testrDr�run_doctest�run_unittestr))�verboserDr	r	r
�	test_main�srIcCsPt�d�}|jtjtjgddd�}|�d�|��}td�|j	dd|d�dS)	N�tracerr)�
ignoredirsrJ�countz4import importlib; importlib.reload(cmd); test_main()zWriting coverage results...T)�show_missing�summary�coverdir)
r�
import_module�Trace�sys�base_prefix�base_exec_prefix�run�resultsr�
write_results)rOrJ�tracer�rr	r	r
�
test_coverage�s
�
rZ�__main__z-cz/tmp/cmd.coverz-ir)r(r@rR�unittestr7rErrCr�TestCaser)rIrZr%�argvr:r	r	r	r
�<module>s$
3	


�

Youez - 2016 - github.com/yon3zu
LinuXploit