diff --git a/test/test_option_calculation.py b/test/test_option_calculation.py index eebbd3a..b655bc4 100644 --- a/test/test_option_calculation.py +++ b/test/test_option_calculation.py @@ -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') diff --git a/tiramisu/autolib.py b/tiramisu/autolib.py index bb7698f..1f86e54 100644 --- a/tiramisu/autolib.py +++ b/tiramisu/autolib.py @@ -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 "