help with modified argument
This commit is contained in:
@ -109,7 +109,7 @@ root:
|
||||
assert f.getvalue() == output
|
||||
|
||||
|
||||
def test_readme_help_modif():
|
||||
def test_readme_help_modif_positional():
|
||||
output = """usage: prog.py str [-h] [-v] --str STR
|
||||
|
||||
optional arguments:
|
||||
@ -129,6 +129,44 @@ optional arguments:
|
||||
assert f.getvalue() == output
|
||||
|
||||
|
||||
def test_readme_help_modif():
|
||||
output = """usage: prog.py str --str toto [-h] [-v]
|
||||
|
||||
optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
-v, --verbosity increase output verbosity
|
||||
"""
|
||||
parser = TiramisuCmdlineParser(get_config(), 'prog.py')
|
||||
f = StringIO()
|
||||
with redirect_stdout(f):
|
||||
try:
|
||||
parser.parse_args(['str', '--str', 'toto', '--help'])
|
||||
except SystemExit as err:
|
||||
assert str(err) == "0"
|
||||
else:
|
||||
raise Exception('must raises')
|
||||
assert f.getvalue() == output
|
||||
|
||||
|
||||
def test_readme_help_modif_short():
|
||||
output = """usage: prog.py str --verbosity [-h] --str STR
|
||||
|
||||
optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
--str STR string option
|
||||
"""
|
||||
parser = TiramisuCmdlineParser(get_config(), 'prog.py')
|
||||
f = StringIO()
|
||||
with redirect_stdout(f):
|
||||
try:
|
||||
parser.parse_args(['str', '-v', '--help'])
|
||||
except SystemExit as err:
|
||||
assert str(err) == "0"
|
||||
else:
|
||||
raise Exception('must raises')
|
||||
assert f.getvalue() == output
|
||||
|
||||
|
||||
def test_readme_positional_mandatory():
|
||||
output = """usage: prog.py [-h] [-v] {str,list,int,none}
|
||||
prog.py: error: the following arguments are required: cmd
|
||||
|
Reference in New Issue
Block a user