test force_default_on_freeze with multi and correction in Multi()
This commit is contained in:
parent
7f755e0ef8
commit
8aa4260404
|
@ -68,6 +68,20 @@ def test_force_default_on_freeze():
|
||||||
assert config.dummy2 is False
|
assert config.dummy2 is False
|
||||||
|
|
||||||
|
|
||||||
|
def test_force_default_on_freeze_multi():
|
||||||
|
dummy1 = BoolOption('dummy1', 'doc dummy', default=[False], properties=('force_default_on_freeze',), multi=True)
|
||||||
|
dummy2 = BoolOption('dummy2', 'doc dummy', default=[True], multi=True)
|
||||||
|
group = OptionDescription('group', '', [dummy1, dummy2])
|
||||||
|
config = Config(group)
|
||||||
|
config.dummy1.append(True)
|
||||||
|
config.dummy2.append(False)
|
||||||
|
setting = config.cfgimpl_get_settings()
|
||||||
|
setting[dummy1].append('frozen')
|
||||||
|
setting[dummy2].append('frozen')
|
||||||
|
assert config.dummy1 == [False]
|
||||||
|
assert config.dummy2 == [True, False]
|
||||||
|
|
||||||
|
|
||||||
def test_overrides_changes_option_value():
|
def test_overrides_changes_option_value():
|
||||||
"with config.override(), the default is changed and the value is changed"
|
"with config.override(), the default is changed and the value is changed"
|
||||||
descr = OptionDescription("test", "", [
|
descr = OptionDescription("test", "", [
|
||||||
|
|
|
@ -205,7 +205,7 @@ class Values(object):
|
||||||
elif is_frozen and 'force_default_on_freeze' in setting[opt]:
|
elif is_frozen and 'force_default_on_freeze' in setting[opt]:
|
||||||
value = self._getdefault(opt)
|
value = self._getdefault(opt)
|
||||||
if opt.impl_is_multi():
|
if opt.impl_is_multi():
|
||||||
value = Multi(value, self.context(), opt, path, validate)
|
value = Multi(value, self.context, opt, path, validate)
|
||||||
else:
|
else:
|
||||||
value = self._getvalue(opt, path, validate)
|
value = self._getvalue(opt, path, validate)
|
||||||
if validate:
|
if validate:
|
||||||
|
|
Loading…
Reference in New Issue