|
|
|
@ -57,7 +57,7 @@ def return_str(*args, **kwargs):
|
|
|
|
|
|
|
|
|
|
def test_build_dyndescription():
|
|
|
|
|
st1 = StrOption('st', '')
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st1], callback=return_list)
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st1], suffixes=Calculation(return_list))
|
|
|
|
|
od1 = OptionDescription('od', '', [dod])
|
|
|
|
|
cfg = Config(od1)
|
|
|
|
|
assert cfg.value.dict() == {'dodval1.stval1': None, 'dodval2.stval2': None}
|
|
|
|
@ -65,7 +65,7 @@ def test_build_dyndescription():
|
|
|
|
|
|
|
|
|
|
def test_build_dyndescription_raise():
|
|
|
|
|
st1 = StrOption('st', '')
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st1], callback=return_raise)
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st1], suffixes=Calculation(return_raise))
|
|
|
|
|
od1 = OptionDescription('od', '', [dod])
|
|
|
|
|
cfg = Config(od1)
|
|
|
|
|
raises(ConfigError, "cfg.value.dict()")
|
|
|
|
@ -73,7 +73,7 @@ def test_build_dyndescription_raise():
|
|
|
|
|
|
|
|
|
|
def test_build_dyndescription_not_list():
|
|
|
|
|
st1 = StrOption('st', '')
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st1], callback=return_str)
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st1], suffixes=Calculation(return_str))
|
|
|
|
|
od1 = OptionDescription('od', '', [dod])
|
|
|
|
|
cfg = Config(od1)
|
|
|
|
|
raises(ValueError, "cfg.value.dict()")
|
|
|
|
@ -81,7 +81,7 @@ def test_build_dyndescription_not_list():
|
|
|
|
|
|
|
|
|
|
def test_subpath_dyndescription():
|
|
|
|
|
st1 = StrOption('st', '')
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st1], callback=return_list)
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st1], suffixes=Calculation(return_list))
|
|
|
|
|
od1 = OptionDescription('od', '', [dod])
|
|
|
|
|
od2 = OptionDescription('od', '', [od1])
|
|
|
|
|
api = Config(od2)
|
|
|
|
@ -90,7 +90,7 @@ def test_subpath_dyndescription():
|
|
|
|
|
|
|
|
|
|
def test_list_dyndescription():
|
|
|
|
|
st = StrOption('st', '')
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], callback=return_list)
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], suffixes=Calculation(return_list))
|
|
|
|
|
od = OptionDescription('od', '', [dod])
|
|
|
|
|
od2 = OptionDescription('od', '', [od])
|
|
|
|
|
api = Config(od2)
|
|
|
|
@ -100,7 +100,7 @@ def test_list_dyndescription():
|
|
|
|
|
|
|
|
|
|
def test_unknown_dyndescription():
|
|
|
|
|
st = StrOption('st', '')
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], callback=return_list)
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], suffixes=Calculation(return_list))
|
|
|
|
|
od = OptionDescription('od', '', [dod])
|
|
|
|
|
od2 = OptionDescription('od', '', [od])
|
|
|
|
|
api = Config(od2)
|
|
|
|
@ -111,7 +111,7 @@ def test_unknown_dyndescription():
|
|
|
|
|
|
|
|
|
|
def test_getdoc_dyndescription():
|
|
|
|
|
st1 = StrOption('st', 'doc1')
|
|
|
|
|
dod = DynOptionDescription('dod', 'doc2', [st1], callback=return_list)
|
|
|
|
|
dod = DynOptionDescription('dod', 'doc2', [st1], suffixes=Calculation(return_list))
|
|
|
|
|
od1 = OptionDescription('od', '', [dod])
|
|
|
|
|
od2 = OptionDescription('od', '', [od1])
|
|
|
|
|
api = Config(od2)
|
|
|
|
@ -127,7 +127,7 @@ def test_getdoc_dyndescription():
|
|
|
|
|
|
|
|
|
|
def test_mod_dyndescription():
|
|
|
|
|
st = StrOption('st', '')
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], callback=return_list)
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], suffixes=Calculation(return_list))
|
|
|
|
|
od = OptionDescription('od', '', [dod])
|
|
|
|
|
od2 = OptionDescription('od', '', [od])
|
|
|
|
|
api = Config(od2)
|
|
|
|
@ -153,7 +153,7 @@ def test_mod_dyndescription():
|
|
|
|
|
|
|
|
|
|
def test_del_dyndescription():
|
|
|
|
|
st = StrOption('st', '')
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], callback=return_list)
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], suffixes=Calculation(return_list))
|
|
|
|
|
od = OptionDescription('od', '', [dod])
|
|
|
|
|
od2 = OptionDescription('od', '', [od])
|
|
|
|
|
api = Config(od2)
|
|
|
|
@ -168,7 +168,7 @@ def test_del_dyndescription():
|
|
|
|
|
|
|
|
|
|
def test_multi_dyndescription():
|
|
|
|
|
st = StrOption('st', '', multi=True)
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], callback=return_list)
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], suffixes=Calculation(return_list))
|
|
|
|
|
od = OptionDescription('od', '', [dod])
|
|
|
|
|
od2 = OptionDescription('od', '', [od])
|
|
|
|
|
api = Config(od2)
|
|
|
|
@ -195,7 +195,7 @@ def test_multi_dyndescription():
|
|
|
|
|
|
|
|
|
|
def test_prop_dyndescription():
|
|
|
|
|
st = StrOption('st', '', properties=('test',))
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], callback=return_list)
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], suffixes=Calculation(return_list))
|
|
|
|
|
od = OptionDescription('od', '', [dod])
|
|
|
|
|
od2 = OptionDescription('od', '', [od])
|
|
|
|
|
api = Config(od2)
|
|
|
|
@ -219,7 +219,7 @@ def test_prop_dyndescription():
|
|
|
|
|
|
|
|
|
|
def test_prop_dyndescription_force_store_value():
|
|
|
|
|
st = StrOption('st', '', properties=('force_store_value',))
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], callback=return_list)
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], suffixes=Calculation(return_list))
|
|
|
|
|
od = OptionDescription('od', '', [dod])
|
|
|
|
|
od2 = OptionDescription('od', '', [od])
|
|
|
|
|
raises(ConfigError, "Config(od2)")
|
|
|
|
@ -227,7 +227,7 @@ def test_prop_dyndescription_force_store_value():
|
|
|
|
|
|
|
|
|
|
def test_callback_dyndescription():
|
|
|
|
|
st = StrOption('st', '', Calculation(return_dynval))
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], callback=return_list)
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], suffixes=Calculation(return_list))
|
|
|
|
|
od = OptionDescription('od', '', [dod])
|
|
|
|
|
od2 = OptionDescription('od', '', [od])
|
|
|
|
|
api = Config(od2)
|
|
|
|
@ -250,7 +250,7 @@ def test_callback_dyndescription():
|
|
|
|
|
|
|
|
|
|
def test_callback_list_dyndescription():
|
|
|
|
|
st = StrOption('st', '', Calculation(return_list2), multi=True)
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], callback=return_list)
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], suffixes=Calculation(return_list))
|
|
|
|
|
od = OptionDescription('od', '', [dod])
|
|
|
|
|
od2 = OptionDescription('od', '', [od])
|
|
|
|
|
api = Config(od2)
|
|
|
|
@ -268,7 +268,7 @@ def test_callback_list_dyndescription():
|
|
|
|
|
|
|
|
|
|
def test_mandatory_dyndescription():
|
|
|
|
|
st = StrOption('st', '', properties=('mandatory',))
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], callback=return_list)
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], suffixes=Calculation(return_list))
|
|
|
|
|
od = OptionDescription('od', '', [dod])
|
|
|
|
|
od2 = OptionDescription('od', '', [od])
|
|
|
|
|
api = Config(od2)
|
|
|
|
@ -290,7 +290,7 @@ def test_mandatory_dyndescription():
|
|
|
|
|
def test_build_dyndescription_context():
|
|
|
|
|
val1 = StrOption('val1', '', ['val1', 'val2'], multi=True)
|
|
|
|
|
st1 = StrOption('st', '')
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st1], callback=return_list, callback_params=Params(ParamOption(val1)))
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st1], suffixes=Calculation(return_list, Params(ParamOption(val1))))
|
|
|
|
|
od1 = OptionDescription('od', '', [dod, val1])
|
|
|
|
|
cfg = Config(od1)
|
|
|
|
|
assert cfg.value.dict() == {'dodval1.stval1': None, 'dodval2.stval2': None, 'val1': ['val1', 'val2']}
|
|
|
|
@ -299,7 +299,7 @@ def test_build_dyndescription_context():
|
|
|
|
|
def test_subpath_dyndescription_context():
|
|
|
|
|
val1 = StrOption('val1', '', ['val1', 'val2'], multi=True)
|
|
|
|
|
st1 = StrOption('st', '')
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st1], callback=return_list, callback_params=Params(ParamOption(val1)))
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st1], suffixes=Calculation(return_list, Params(ParamOption(val1))))
|
|
|
|
|
od1 = OptionDescription('od', '', [dod, val1])
|
|
|
|
|
od2 = OptionDescription('od', '', [od1])
|
|
|
|
|
api = Config(od2)
|
|
|
|
@ -309,7 +309,7 @@ def test_subpath_dyndescription_context():
|
|
|
|
|
def test_list_dyndescription_context():
|
|
|
|
|
val1 = StrOption('val1', '', ['val1', 'val2'], multi=True)
|
|
|
|
|
st = StrOption('st', '')
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], callback=return_list, callback_params=Params(ParamOption(val1)))
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], suffixes=Calculation(return_list, Params(ParamOption(val1))))
|
|
|
|
|
od = OptionDescription('od', '', [dod, val1])
|
|
|
|
|
od2 = OptionDescription('od', '', [od])
|
|
|
|
|
api = Config(od2)
|
|
|
|
@ -321,7 +321,7 @@ def test_list_dyndescription_context():
|
|
|
|
|
def test_mod_dyndescription_context():
|
|
|
|
|
val1 = StrOption('val1', '', ['val1', 'val2'], multi=True)
|
|
|
|
|
st = StrOption('st', '')
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], callback=return_list, callback_params=Params(ParamOption(val1)))
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], suffixes=Calculation(return_list, Params(ParamOption(val1))))
|
|
|
|
|
od = OptionDescription('od', '', [dod, val1])
|
|
|
|
|
od2 = OptionDescription('od', '', [od])
|
|
|
|
|
api = Config(od2)
|
|
|
|
@ -345,7 +345,7 @@ def test_mod_dyndescription_context():
|
|
|
|
|
def test_del_dyndescription_context():
|
|
|
|
|
val1 = StrOption('val1', '', ['val1', 'val2'], multi=True)
|
|
|
|
|
st = StrOption('st', '')
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], callback=return_list, callback_params=Params(ParamOption(val1)))
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], suffixes=Calculation(return_list, Params(ParamOption(val1))))
|
|
|
|
|
od = OptionDescription('od', '', [dod, val1])
|
|
|
|
|
od2 = OptionDescription('od', '', [od])
|
|
|
|
|
api = Config(od2)
|
|
|
|
@ -361,7 +361,7 @@ def test_del_dyndescription_context():
|
|
|
|
|
def test_multi_dyndescription_context():
|
|
|
|
|
val1 = StrOption('val1', '', ['val1', 'val2'], multi=True)
|
|
|
|
|
st = StrOption('st', '', multi=True)
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], callback=return_list, callback_params=Params(ParamOption(val1)))
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], suffixes=Calculation(return_list, Params(ParamOption(val1))))
|
|
|
|
|
od = OptionDescription('od', '', [dod, val1])
|
|
|
|
|
od2 = OptionDescription('od', '', [od])
|
|
|
|
|
api = Config(od2)
|
|
|
|
@ -389,7 +389,7 @@ def test_multi_dyndescription_context():
|
|
|
|
|
def test_prop_dyndescription_context():
|
|
|
|
|
val1 = StrOption('val1', '', ['val1', 'val2'], multi=True)
|
|
|
|
|
st = StrOption('st', '', properties=('test',))
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], callback=return_list, callback_params=Params(ParamOption(val1)))
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], suffixes=Calculation(return_list, Params(ParamOption(val1))))
|
|
|
|
|
od = OptionDescription('od', '', [dod, val1])
|
|
|
|
|
od2 = OptionDescription('od', '', [od])
|
|
|
|
|
api = Config(od2)
|
|
|
|
@ -406,7 +406,7 @@ def test_prop_dyndescription_context():
|
|
|
|
|
def test_callback_dyndescription_context():
|
|
|
|
|
val1 = StrOption('val1', '', ['val1', 'val2'], multi=True)
|
|
|
|
|
st = StrOption('st', '', Calculation(return_dynval))
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], callback=return_list)
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], suffixes=Calculation(return_list))
|
|
|
|
|
od = OptionDescription('od', '', [dod, val1])
|
|
|
|
|
od2 = OptionDescription('od', '', [od])
|
|
|
|
|
api = Config(od2)
|
|
|
|
@ -430,7 +430,7 @@ def test_callback_dyndescription_context():
|
|
|
|
|
def test_mandatory_dyndescription_context():
|
|
|
|
|
val1 = StrOption('val1', '', ['val1', 'val2'], multi=True)
|
|
|
|
|
st = StrOption('st', '', properties=('mandatory',))
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], callback=return_list, callback_params=Params(ParamOption(val1)))
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], suffixes=Calculation(return_list, Params(ParamOption(val1))))
|
|
|
|
|
od = OptionDescription('od', '', [dod, val1])
|
|
|
|
|
od2 = OptionDescription('od', '', [od])
|
|
|
|
|
api = Config(od2)
|
|
|
|
@ -452,7 +452,7 @@ def test_mandatory_dyndescription_context():
|
|
|
|
|
def test_increase_dyndescription_context():
|
|
|
|
|
val1 = StrOption('val1', '', ['val1', 'val2'], multi=True)
|
|
|
|
|
st = StrOption('st', '', properties=('mandatory',))
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], callback=return_list, callback_params=Params(ParamOption(val1)))
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], suffixes=Calculation(return_list, Params(ParamOption(val1))))
|
|
|
|
|
od = OptionDescription('od', '', [dod, val1])
|
|
|
|
|
od2 = OptionDescription('od', '', [od])
|
|
|
|
|
api = Config(od2)
|
|
|
|
@ -469,7 +469,7 @@ def test_increase_dyndescription_context():
|
|
|
|
|
def test_decrease_dyndescription_context():
|
|
|
|
|
val1 = StrOption('val1', '', ['val1', 'val2'], multi=True)
|
|
|
|
|
st = StrOption('st', '', properties=('mandatory',))
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], callback=return_list, callback_params=Params(ParamOption(val1)))
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], suffixes=Calculation(return_list, Params(ParamOption(val1))))
|
|
|
|
|
od = OptionDescription('od', '', [dod, val1])
|
|
|
|
|
od2 = OptionDescription('od', '', [od])
|
|
|
|
|
api = Config(od2)
|
|
|
|
@ -500,7 +500,7 @@ def test_dyndescription_root():
|
|
|
|
|
'expected': ParamValue(False),
|
|
|
|
|
'default': ParamValue(None)}))
|
|
|
|
|
st1 = StrOption('st', '', properties=(disabled_property,))
|
|
|
|
|
dod = DynOptionDescription('dod', '', [boolean, st1], callback=return_list)
|
|
|
|
|
dod = DynOptionDescription('dod', '', [boolean, st1], suffixes=Calculation(return_list))
|
|
|
|
|
raises(ConfigError, "Config(dod)")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -512,7 +512,7 @@ def test_requires_dyndescription():
|
|
|
|
|
'expected': ParamValue(False),
|
|
|
|
|
'default': ParamValue(None)}))
|
|
|
|
|
st1 = StrOption('st', '', properties=(disabled_property,))
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st1], callback=return_list)
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st1], suffixes=Calculation(return_list))
|
|
|
|
|
od1 = OptionDescription('od', '', [dod])
|
|
|
|
|
od2 = OptionDescription('od', '', [od1, boolean])
|
|
|
|
|
api = Config(od2)
|
|
|
|
@ -567,7 +567,7 @@ def test_requires_dyndescription_boolean():
|
|
|
|
|
'expected': ParamValue(False),
|
|
|
|
|
'default': ParamValue(None)}))
|
|
|
|
|
st = StrOption('st', '', properties=(disabled_property,))
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], callback=return_list)
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], suffixes=Calculation(return_list))
|
|
|
|
|
od = OptionDescription('od', '', [dod])
|
|
|
|
|
od2 = OptionDescription('od', '', [od, boolean1, boolean])
|
|
|
|
|
cfg = Config(od2)
|
|
|
|
@ -599,7 +599,7 @@ def test_requires_dyndescription_in_dyn():
|
|
|
|
|
'expected': ParamValue(False),
|
|
|
|
|
'default': ParamValue(None)}))
|
|
|
|
|
st = StrOption('st', '', properties=(disabled_property,))
|
|
|
|
|
dod = DynOptionDescription('dod', '', [boolean, st], callback=return_list)
|
|
|
|
|
dod = DynOptionDescription('dod', '', [boolean, st], suffixes=Calculation(return_list))
|
|
|
|
|
od = OptionDescription('od', '', [dod])
|
|
|
|
|
od2 = OptionDescription('od', '', [od])
|
|
|
|
|
cfg = Config(od2)
|
|
|
|
@ -632,7 +632,7 @@ def test_requires_dyndescription2():
|
|
|
|
|
kwargs={'condition': ParamOption(boolean, raisepropertyerror=True),
|
|
|
|
|
'expected': ParamValue(False),
|
|
|
|
|
'default': ParamValue(None)}))
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st1], callback=return_list, properties=(disabled_property,))
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st1], suffixes=Calculation(return_list), properties=(disabled_property,))
|
|
|
|
|
od1 = OptionDescription('od', '', [dod])
|
|
|
|
|
od2 = OptionDescription('od', '', [od1, boolean])
|
|
|
|
|
api = Config(od2)
|
|
|
|
@ -676,7 +676,7 @@ def test_requires_dyndescription2():
|
|
|
|
|
def test_validator_dyndescription():
|
|
|
|
|
val1 = StrOption('val1', '', ['val1', 'val2'], multi=True)
|
|
|
|
|
st = StrOption('st', '', validator=return_true, validator_params=Params((ParamValue('yes'),)), default='val')
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], callback=return_list)
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], suffixes=Calculation(return_list))
|
|
|
|
|
od = OptionDescription('od', '', [dod, val1])
|
|
|
|
|
od2 = OptionDescription('od', '', [od])
|
|
|
|
|
api = Config(od2)
|
|
|
|
@ -688,7 +688,7 @@ def test_validator_dyndescription():
|
|
|
|
|
def test_makedict_dyndescription_context():
|
|
|
|
|
val1 = StrOption('val1', '', ['val1', 'val2'], multi=True)
|
|
|
|
|
st = StrOption('st', '')
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], callback=return_list)
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], suffixes=Calculation(return_list))
|
|
|
|
|
od = OptionDescription('od', '', [dod, val1])
|
|
|
|
|
od2 = OptionDescription('od', '', [od])
|
|
|
|
|
api = Config(od2)
|
|
|
|
@ -703,7 +703,7 @@ def test_makedict_dyndescription_context():
|
|
|
|
|
def test_find_dyndescription_context():
|
|
|
|
|
val1 = StrOption('val1', '', ['val1', 'val2'], multi=True)
|
|
|
|
|
st = StrOption('st', '')
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], callback=return_list)
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], suffixes=Calculation(return_list))
|
|
|
|
|
od = OptionDescription('od', '', [dod, val1])
|
|
|
|
|
od2 = OptionDescription('od', '', [od])
|
|
|
|
|
api = Config(od2)
|
|
|
|
@ -721,7 +721,7 @@ def test_find_dyndescription_context():
|
|
|
|
|
def test_information_dyndescription_context():
|
|
|
|
|
val1 = StrOption('val1', '', ['val1', 'val2'], multi=True)
|
|
|
|
|
st = StrOption('st', '')
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], callback=return_list)
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], suffixes=Calculation(return_list))
|
|
|
|
|
od = OptionDescription('od', '', [dod, val1])
|
|
|
|
|
od2 = OptionDescription('od', '', [od])
|
|
|
|
|
dod.impl_set_information('testod', 'val1')
|
|
|
|
@ -738,7 +738,7 @@ def test_information_dyndescription_context():
|
|
|
|
|
def test_consistency_dyndescription():
|
|
|
|
|
st1 = StrOption('st', '')
|
|
|
|
|
st2 = StrOption('st2', '')
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st1, st2], callback=return_list)
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st1, st2], suffixes=Calculation(return_list))
|
|
|
|
|
od1 = OptionDescription('od', '', [dod])
|
|
|
|
|
st1.impl_add_consistency('not_equal', st2)
|
|
|
|
|
od2 = OptionDescription('od', '', [od1])
|
|
|
|
@ -762,7 +762,7 @@ def test_consistency_dyndescription():
|
|
|
|
|
def test_consistency_dyndescription_default():
|
|
|
|
|
st = StrOption('st', '', 'yes')
|
|
|
|
|
st2 = StrOption('st2', '')
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st, st2], callback=return_list)
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st, st2], suffixes=Calculation(return_list))
|
|
|
|
|
od = OptionDescription('od', '', [dod])
|
|
|
|
|
st.impl_add_consistency('not_equal', st2)
|
|
|
|
|
od2 = OptionDescription('od', '', [od])
|
|
|
|
@ -774,7 +774,7 @@ def test_consistency_dyndescription_default():
|
|
|
|
|
def test_consistency_dyndescription_default_multi2():
|
|
|
|
|
st = StrOption('st', '', ['yes'], multi=True)
|
|
|
|
|
st2 = StrOption('st2', '', ['yes'], multi=True)
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st, st2], callback=return_list)
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st, st2], suffixes=Calculation(return_list))
|
|
|
|
|
dod
|
|
|
|
|
# FIXME raises(ValueError, "st.impl_add_consistency('not_equal', st2)")
|
|
|
|
|
|
|
|
|
@ -783,7 +783,7 @@ def test_consistency_only_one_dyndescription():
|
|
|
|
|
st = StrOption('st', '')
|
|
|
|
|
st
|
|
|
|
|
st2 = StrOption('st2', '')
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st2], callback=return_list)
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st2], suffixes=Calculation(return_list))
|
|
|
|
|
raises(ConfigError, "st.impl_add_consistency('not_equal', st2)")
|
|
|
|
|
raises(ConfigError, "st2.impl_add_consistency('not_equal', st)")
|
|
|
|
|
|
|
|
|
@ -792,7 +792,7 @@ def test_consistency_became_dyndescription():
|
|
|
|
|
st = StrOption('st', '')
|
|
|
|
|
st2 = StrOption('st2', '')
|
|
|
|
|
st2.impl_add_consistency('not_equal', st)
|
|
|
|
|
od = DynOptionDescription('dod', '', [st2], callback=return_list)
|
|
|
|
|
od = DynOptionDescription('dod', '', [st2], suffixes=Calculation(return_list))
|
|
|
|
|
od2 = OptionDescription('od', '', [od, st])
|
|
|
|
|
od2
|
|
|
|
|
raises(ConfigError, "c = Config(od2)")
|
|
|
|
@ -802,7 +802,7 @@ def test_consistency_became_dyndescription2():
|
|
|
|
|
st = StrOption('st', '')
|
|
|
|
|
st2 = StrOption('st2', '')
|
|
|
|
|
st.impl_add_consistency('not_equal', st2)
|
|
|
|
|
od = DynOptionDescription('dod', '', [st2], callback=return_list)
|
|
|
|
|
od = DynOptionDescription('dod', '', [st2], suffixes=Calculation(return_list))
|
|
|
|
|
od2 = OptionDescription('od', '', [od, st])
|
|
|
|
|
od2
|
|
|
|
|
raises(ConfigError, "c = Config(od2)")
|
|
|
|
@ -812,7 +812,7 @@ def test_consistency_external_dyndescription():
|
|
|
|
|
st = StrOption('st', '')
|
|
|
|
|
st1 = StrOption('st1', '')
|
|
|
|
|
st2 = StrOption('st2', '')
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st1, st2], callback=return_list)
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st1, st2], suffixes=Calculation(return_list))
|
|
|
|
|
od = OptionDescription('od', '', [dod, st])
|
|
|
|
|
od
|
|
|
|
|
raises(ConfigError, "st.impl_add_consistency('not_equal', st2)")
|
|
|
|
@ -821,10 +821,10 @@ def test_consistency_external_dyndescription():
|
|
|
|
|
def test_consistency_notsame_dyndescription():
|
|
|
|
|
st1 = StrOption('st1', '')
|
|
|
|
|
st2 = StrOption('st2', '')
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st1, st2], callback=return_list)
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st1, st2], suffixes=Calculation(return_list))
|
|
|
|
|
tst1 = StrOption('tst1', '')
|
|
|
|
|
tst2 = StrOption('tst2', '')
|
|
|
|
|
tdod = DynOptionDescription('tdod', '', [tst1, tst2], callback=return_list)
|
|
|
|
|
tdod = DynOptionDescription('tdod', '', [tst1, tst2], suffixes=Calculation(return_list))
|
|
|
|
|
od = OptionDescription('od', '', [dod, tdod])
|
|
|
|
|
od
|
|
|
|
|
raises(ConfigError, "st1.impl_add_consistency('not_equal', tst1)")
|
|
|
|
@ -851,7 +851,7 @@ def test_all_dyndescription():
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st, ip, network, netmask, ch, ch1,
|
|
|
|
|
boo, intr, floa, uni, port, broad,
|
|
|
|
|
domain, email, url, username,
|
|
|
|
|
filename], callback=return_list)
|
|
|
|
|
filename], suffixes=Calculation(return_list))
|
|
|
|
|
od = OptionDescription('od', '', [dod])
|
|
|
|
|
api = Config(od)
|
|
|
|
|
assert api.option('dodval1.stval1').value.get() is None
|
|
|
|
@ -928,7 +928,7 @@ def test_all_dyndescription():
|
|
|
|
|
def test_consistency_ip_netmask_dyndescription():
|
|
|
|
|
ipa = IPOption('a', '')
|
|
|
|
|
netb = NetmaskOption('b', '')
|
|
|
|
|
dod = DynOptionDescription('dod', '', [ipa, netb], callback=return_list)
|
|
|
|
|
dod = DynOptionDescription('dod', '', [ipa, netb], suffixes=Calculation(return_list))
|
|
|
|
|
netb.impl_add_consistency('ip_netmask', ipa)
|
|
|
|
|
od1 = OptionDescription('od', '', [dod])
|
|
|
|
|
cfg = Config(od1)
|
|
|
|
@ -944,7 +944,7 @@ def test_consistency_ip_in_network_dyndescription():
|
|
|
|
|
neta = NetworkOption('a', '')
|
|
|
|
|
netb = NetmaskOption('b', '')
|
|
|
|
|
ipc = IPOption('c', '')
|
|
|
|
|
dod = DynOptionDescription('dod', '', [neta, netb, ipc], callback=return_list)
|
|
|
|
|
dod = DynOptionDescription('dod', '', [neta, netb, ipc], suffixes=Calculation(return_list))
|
|
|
|
|
ipc.impl_add_consistency('in_network', neta, netb)
|
|
|
|
|
od1 = OptionDescription('od', '', [dod])
|
|
|
|
|
cfg = Config(od1)
|
|
|
|
@ -957,7 +957,7 @@ def test_leadership_dyndescription():
|
|
|
|
|
st1 = StrOption('st1', "", multi=True)
|
|
|
|
|
st2 = StrOption('st2', "", multi=True)
|
|
|
|
|
stm = Leadership('st1', '', [st1, st2])
|
|
|
|
|
st = DynOptionDescription('st', '', [stm], callback=return_list)
|
|
|
|
|
st = DynOptionDescription('st', '', [stm], suffixes=Calculation(return_list))
|
|
|
|
|
od = OptionDescription('od', '', [st])
|
|
|
|
|
od2 = OptionDescription('od', '', [od])
|
|
|
|
|
api = Config(od2)
|
|
|
|
@ -1015,7 +1015,7 @@ def test_leadership_default_multi_dyndescription():
|
|
|
|
|
st1 = StrOption('st1', "", multi=True)
|
|
|
|
|
st2 = StrOption('st2', "", multi=True, default_multi='no')
|
|
|
|
|
stm = Leadership('st1', '', [st1, st2])
|
|
|
|
|
st = DynOptionDescription('st', '', [stm], callback=return_list)
|
|
|
|
|
st = DynOptionDescription('st', '', [stm], suffixes=Calculation(return_list))
|
|
|
|
|
od = OptionDescription('od', '', [st])
|
|
|
|
|
od2 = OptionDescription('od', '', [od])
|
|
|
|
|
api = Config(od2)
|
|
|
|
@ -1040,7 +1040,7 @@ def test_leadership_dyndescription_param():
|
|
|
|
|
st1 = StrOption('st1', "", multi=True)
|
|
|
|
|
st2 = StrOption('st2', "", multi=True)
|
|
|
|
|
stm = Leadership('st1', '', [st1, st2])
|
|
|
|
|
st = DynOptionDescription('st', '', [stm], callback=return_list, callback_params=Params(ParamOption(val1)))
|
|
|
|
|
st = DynOptionDescription('st', '', [stm], suffixes=Calculation(return_list, Params(ParamOption(val1))))
|
|
|
|
|
od = OptionDescription('od', '', [st, odval])
|
|
|
|
|
od2 = OptionDescription('od', '', [od])
|
|
|
|
|
cfg = Config(od2)
|
|
|
|
@ -1098,7 +1098,7 @@ def test_leadership_default_multi_dyndescription():
|
|
|
|
|
st1 = StrOption('st1', "", multi=True)
|
|
|
|
|
st2 = StrOption('st2', "", multi=True, default_multi='no')
|
|
|
|
|
stm = Leadership('st1', '', [st1, st2])
|
|
|
|
|
st = DynOptionDescription('st', '', [stm], callback=return_list)
|
|
|
|
|
st = DynOptionDescription('st', '', [stm], suffixes=Calculation(return_list))
|
|
|
|
|
od = OptionDescription('od', '', [st])
|
|
|
|
|
od2 = OptionDescription('od', '', [od])
|
|
|
|
|
api = Config(od2)
|
|
|
|
@ -1179,7 +1179,7 @@ def test_leadership_dyndescription_param_leader():
|
|
|
|
|
st1 = StrOption('st1', "", multi=True)
|
|
|
|
|
st2 = StrOption('st2', "", multi=True)
|
|
|
|
|
stm = Leadership('st1', '', [st1, st2])
|
|
|
|
|
st = DynOptionDescription('st', '', [stm], callback=return_list, callback_params=Params(ParamOption(val1)))
|
|
|
|
|
st = DynOptionDescription('st', '', [stm], suffixes=Calculation(return_list, Params(ParamOption(val1))))
|
|
|
|
|
od = OptionDescription('od', '', [st, odval])
|
|
|
|
|
od2 = OptionDescription('od', '', [od])
|
|
|
|
|
cfg = Config(od2)
|
|
|
|
@ -1190,7 +1190,7 @@ def test_leadership_default_multi_dyndescription():
|
|
|
|
|
st1 = StrOption('st1', "", multi=True)
|
|
|
|
|
st2 = StrOption('st2', "", multi=True, default_multi='no')
|
|
|
|
|
stm = Leadership('st1', '', [st1, st2])
|
|
|
|
|
st = DynOptionDescription('st', '', [stm], callback=return_list)
|
|
|
|
|
st = DynOptionDescription('st', '', [stm], suffixes=Calculation(return_list))
|
|
|
|
|
od = OptionDescription('od', '', [st])
|
|
|
|
|
od2 = OptionDescription('od', '', [od])
|
|
|
|
|
api = Config(od2)
|
|
|
|
@ -1217,7 +1217,7 @@ def test_leadership_dyndescription_param_follower():
|
|
|
|
|
st1 = StrOption('st1', "", multi=True)
|
|
|
|
|
st2 = StrOption('st2', "", multi=True)
|
|
|
|
|
stm = Leadership('st1', '', [st1, st2])
|
|
|
|
|
st = DynOptionDescription('st', '', [stm], callback=return_list, callback_params=Params(ParamOption(val2)))
|
|
|
|
|
st = DynOptionDescription('st', '', [stm], suffixes=Calculation(return_list, Params(ParamOption(val2))))
|
|
|
|
|
od = OptionDescription('od', '', [st, odval])
|
|
|
|
|
od2 = OptionDescription('od', '', [od])
|
|
|
|
|
cfg = Config(od2)
|
|
|
|
@ -1228,7 +1228,7 @@ def test_leadership_default_multi_dyndescription():
|
|
|
|
|
st1 = StrOption('st1', "", multi=True)
|
|
|
|
|
st2 = StrOption('st2', "", multi=True, default_multi='no')
|
|
|
|
|
stm = Leadership('st1', '', [st1, st2])
|
|
|
|
|
st = DynOptionDescription('st', '', [stm], callback=return_list)
|
|
|
|
|
st = DynOptionDescription('st', '', [stm], suffixes=Calculation(return_list))
|
|
|
|
|
od = OptionDescription('od', '', [st])
|
|
|
|
|
od2 = OptionDescription('od', '', [od])
|
|
|
|
|
api = Config(od2)
|
|
|
|
@ -1252,7 +1252,7 @@ def test_leadership_submulti_dyndescription():
|
|
|
|
|
st1 = StrOption('st1', "", multi=True)
|
|
|
|
|
st2 = StrOption('st2', "", multi=submulti)
|
|
|
|
|
stm = Leadership('st1', '', [st1, st2])
|
|
|
|
|
std = DynOptionDescription('st', '', [stm], callback=return_list)
|
|
|
|
|
std = DynOptionDescription('st', '', [stm], suffixes=Calculation(return_list))
|
|
|
|
|
od1 = OptionDescription('od', '', [std])
|
|
|
|
|
od2 = OptionDescription('od', '', [od1])
|
|
|
|
|
api = Config(od2)
|
|
|
|
@ -1284,7 +1284,7 @@ def test_leadership_callback_dyndescription():
|
|
|
|
|
st1 = StrOption('st1', "", multi=True)
|
|
|
|
|
st2 = StrOption('st2', "", Calculation(return_dynval, Params(kwargs={'value': ParamOption(st1)})), multi=True)
|
|
|
|
|
stm = Leadership('st1', '', [st1, st2])
|
|
|
|
|
st1 = DynOptionDescription('st', '', [stm], callback=return_list)
|
|
|
|
|
st1 = DynOptionDescription('st', '', [stm], suffixes=Calculation(return_list))
|
|
|
|
|
od1 = OptionDescription('od', '', [st1])
|
|
|
|
|
od2 = OptionDescription('od', '', [od1])
|
|
|
|
|
api = Config(od2)
|
|
|
|
@ -1345,7 +1345,7 @@ def test_leadership_callback_value_dyndescription():
|
|
|
|
|
st1 = StrOption('st1', "", multi=True)
|
|
|
|
|
st2 = StrOption('st2', "", Calculation(return_dynval, Params(kwargs={'value': ParamValue('val')})), multi=True)
|
|
|
|
|
stm = Leadership('st1', '', [st1, st2])
|
|
|
|
|
st = DynOptionDescription('st', '', [stm], callback=return_list)
|
|
|
|
|
st = DynOptionDescription('st', '', [stm], suffixes=Calculation(return_list))
|
|
|
|
|
od = OptionDescription('od', '', [st])
|
|
|
|
|
od2 = OptionDescription('od', '', [od])
|
|
|
|
|
api = Config(od2)
|
|
|
|
@ -1361,7 +1361,7 @@ def test_leadership_callback_nomulti_dyndescription():
|
|
|
|
|
st1 = StrOption('st1', "", multi=True)
|
|
|
|
|
st2 = StrOption('st2', "", Calculation(return_dynval, Params(ParamOption(v11))), multi=True)
|
|
|
|
|
stm = Leadership('st1', '', [st1, st2])
|
|
|
|
|
stt = DynOptionDescription('st', '', [stm], callback=return_list)
|
|
|
|
|
stt = DynOptionDescription('st', '', [stm], suffixes=Calculation(return_list))
|
|
|
|
|
od1 = OptionDescription('od', '', [stt])
|
|
|
|
|
od2 = OptionDescription('od', '', [od1, v11])
|
|
|
|
|
api = Config(od2)
|
|
|
|
@ -1376,7 +1376,7 @@ def test_leadership_callback_samegroup_dyndescription():
|
|
|
|
|
st2 = StrOption('st2', "", multi=True)
|
|
|
|
|
st3 = StrOption('st3', "", Calculation(return_dynval, Params(ParamOption(st2))), multi=True)
|
|
|
|
|
stm = Leadership('st1', '', [st1, st2, st3])
|
|
|
|
|
stt = DynOptionDescription('st', '', [stm], callback=return_list)
|
|
|
|
|
stt = DynOptionDescription('st', '', [stm], suffixes=Calculation(return_list))
|
|
|
|
|
od1 = OptionDescription('od', '', [stt])
|
|
|
|
|
od2 = OptionDescription('od', '', [od1])
|
|
|
|
|
api = Config(od2)
|
|
|
|
@ -1419,7 +1419,7 @@ def test_leadership_callback_samegroup_dyndescription():
|
|
|
|
|
|
|
|
|
|
def test_invalid_conflict_dyndescription():
|
|
|
|
|
st = StrOption('st', '')
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], callback=return_list)
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st], suffixes=Calculation(return_list))
|
|
|
|
|
dodinvalid = StrOption('dodinvalid', '')
|
|
|
|
|
dod, dodinvalid
|
|
|
|
|
raises(ConflictError, "OptionDescription('od', '', [dod, dodinvalid])")
|
|
|
|
@ -1429,33 +1429,33 @@ def test_invalid_subod_dyndescription():
|
|
|
|
|
st2 = StrOption('st2', '')
|
|
|
|
|
od1 = OptionDescription('od1', '', [st2])
|
|
|
|
|
od1
|
|
|
|
|
raises(ConfigError, "DynOptionDescription('dod', '', [od1], callback=return_list)")
|
|
|
|
|
raises(ConfigError, "DynOptionDescription('dod', '', [od1], suffixes=Calculation(return_list))")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_invalid_subdynod_dyndescription():
|
|
|
|
|
st2 = StrOption('st2', '')
|
|
|
|
|
od1 = DynOptionDescription('od1', '', [st2], callback=return_list)
|
|
|
|
|
od1 = DynOptionDescription('od1', '', [st2], suffixes=Calculation(return_list))
|
|
|
|
|
od1
|
|
|
|
|
raises(ConfigError, "DynOptionDescription('dod', '', [od1], callback=return_list)")
|
|
|
|
|
raises(ConfigError, "DynOptionDescription('dod', '', [od1], suffixes=Calculation(return_list))")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_invalid_symlink_dyndescription():
|
|
|
|
|
st = StrOption('st', '')
|
|
|
|
|
st2 = SymLinkOption('st2', st)
|
|
|
|
|
st2
|
|
|
|
|
raises(ConfigError, "DynOptionDescription('dod', '', [st, st2], callback=return_list)")
|
|
|
|
|
raises(ConfigError, "DynOptionDescription('dod', '', [st, st2], suffixes=Calculation(return_list))")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_nocallback_dyndescription():
|
|
|
|
|
st = StrOption('st', '')
|
|
|
|
|
st2 = StrOption('st2', '')
|
|
|
|
|
st, st2
|
|
|
|
|
raises(ConfigError, "DynOptionDescription('dod', '', [st, st2])")
|
|
|
|
|
raises(TypeError, "DynOptionDescription('dod', '', [st, st2])")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_invalid_samevalue_dyndescription():
|
|
|
|
|
st1 = StrOption('st', '')
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st1], callback=return_same_list)
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st1], suffixes=Calculation(return_same_list))
|
|
|
|
|
od1 = OptionDescription('od', '', [dod])
|
|
|
|
|
cfg = Config(od1)
|
|
|
|
|
raises(ValueError, "cfg.value.dict()")
|
|
|
|
@ -1463,7 +1463,7 @@ def test_invalid_samevalue_dyndescription():
|
|
|
|
|
|
|
|
|
|
def test_invalid_name_dyndescription():
|
|
|
|
|
st1 = StrOption('st', '')
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st1], callback=return_wrong_list)
|
|
|
|
|
dod = DynOptionDescription('dod', '', [st1], suffixes=Calculation(return_wrong_list))
|
|
|
|
|
od1 = OptionDescription('od', '', [dod])
|
|
|
|
|
cfg = Config(od1)
|
|
|
|
|
raises(ValueError, "cfg.value.dict()")
|
|
|
|
|