summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_cmd.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_cmd.py')
-rw-r--r--Lib/test/test_cmd.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/Lib/test/test_cmd.py b/Lib/test/test_cmd.py
index e2b3022..f102fe0 100644
--- a/Lib/test/test_cmd.py
+++ b/Lib/test/test_cmd.py
@@ -60,15 +60,17 @@ class samplecmdclass(cmd.Cmd):
>>> mycmd.completenames("12")
[]
>>> mycmd.completenames("help")
- ['help', 'help']
+ ['help']
Test for the function complete_help():
>>> mycmd.complete_help("a")
['add']
>>> mycmd.complete_help("he")
- ['help', 'help']
+ ['help']
>>> mycmd.complete_help("12")
[]
+ >>> sorted(mycmd.complete_help(""))
+ ['add', 'exit', 'help', 'shell']
Test for the function do_help():
>>> mycmd.do_help("testet")
@@ -144,7 +146,7 @@ class samplecmdclass(cmd.Cmd):
def complete_command(self):
print("complete command")
- def do_shell(self):
+ def do_shell(self, s):
pass
def do_add(self, s):
@@ -171,6 +173,7 @@ def test_main(verbose=None):
support.run_doctest(test_cmd, verbose)
def test_coverage(coverdir):
+ import trace
tracer=trace.Trace(ignoredirs=[sys.prefix, sys.exec_prefix,],
trace=0, count=1)
tracer.run('reload(cmd);test_main()')
@@ -181,5 +184,7 @@ def test_coverage(coverdir):
if __name__ == "__main__":
if "-c" in sys.argv:
test_coverage('/tmp/cmd.cover')
+ elif "-i" in sys.argv:
+ samplecmdclass().cmdloop()
else:
test_main()