Sindbad~EG File Manager

Current Path : /proc/2568807/root/usr/local/lib/python3.12/test/__pycache__/
Upload File :
Current File : //proc/2568807/root/usr/local/lib/python3.12/test/__pycache__/test_cmd.cpython-312.pyc

�

'Μg����dZddlZddlZddlZddlZddlZddlmZGd�dej�Z	Gd�dej�Zd�Ze
d	k(r6d
ejvre	�j�yej �yy)z@
Test script for the 'cmd' module
Original by Michael Schneider
�N)�supportc�L�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
y)
�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', 'life', 'meaning', '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.onecmd("help meaning")  # doctest: +NORMALIZE_WHITESPACE
    Try and be nice to people, avoid eating fat, read a good book every
    now and then, get some walking in, and try to live together in peace
    and harmony with people of all creeds and nations.
    >>> mycmd.do_help("")
    <BLANKLINE>
    Documented commands (type help <topic>):
    ========================================
    add  help
    <BLANKLINE>
    Miscellaneous help topics:
    ==========================
    life  meaning
    <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()  # doctest: +REPORT_NDIFF
    Hello from preloop
    *** invalid number of arguments
    9
    9
    <BLANKLINE>
    Documented commands (type help <topic>):
    ========================================
    add  help
    <BLANKLINE>
    Miscellaneous help topics:
    ==========================
    life  meaning
    <BLANKLINE>
    Undocumented commands:
    ======================
    exit  shell
    <BLANKLINE>
    help text for add
    Hello from postloop
    c��td�y)NzHello from preloop��print��selfs �*/usr/local/lib/python3.12/test/test_cmd.py�preloopzsamplecmdclass.preloop�s��
�"�#�c��td�y)NzHello from postlooprr	s r�postloopzsamplecmdclass.postloop�s��
�#�$r
c��td�y)Nz"This is the completedefault methodr)r
�ignoreds  r�completedefaultzsamplecmdclass.completedefault�s��
�2�3r
c��td�y)Nzcomplete commandrr	s r�complete_commandzsamplecmdclass.complete_command�s��
� �!r
c��y�N�)r
�ss  r�do_shellzsamplecmdclass.do_shell�s��r
c���|j�}t|�dk7rtd�y	|D�cgc]
}t|���}}t|d|dz�ycc}w#t$rtd�YywxYw)N�z*** invalid number of argumentsz*** arguments should be numbersr�)�split�lenr�int�
ValueError)r
r�l�is    r�do_addzsamplecmdclass.do_add�sw��
�G�G�I���q�6�Q�;��3�4��	�!"�#��A��Q���A�#�	�a��d�1�Q�4�i���	$���	��3�4��	�s"�A�A�A�A�A5�4A5c��td�y)Nzhelp text for addrr	s r�help_addzsamplecmdclass.help_add�s��
�!�"�r
c��td�y)Nz�Try and be nice to people, avoid eating fat, read a good book every now and then, get some walking in, and try to live together in peace and harmony with people of all creeds and nations.rr	s r�help_meaningzsamplecmdclass.help_meaning�s��
�2�	3�	r
c��td�y)Nz&Always look on the bright side of liferr	s r�	help_lifezsamplecmdclass.help_life�s��
�6�7�r
c��y�NTr)r
�args  r�do_exitzsamplecmdclass.do_exit�s��r
N)�__name__�
__module__�__qualname__�__doc__rrrrrr#r%r'r)r-rr
rrrs;��E�N$�%�4�"�
�
����r
rc�X�eZdZGd�dej�ZGd�de�Zd�Zd�Zy)�TestAlternateInputc��eZdZd�Zd�Zy)�TestAlternateInput.simplecmdc�2�t||j��y)N��file�r�stdout�r
�argss  r�do_printz%TestAlternateInput.simplecmd.do_print�s���$�T�[�[�)r
c��yr+rr;s  r�do_EOFz#TestAlternateInput.simplecmd.do_EOF�s��r
N)r.r/r0r=r?rr
r�	simplecmdr5�s��	*�	r
r@c��eZdZd�Zy)�TestAlternateInput.simplecmd2c�2�td|j��y)Nz*** Unknown syntax: EOFr7Tr9r;s  rr?z$TestAlternateInput.simplecmd2.do_EOF�s���+�$�+�+�>�r
N)r.r/r0r?rr
r�
simplecmd2rB�s��	r
rDc���tjd�}tj�}|j||��}d|_|j�|j|j
�d�y)N�print test
print test2��stdinr:Fz(Cmd) test
(Cmd) test2
(Cmd) )�io�StringIOr@�use_rawinput�cmdloop�assertMultiLineEqual�getvalue�r
�input�output�cmds    r�test_file_with_missing_final_nlz2TestAlternateInput.test_file_with_missing_final_nl�s]�����5�6��������n�n�5��n�8�� �������
��!�!�&�/�/�"3��	r
c��tjd�}tj�}|j||��}d|_|j�|j|j
�d�tjd�}tj�}||_||_|j�|j|j
�d�y)NrFrGFz5(Cmd) test
(Cmd) test2
(Cmd) *** Unknown syntax: EOF
zprint 

z,(Cmd) 
(Cmd) 
(Cmd) *** Unknown syntax: EOF
)	rIrJrDrKrLrMrNrHr:rOs    r�test_input_reset_at_EOFz*TestAlternateInput.test_input_reset_at_EOF�s������5�6��������o�o�E�&�o�9�� �������
��!�!�&�/�/�"3�/�	1����L�)���������	���
�����
��!�!�&�/�/�"3�/�	1r
N)	r.r/r0rR�Cmdr@rDrSrUrr
rr3r3�s(���C�G�G���Y��	�1r
r3c�L�|jtj��|Sr)�addTest�doctest�DocTestSuite)�loader�tests�patterns   r�
load_testsr^�s��	�M�M�'�&�&�(�)��Lr
�__main__z-i)r1rR�sysrY�unittestrI�testrrVr�TestCaser3r^r.�argvrL�mainrr
r�<module>rfs~����
���	��s�S�W�W�s�l01��*�*�01�f�
�z���s�x�x���� � �"���
�
��	r

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists