add test for callback not in multi
authorEmmanuel Garette <egarette@cadoles.com>
Tue, 11 Jun 2013 13:36:08 +0000 (15:36 +0200)
committerEmmanuel Garette <egarette@cadoles.com>
Tue, 11 Jun 2013 13:36:08 +0000 (15:36 +0200)
test/test_option_calculation.py

index d5dc0cc..1585a80 100644 (file)
@@ -276,6 +276,18 @@ def test_freeze_and_has_callback():
     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():
     val1 = StrOption('val1', "", multi=True)
     val2 = StrOption('val2', "", multi=True, callback=return_value)