possibility to reset a value
This commit is contained in:
parent
274192a30b
commit
99b117e838
|
@ -81,7 +81,7 @@ class Option(HiddenBaseType, DisabledBaseType, ModeBaseType):
|
|||
if who == "default" and value is None:
|
||||
self.default = None
|
||||
return
|
||||
if not self.validate(value):
|
||||
if value != None and not self.validate(value):
|
||||
raise ConfigError('invalid value %s for option %s' % (value, name))
|
||||
if who == "default":
|
||||
# changes the default value (and therefore resets the previous value)
|
||||
|
|
|
@ -34,6 +34,14 @@ def test_base_config():
|
|||
dm = cfg.unwrap_from_path('dummy')
|
||||
assert dm._name == 'dummy'
|
||||
|
||||
def test_toto():
|
||||
descr = make_description()
|
||||
cfg = Config(descr)
|
||||
assert cfg.gc.dummy == False
|
||||
cfg.gc.dummy = True
|
||||
assert cfg.gc.dummy == True
|
||||
cfg.gc.dummy = None
|
||||
|
||||
def test_base_config_and_groups():
|
||||
descr = make_description()
|
||||
# overrides the booloption default value
|
||||
|
|
Loading…
Reference in New Issue