add test for callback not in multi

This commit is contained in:
Emmanuel Garette 2013-06-11 15:36:08 +02:00
parent b2538f6f0b
commit ada5bfbf6c
1 changed files with 12 additions and 0 deletions

View File

@ -276,6 +276,18 @@ def test_freeze_and_has_callback():
raises(PropertiesOptionError, "config.gc.dummy = True") raises(PropertiesOptionError, "config.gc.dummy = True")
def test_callback():
val1 = StrOption('val1', "", callback=return_value)
maconfig = OptionDescription('rootconfig', '', [val1])
cfg = Config(maconfig)
cfg.read_write()
assert cfg.val1 == 'val'
cfg.val1 = 'new-val'
assert cfg.val1 == 'new-val'
del(cfg.val1)
assert cfg.val1 == 'val'
def test_callback_master_and_slaves(): def test_callback_master_and_slaves():
val1 = StrOption('val1', "", multi=True) val1 = StrOption('val1', "", multi=True)
val2 = StrOption('val2', "", multi=True, callback=return_value) val2 = StrOption('val2', "", multi=True, callback=return_value)