mandatories masterslaves with consistency and default value is acceptable
authorEmmanuel Garette <egarette@cadoles.com>
Wed, 7 Dec 2016 16:28:31 +0000 (17:28 +0100)
committerEmmanuel Garette <egarette@cadoles.com>
Wed, 7 Dec 2016 16:28:31 +0000 (17:28 +0100)
test/test_option_consistency.py
tiramisu/setting.py

index a10db36..35d140d 100644 (file)
@@ -753,3 +753,15 @@ def test_consistency_warnings_error():
     with warnings.catch_warnings(record=True) as w:
         raises(ValueError, "cfg.a = 1")
     assert w == []
+
+
+def test_consistency_network_netmask_mandatory():
+    a = NetworkOption('a', '', multi=True, properties=('mandatory',), default=[u'0.0.0.0'])
+    b = NetmaskOption('b', '', multi=True, properties=('mandatory',), default_multi=u'0.0.0.0')
+    od = OptionDescription('a', '', [a, b])
+    od.impl_set_group_type(groups.master)
+    b.impl_add_consistency('network_netmask', a)
+    c = Config(od)
+    c.read_only()
+    c.cfgimpl_get_settings().remove('mandatory')
+    c.make_dict()
index 8dfae0f..26d5af2 100644 (file)
@@ -485,7 +485,7 @@ class Settings(object):
             elif 'empty' in properties and \
                     'empty' in setting_properties and \
                     self._getcontext().cfgimpl_get_values()._isempty(
-                        opt_or_descr, value, force_allow_empty_list=True):
+                        opt_or_descr, value, force_allow_empty_list=True, index=index):
                 properties.add('mandatory')
             # should return 'frozen' only when tried to modify a value
             if check_frozen and 'everything_frozen' in setting_properties: