test information in param

This commit is contained in:
Emmanuel Garette 2020-12-24 17:52:14 +01:00
parent f9885a023c
commit 942b3f718c
7 changed files with 32 additions and 3 deletions

View file

@ -482,9 +482,6 @@ class Family(Common):
if hasattr(self.elt, 'property'): if hasattr(self.elt, 'property'):
for child in self.elt.property: for child in self.elt.property:
self.populate_properties(child) self.populate_properties(child)
if not self.attrib['properties']:
# remove empty property
del self.attrib['properties']
def get_object_name(self): def get_object_name(self):
if 'suffixes' in self.attrib: if 'suffixes' in self.attrib:

View file

@ -0,0 +1,16 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail>
<variables>
<family name="general">
<variable name="mode_conteneur_actif" type="string" description="No change"/>
</family>
</variables>
<constraints>
<fill name="calc_val" target="mode_conteneur_actif">
<param type="information">test_information</param>
</fill>
</constraints>
</rougail>
<!-- vim: ts=4 sw=4 expandtab
-->

View file

@ -0,0 +1 @@
{"rougail.general.mode_conteneur_actif": "value"}

View file

@ -0,0 +1,14 @@
from importlib.machinery import SourceFileLoader
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
for key, value in dict(locals()).items():
if key != ['SourceFileLoader', 'func']:
setattr(func, key, value)
try:
from tiramisu3 import *
except:
from tiramisu import *
from rougail.tiramisu import ConvertDynOptionDescription
option_3 = StrOption(properties=frozenset({'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default=Calculation(func.calc_val, Params((ParamInformation("test_information", None)), kwargs={})))
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3])
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])

View file

@ -43,6 +43,7 @@ async def launch_flattener(test_dir):
for token in modulepath.split(".")[1:]: for token in modulepath.split(".")[1:]:
mod = getattr(mod, token) mod = getattr(mod, token)
config = await Config(mod.option_0) config = await Config(mod.option_0)
await config.information.set('test_information', 'value')
await config.property.read_only() await config.property.read_only()
await config.property.pop('mandatory') await config.property.pop('mandatory')
await config.information.set('info', 'value') await config.information.set('info', 'value')