@@ -70,7 +70,7 @@ class samplecmdclass(cmd.Cmd):
7070 >>> mycmd.complete_help("12")
7171 []
7272 >>> sorted(mycmd.complete_help(""))
73- ['add', 'exit', 'help', 'shell']
73+ ['add', 'exit', 'help', 'life', 'meaning', ' shell']
7474
7575 Test for the function do_help():
7676 >>> mycmd.do_help("testet")
@@ -79,12 +79,20 @@ class samplecmdclass(cmd.Cmd):
7979 help text for add
8080 >>> mycmd.onecmd("help add")
8181 help text for add
82+ >>> mycmd.onecmd("help meaning") # doctest: +NORMALIZE_WHITESPACE
83+ Try and be nice to people, avoid eating fat, read a good book every
84+ now and then, get some walking in, and try to live together in peace
85+ and harmony with people of all creeds and nations.
8286 >>> mycmd.do_help("")
8387 <BLANKLINE>
8488 Documented commands (type help <topic>):
8589 ========================================
8690 add help
8791 <BLANKLINE>
92+ Miscellaneous help topics:
93+ ==========================
94+ life meaning
95+ <BLANKLINE>
8896 Undocumented commands:
8997 ======================
9098 exit shell
@@ -115,17 +123,22 @@ class samplecmdclass(cmd.Cmd):
115123 This test includes the preloop(), postloop(), default(), emptyline(),
116124 parseline(), do_help() functions
117125 >>> mycmd.use_rawinput=0
118- >>> mycmd.cmdqueue=["", "add", "add 4 5", "help", "help add","exit"]
119- >>> mycmd.cmdloop()
126+
127+ >>> mycmd.cmdqueue=["add", "add 4 5", "", "help", "help add", "exit"]
128+ >>> mycmd.cmdloop() # doctest: +REPORT_NDIFF
120129 Hello from preloop
121- help text for add
122130 *** invalid number of arguments
123131 9
132+ 9
124133 <BLANKLINE>
125134 Documented commands (type help <topic>):
126135 ========================================
127136 add help
128137 <BLANKLINE>
138+ Miscellaneous help topics:
139+ ==========================
140+ life meaning
141+ <BLANKLINE>
129142 Undocumented commands:
130143 ======================
131144 exit shell
@@ -165,6 +178,17 @@ def help_add(self):
165178 print ("help text for add" )
166179 return
167180
181+ def help_meaning (self ):
182+ print ("Try and be nice to people, avoid eating fat, read a "
183+ "good book every now and then, get some walking in, "
184+ "and try to live together in peace and harmony with "
185+ "people of all creeds and nations." )
186+ return
187+
188+ def help_life (self ):
189+ print ("Always look on the bright side of life" )
190+ return
191+
168192 def do_exit (self , arg ):
169193 return True
170194
0 commit comments