default value for ParamInformation must be empty list for multi value

This commit is contained in:
Emmanuel Garette 2021-04-26 17:56:41 +02:00
parent 0e55679e8b
commit a87485abd2
10 changed files with 149 additions and 1 deletions

View File

@ -251,7 +251,11 @@ class Common:
if param.type == 'variable':
return self.build_option_param(param)
if param.type == 'information':
return f'ParamInformation("{param.text}", None)'
if hasattr(self.elt, 'multi') and self.elt.multi:
default = []
else:
default = None
return f'ParamInformation("{param.text}", {default})'
if param.type == 'target_information':
return f'ParamSelfInformation("{param.text}", None)'
if param.type == 'suffix':

View File

@ -0,0 +1,14 @@
<?xml version='1.0' encoding='UTF-8'?>
<rougail version="0.10">
<variables>
<family name="general">
<variable name="mode_conteneur_actif" type="string" description="No change" multi="True"/>
</family>
</variables>
<constraints>
<fill name="calc_val">
<param type="information">test_information</param>
<target>mode_conteneur_actif</target>
</fill>
</constraints>
</rougail>

View File

@ -0,0 +1,8 @@
{
"rougail.general.mode_conteneur_actif": {
"owner": "default",
"value": [
"value"
]
}
}

View File

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

View File

@ -0,0 +1,8 @@
{
"rougail.general.mode_conteneur_actif": {
"owner": "default",
"value": [
"value"
]
}
}

View File

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

View File

@ -0,0 +1,41 @@
{
"rougail.general.varname": {
"owner": "default",
"value": [
"val1",
"val2"
]
},
"rougail.dynval1.vardynval1": {
"owner": "default",
"value": null
},
"rougail.dynval1.leadershipval1.leaderval1": {
"owner": "default",
"value": []
},
"rougail.dynval1.leadershipval1.follower1val1": {
"owner": [],
"value": []
},
"rougail.dynval1.leadershipval1.follower2val1": {
"owner": [],
"value": []
},
"rougail.dynval2.vardynval2": {
"owner": "default",
"value": null
},
"rougail.dynval2.leadershipval2.leaderval2": {
"owner": "default",
"value": []
},
"rougail.dynval2.leadershipval2.follower1val2": {
"owner": [],
"value": []
},
"rougail.dynval2.leadershipval2.follower2val2": {
"owner": [],
"value": []
}
}

View File

@ -0,0 +1,10 @@
{
"rougail.general.varname": [
"val1",
"val2"
],
"rougail.dynval1.vardynval1": null,
"rougail.dynval1.leadershipval1.leaderval1": [],
"rougail.dynval2.vardynval2": null,
"rougail.dynval2.leadershipval2.leaderval2": []
}

View File

@ -0,0 +1,41 @@
{
"rougail.general.varname": {
"owner": "default",
"value": [
"val1",
"val2"
]
},
"rougail.dynval1.vardynval1": {
"owner": "default",
"value": null
},
"rougail.dynval1.leadershipval1.leaderval1": {
"owner": "default",
"value": []
},
"rougail.dynval1.leadershipval1.follower1val1": {
"owner": [],
"value": []
},
"rougail.dynval1.leadershipval1.follower2val1": {
"owner": [],
"value": []
},
"rougail.dynval2.vardynval2": {
"owner": "default",
"value": null
},
"rougail.dynval2.leadershipval2.leaderval2": {
"owner": "default",
"value": []
},
"rougail.dynval2.leadershipval2.follower1val2": {
"owner": [],
"value": []
},
"rougail.dynval2.leadershipval2.follower2val2": {
"owner": [],
"value": []
}
}