Uname: Linux web3.us.cloudlogin.co 5.10.226-xeon-hst #2 SMP Fri Sep 13 12:28:44 UTC 2024 x86_64
Software: Apache
PHP version: 8.1.31 [ PHP INFO ] PHP os: Linux
Server Ip: 162.210.96.117
Your Ip: 18.118.37.20
User: edustar (269686) | Group: tty (888)
Safe Mode: OFF
Disable Function:
NONE

name : test_cmd.pyc
�
?��cc@s�dZddlZddlZddlmZddlZddlZddlZdejfd��YZ	dej
fd��YZdd�Z
d	�Zed
kr�dejkr�ed�q�d
ejkr�e	�j�q�e
�ndS(s@
Test script for the 'cmd' module
Original by Michael Schneider
i����N(ttest_supporttsamplecmdclasscBsVeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
RS(	s0
    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 methode
    >>> 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 xrange(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 xrange(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
    cCs	dGHdS(NsHello from preloop((tself((s4/usr/local/python-2.7/lib/python2.7/test/test_cmd.pytpreloop�scCs	dGHdS(NsHello from postloop((R((s4/usr/local/python-2.7/lib/python2.7/test/test_cmd.pytpostloop�scGs	dGHdS(Ns#This is the completedefault methode((Rtignored((s4/usr/local/python-2.7/lib/python2.7/test/test_cmd.pytcompletedefault�scCs	dGHdS(Nscomplete command((R((s4/usr/local/python-2.7/lib/python2.7/test/test_cmd.pytcomplete_command�scCsdS(N((Rts((s4/usr/local/python-2.7/lib/python2.7/test/test_cmd.pytdo_shell�scCsy|j�}t|�dkr'dGHdSy#g|D]}t|�^q1}Wntk
rcdGHdSX|d|dGHdS(Nis*** invalid number of argumentss*** arguments should be numbersii(tsplittlentintt
ValueError(RRtlti((s4/usr/local/python-2.7/lib/python2.7/test/test_cmd.pytdo_add�s#
cCs	dGHdS(Nshelp text for add((R((s4/usr/local/python-2.7/lib/python2.7/test/test_cmd.pythelp_add�scCstS(N(tTrue(Rtarg((s4/usr/local/python-2.7/lib/python2.7/test/test_cmd.pytdo_exit�s(t__name__t
__module__t__doc__RRRRR	RRR(((s4/usr/local/python-2.7/lib/python2.7/test/test_cmd.pyRsy							tTestAlternateInputcBsIeZdejfd��YZdefd��YZd�Zd�ZRS(t	simplecmdcBseZd�Zd�ZRS(cCs|j|IJdS(N(tstdout(Rtargs((s4/usr/local/python-2.7/lib/python2.7/test/test_cmd.pytdo_print�scCstS(N(R(RR((s4/usr/local/python-2.7/lib/python2.7/test/test_cmd.pytdo_EOF�s(RRRR(((s4/usr/local/python-2.7/lib/python2.7/test/test_cmd.pyR�s	t
simplecmd2cBseZd�ZRS(cCs|jdIJtS(Ns*** Unknown syntax: EOF(RR(RR((s4/usr/local/python-2.7/lib/python2.7/test/test_cmd.pyR�s
(RRR(((s4/usr/local/python-2.7/lib/python2.7/test/test_cmd.pyR�scCs`tjd�}tj�}|jd|d|�}t|_|j�|j|j�d�dS(Nsprint test
print test2tstdinRs(Cmd) test
(Cmd) test2
(Cmd) (tStringIORtFalsetuse_rawinputtcmdlooptassertMultiLineEqualtgetvalue(Rtinputtoutputtcmd((s4/usr/local/python-2.7/lib/python2.7/test/test_cmd.pyttest_file_with_missing_final_nl�s	
cCs�tjd�}tj�}|jd|d|�}t|_|j�|j|j�d�tjd�}tj�}||_||_|j�|j|j�d�dS(Nsprint test
print test2RRs5(Cmd) test
(Cmd) test2
(Cmd) *** Unknown syntax: EOF
sprint 

s,(Cmd) 
(Cmd) 
(Cmd) *** Unknown syntax: EOF
(	R RR!R"R#R$R%RR(RR&R'R(((s4/usr/local/python-2.7/lib/python2.7/test/test_cmd.pyttest_input_reset_at_EOF�s	
		
(RRR(tCmdRRR)R*(((s4/usr/local/python-2.7/lib/python2.7/test/test_cmd.pyR�s		cCs1ddlm}tj||�tjt�dS(Ni����(ttest_cmd(ttestR,Rtrun_doctesttrun_unittestR(tverboseR,((s4/usr/local/python-2.7/lib/python2.7/test/test_cmd.pyt	test_main�scCswtjd�}|jdtjtjgdddd�}|jd�|j�}dGH|jdt	d	t	d
|�dS(Nttracet
ignoredirsitcountisreload(cmd);test_main()sWriting coverage results...tshow_missingtsummarytcoverdir(
Rt
import_moduletTracetsystprefixtexec_prefixtruntresultst
write_resultsR(R7R2ttracertr((s4/usr/local/python-2.7/lib/python2.7/test/test_cmd.pyt
test_coverage�s
t__main__s-cs/tmp/cmd.covers-i(RR(R:R-RtretunittestR R+RtTestCaseRtNoneR1RBRtargvR#(((s4/usr/local/python-2.7/lib/python2.7/test/test_cmd.pyt<module>s �3		

© 2025 GrazzMean