diff options
author | kotfu <kotfu@kotfu.net> | 2018-01-07 18:30:34 -0700 |
---|---|---|
committer | kotfu <kotfu@kotfu.net> | 2018-01-07 18:30:34 -0700 |
commit | 8c58bb558adceb8ff32c7a3e1a88d2a13371dbfa (patch) | |
tree | 896f61548da5db985fb33e61e90486fb3d7fe5a7 /tests/test_argparse.py | |
parent | c25a2b7949c02449279f548db1c8de9d10214cdc (diff) | |
download | cmd2-git-8c58bb558adceb8ff32c7a3e1a88d2a13371dbfa.tar.gz |
Properly set docstring so it contains help message
Diffstat (limited to 'tests/test_argparse.py')
-rw-r--r-- | tests/test_argparse.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/test_argparse.py b/tests/test_argparse.py index 9b49267e..41173c8b 100644 --- a/tests/test_argparse.py +++ b/tests/test_argparse.py @@ -15,7 +15,6 @@ class ArgparseApp(cmd2.Cmd): argparser = argparse.ArgumentParser( prog='say', - description='Repeats what you tell me to' ) argparser.add_argument('-p', '--piglatin', action='store_true', help='atinLay') argparser.add_argument('-s', '--shout', action='store_true', help='N00B EMULATION MODE') @@ -23,6 +22,7 @@ class ArgparseApp(cmd2.Cmd): argparser.add_argument('words', nargs='+', help='words to say') @cmd2.with_argument_parser(argparser) def do_say(self, cmdline, args=None): + """Repeat what you tell me to.""" words = [] for word in args.words: if word is None: @@ -39,7 +39,7 @@ class ArgparseApp(cmd2.Cmd): argparser = argparse.ArgumentParser( prog='tag', - description='create an html tag, the first argument is the tag, the rest is the contents' + description='create a html tag' ) argparser.add_argument('tag', nargs=1, help='tag') argparser.add_argument('content', nargs='+', help='content to surround with tag') @@ -80,3 +80,11 @@ def test_argparse_quoted_arguments_posix_multiple(argparse_app): argparse_app.POSIX = True out = run_cmd(argparse_app, 'tag strong this "should be" loud') assert out == ['<strong>this should be loud</strong>'] + +def test_argparse_help_docstring(argparse_app): + out = run_cmd(argparse_app, 'help say') + assert out[0] == 'Repeat what you tell me to.' + +def test_argparse_help_description(argparse_app): + out = run_cmd(argparse_app, 'help tag') + assert out[2] == 'create a html tag' |