remove empty OD in help if option remove_empty_od set to True
This commit is contained in:
@ -98,6 +98,41 @@ od2.subtree:
|
||||
assert f.getvalue() == output
|
||||
|
||||
|
||||
def test_optiondescription_help_remove_empty_od(json):
|
||||
output = """usage: prog.py [-h] [-v] [-nv] --od2.subtree.str STR --od2.before BEFORE
|
||||
--od2.after AFTER
|
||||
{str,list,int,none}
|
||||
|
||||
optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
|
||||
od1.od0:
|
||||
Sub-Tree 1
|
||||
|
||||
{str,list,int,none} choice the sub argument
|
||||
-v, --od1.od0.verbosity
|
||||
increase output verbosity
|
||||
-nv, --od1.od0.no-verbosity
|
||||
|
||||
od2:
|
||||
Second OptionDescription
|
||||
|
||||
--od2.before BEFORE Before
|
||||
--od2.after AFTER After
|
||||
|
||||
od2.subtree:
|
||||
Sub-Tree 2
|
||||
|
||||
--od2.subtree.str STR
|
||||
string option 2
|
||||
"""
|
||||
parser = TiramisuCmdlineParser(get_config(json), 'prog.py', remove_empty_od=True)
|
||||
f = StringIO()
|
||||
with redirect_stdout(f):
|
||||
parser.print_help()
|
||||
assert f.getvalue() == output
|
||||
|
||||
|
||||
def test_optiondescription_help_subtree(json):
|
||||
output = """usage: prog.py [-h] --od2.subtree.str STR --od2.before BEFORE --od2.after
|
||||
AFTER
|
||||
|
@ -47,6 +47,10 @@ def test_short(json):
|
||||
parser = TiramisuCmdlineParser(config, 'prog.py')
|
||||
parser.parse_args(['-l', 'a'])
|
||||
assert config.value.dict() == output
|
||||
#
|
||||
assert config.option('list').value.get() == config.option('l').value.get()
|
||||
assert config.option('list').owner.get() == config.option('l').owner.get()
|
||||
assert config.option('list').owner.isdefault() == config.option('l').owner.isdefault()
|
||||
|
||||
|
||||
def test_short_mandatory(json):
|
||||
|
Reference in New Issue
Block a user