summaryrefslogtreecommitdiff
path: root/tests/test_argparse.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2018-01-17 13:48:13 -0500
committerTodd Leonhardt <todd.leonhardt@gmail.com>2018-01-17 13:48:13 -0500
commitb034f6d2de92a784853ddeef4e51b26148056691 (patch)
tree2d692d7e37265164410eaebad44759ab50928192 /tests/test_argparse.py
parent91bc999d022a486334b9054859e2ef6f03ca9666 (diff)
downloadcmd2-git-b034f6d2de92a784853ddeef4e51b26148056691.tar.gz
Improved how new argparse-based decorators provide help
Now "help command_name" and "command_name -h" provide exactly the same text. The function docstring for the "do_*" command sets and overrides the ArgumentParser "description" if the docstring is not empty.
Diffstat (limited to 'tests/test_argparse.py')
-rw-r--r--tests/test_argparse.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/test_argparse.py b/tests/test_argparse.py
index fea9bebb..e144514a 100644
--- a/tests/test_argparse.py
+++ b/tests/test_argparse.py
@@ -140,10 +140,14 @@ def test_argparse_quoted_arguments_posix_multiple(argparse_app):
def test_argparse_help_docstring(argparse_app):
out = run_cmd(argparse_app, 'help say')
- assert out[0] == 'Repeat what you tell me to.'
+ assert out[0].startswith('usage: say')
+ assert out[1] == ''
+ assert out[2] == 'Repeat what you tell me to.'
def test_argparse_help_description(argparse_app):
out = run_cmd(argparse_app, 'help tag')
+ assert out[0].startswith('usage: tag')
+ assert out[1] == ''
assert out[2] == 'create a html tag'
def test_argparse_prog(argparse_app):