MCPcopy Index your code
hub / github.com/python/cpython / samplecmdclass

Class samplecmdclass

Lib/test/test_cmd.py:23–202  ·  view source on GitHub ↗

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("

Source from the content-addressed store, hash-verified

21
22
23class samplecmdclass(cmd.Cmd):
24 """
25 Instance the sampleclass:
26 >>> mycmd = samplecmdclass()
27
28 Test for the function parseline():
29 >>> mycmd.parseline("")
30 (None, None, '')
31 >>> mycmd.parseline("?")
32 ('help', '', 'help ')
33 >>> mycmd.parseline("?help")
34 ('help', 'help', 'help help')
35 >>> mycmd.parseline("!")
36 ('shell', '', 'shell ')
37 >>> mycmd.parseline("!command")
38 ('shell', 'command', 'shell command')
39 >>> mycmd.parseline("func")
40 ('func', '', 'func')
41 >>> mycmd.parseline("func arg1")
42 ('func', 'arg1', 'func arg1')
43
44
45 Test for the function onecmd():
46 >>> mycmd.onecmd("")
47 >>> mycmd.onecmd("add 4 5")
48 9
49 >>> mycmd.onecmd("")
50 9
51 >>> mycmd.onecmd("test")
52 *** Unknown syntax: test
53
54 Test for the function emptyline():
55 >>> mycmd.emptyline()
56 *** Unknown syntax: test
57
58 Test for the function default():
59 >>> mycmd.default("default")
60 *** Unknown syntax: default
61
62 Test for the function completedefault():
63 >>> mycmd.completedefault()
64 This is the completedefault method
65 >>> mycmd.completenames("a")
66 ['add']
67
68 Test for the function completenames():
69 >>> mycmd.completenames("12")
70 []
71 >>> mycmd.completenames("help")
72 ['help']
73
74 Test for the function complete_help():
75 >>> mycmd.complete_help("a")
76 ['add']
77 >>> mycmd.complete_help("he")
78 ['help']
79 >>> mycmd.complete_help("12")
80 []

Callers 1

test_cmd.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…