correction on test test_multi.py

This commit is contained in:
2017-12-05 21:49:19 +01:00
parent 924ac4e597
commit 48e172a59a
2 changed files with 49 additions and 37 deletions

View File

@ -586,41 +586,49 @@ class Settings(object):
# validate properties
def validate_properties(self,
opt_or_descr,
opt,
path,
setting_properties,
index=None,
force_permissive=False):
"""
validation upon the properties related to `opt_or_descr`
validation upon the properties related to `opt`
:param opt_or_descr: an option or an option description object
:param opt: an option or an option description object
:param force_permissive: behaves as if the permissive property
was present
"""
# opt properties
properties = self.getproperties(opt_or_descr,
path,
setting_properties=setting_properties,
index=index)
self_properties = self.getproperties(opt,
path,
setting_properties=setting_properties,
index=index)
# calc properties
properties &= setting_properties - set(['frozen'])
if not opt_or_descr.impl_is_optiondescription():
properties = self_properties & setting_properties - set(['frozen'])
if not opt.impl_is_optiondescription():
#mandatory
if 'mandatory' in properties or 'empty' in properties:
value = 'pouet'
if self.validate_mandatory(opt_or_descr,
index,
value,
setting_properties,
properties):
properties += set(['mandatory']) - set(['empty'])
value = self._getcontext().cfgimpl_get_values().get_cached_value(opt,
path=path,
validate=False,
setting_properties=setting_properties,
self_properties=self_properties,
index=index)
if not self.validate_mandatory(opt,
index,
value,
setting_properties,
properties):
properties -= set(['mandatory'])
else:
properties -= set(['mandatory', 'empty'])
properties |= set(['mandatory'])
properties -= set(['empty'])
opt_type = 'option'
else:
opt_type = 'optiondescription'
# remove permissive properties
if force_permissive is True and properties:
# remove global permissive if need
@ -628,7 +636,7 @@ class Settings(object):
# at this point an option should not remain in properties
if properties != frozenset():
datas = {'opt': opt_or_descr,
datas = {'opt': opt,
'path': path,
'setting_properties': setting_properties,
'index': index,