add DynOptionDescription
This commit is contained in:
@ -51,30 +51,6 @@ def is_config(config, **kwargs):
|
||||
return 'no'
|
||||
|
||||
|
||||
def make_description():
|
||||
gcoption = ChoiceOption('name', 'GC name', ('ref', 'framework'), 'ref')
|
||||
gcdummy = BoolOption('dummy', 'dummy', default=False)
|
||||
objspaceoption = ChoiceOption('objspace', 'Object space',
|
||||
('std', 'thunk'), 'std')
|
||||
booloption = BoolOption('bool', 'Test boolean option', default=True)
|
||||
intoption = IntOption('int', 'Test int option', default=0)
|
||||
intoption2 = IntOption('int', 'Test int option', default=0)
|
||||
floatoption = FloatOption('float', 'Test float option', default=2.3)
|
||||
stroption = StrOption('str', 'Test string option', default="abc")
|
||||
boolop = BoolOption('boolop', 'Test boolean option op', default=True)
|
||||
wantref_option = BoolOption('wantref', 'Test requires', default=False,
|
||||
requires=({'option': boolop, 'expected': True, 'action': 'hidden'},))
|
||||
wantframework_option = BoolOption('wantframework', 'Test requires',
|
||||
default=False,
|
||||
requires=({'option': boolop, 'expected': True, 'action': 'hidden'},))
|
||||
gcgroup = OptionDescription('gc', '', [gcoption, gcdummy, floatoption, intoption2])
|
||||
descr = OptionDescription('constraints', '', [gcgroup, booloption, objspaceoption,
|
||||
wantref_option, stroption,
|
||||
wantframework_option,
|
||||
intoption, boolop])
|
||||
return descr
|
||||
|
||||
|
||||
def make_description_duplicates():
|
||||
gcoption = ChoiceOption('name', 'GC name', ('ref', 'framework'), 'ref')
|
||||
## dummy 1
|
||||
@ -929,3 +905,26 @@ def test_callback_multi_list_params_key():
|
||||
cfg = Config(maconfig)
|
||||
cfg.read_write()
|
||||
assert cfg.val2.val2 == ['val', 'val']
|
||||
|
||||
|
||||
def test_masterslaves_callback_description():
|
||||
st1 = StrOption('st1', "", multi=True)
|
||||
st2 = StrOption('st2', "", multi=True, callback=return_value, callback_params={'': ((st1, False),)})
|
||||
stm = OptionDescription('st1', '', [st1, st2])
|
||||
stm.impl_set_group_type(groups.master)
|
||||
st = OptionDescription('st', '', [stm])
|
||||
od = OptionDescription('od', '', [st])
|
||||
od2 = OptionDescription('od', '', [od])
|
||||
cfg = Config(od2)
|
||||
owner = cfg.cfgimpl_get_settings().getowner()
|
||||
st1 = cfg.unwrap_from_path('od.st.st1.st1')
|
||||
st2 = cfg.unwrap_from_path('od.st.st1.st2')
|
||||
assert cfg.od.st.st1.st1 == []
|
||||
assert cfg.od.st.st1.st2 == []
|
||||
assert cfg.getowner(st1) == owners.default
|
||||
assert cfg.getowner(st2) == owners.default
|
||||
##
|
||||
cfg.od.st.st1.st1.append('yes')
|
||||
assert cfg.od.st.st1.st1 == ['yes']
|
||||
assert cfg.od.st.st1.st2 == ['yes']
|
||||
assert cfg.getowner(st1) == owner
|
||||
|
Reference in New Issue
Block a user