no- + fullname == false
This commit is contained in:
parent
57e85b49eb
commit
74215a6f80
|
@ -186,6 +186,34 @@ def test_leadership_modif_follower_bool_false(json):
|
|||
assert config.value.dict() == output
|
||||
|
||||
|
||||
def test_leadership_modif_follower_bool_true_fullname(json):
|
||||
output = {'leader.leader': ['192.168.0.1'],
|
||||
'leader.follower': [None],
|
||||
'leader.follower_boolean': [True],
|
||||
'leader.follower_choice': [None],
|
||||
'leader.follower_integer': [None],
|
||||
'leader.follower_submulti': [[]]}
|
||||
|
||||
config = get_config(json)
|
||||
parser = TiramisuCmdlineParser(config, 'prog.py', fullpath=False)
|
||||
parser.parse_args(['--follower_boolean', '0'])
|
||||
assert config.value.dict() == output
|
||||
|
||||
|
||||
def test_leadership_modif_follower_bool_false_fullname(json):
|
||||
output = {'leader.leader': ['192.168.0.1'],
|
||||
'leader.follower': [None],
|
||||
'leader.follower_boolean': [False],
|
||||
'leader.follower_choice': [None],
|
||||
'leader.follower_integer': [None],
|
||||
'leader.follower_submulti': [[]]}
|
||||
|
||||
config = get_config(json)
|
||||
parser = TiramisuCmdlineParser(config, 'prog.py', fullpath=False)
|
||||
parser.parse_args(['--no-follower_boolean', '0'])
|
||||
assert config.value.dict() == output
|
||||
|
||||
|
||||
def test_leadership_modif_follower_choice(json):
|
||||
output = {'leader.leader': ['192.168.0.1'],
|
||||
'leader.follower': [None],
|
||||
|
|
|
@ -20,7 +20,7 @@ from gettext import gettext as _
|
|||
try:
|
||||
from tiramisu import Config
|
||||
from tiramisu.error import PropertiesOptionError, RequirementError, LeadershipError
|
||||
except ModuleNotFoundError:
|
||||
except (ModuleNotFoundError, ImportError):
|
||||
Config = None
|
||||
from tiramisu_api.error import PropertiesOptionError
|
||||
RequirementError = PropertiesOptionError
|
||||
|
@ -164,10 +164,12 @@ class _BuildKwargs:
|
|||
is_short_name = self.cmdlineparser._is_short_name(name, 'longargument' in self.properties)
|
||||
if self.force_no:
|
||||
ga_name = self.gen_argument_name(name, is_short_name)
|
||||
self.cmdlineparser.namespace.list_force_no[ga_name] = option.path()
|
||||
ga_path = self.gen_argument_name(option.path(), is_short_name)
|
||||
self.cmdlineparser.namespace.list_force_no[ga_path] = option.path()
|
||||
elif self.force_del:
|
||||
ga_name = self.gen_argument_name(name, is_short_name)
|
||||
self.cmdlineparser.namespace.list_force_del[ga_name] = option.path()
|
||||
ga_path = self.gen_argument_name(option.path(), is_short_name)
|
||||
self.cmdlineparser.namespace.list_force_del[ga_path] = option.path()
|
||||
else:
|
||||
ga_name = name
|
||||
self.kwargs['dest'] = self.gen_argument_name(option.path(), False)
|
||||
|
|
Loading…
Reference in New Issue