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)
|
||||
|
@ -33,6 +33,14 @@ def test_base_config():
|
||||
assert cfg.dummy == False
|
||||
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()
|
||||
|
Loading…
Reference in New Issue
Block a user