test lenght for a slave that have list as callback_params
This commit is contained in:
parent
372ce5ea1e
commit
7b0a9891e2
|
@ -447,6 +447,24 @@ def test_callback_master_and_slaves_master():
|
|||
assert cfg.val1.val2 == [None, None]
|
||||
|
||||
|
||||
def test_callback_slave():
|
||||
val1 = StrOption('val1', "", multi=True)
|
||||
val2 = StrOption('val2', "", multi=True, callback=return_value, callback_params={'': (['string', 'new'],)})
|
||||
interface1 = OptionDescription('val1', '', [val1, val2])
|
||||
interface1.impl_set_group_type(groups.master)
|
||||
maconfig = OptionDescription('rootconfig', '', [interface1])
|
||||
cfg = Config(maconfig)
|
||||
cfg.read_write()
|
||||
cfg.val1.val1 = ['val']
|
||||
assert cfg.val1.val2 == ['string']
|
||||
cfg.val1.val1 = ['val', 'val1']
|
||||
assert cfg.val1.val2 == ['string', 'new']
|
||||
cfg.val1.val1 = ['val', 'val1', 'val2']
|
||||
assert cfg.val1.val2 == ['string', 'new', None]
|
||||
cfg.val1.val1 = ['val', 'val1', 'val2', 'val3']
|
||||
assert cfg.val1.val2 == ['string', 'new', None, None]
|
||||
|
||||
|
||||
def test_callback_master_and_slaves_master2():
|
||||
val1 = StrOption('val1', "", multi=True)
|
||||
val2 = StrOption('val2', "", multi=True, default_multi='val2')
|
||||
|
|
|
@ -236,7 +236,6 @@ def carry_out_calculation(option, context, callback, callback_params,
|
|||
if index < len(ret):
|
||||
ret = ret[index]
|
||||
else:
|
||||
#FIXME really?
|
||||
ret = None
|
||||
else:
|
||||
raise SlaveError(_("callback cannot return a list for a "
|
||||
|
|
Loading…
Reference in New Issue