diff --git a/src/rougail/tiramisureflector.py b/src/rougail/tiramisureflector.py index 7d823fa6..9a2debc5 100644 --- a/src/rougail/tiramisureflector.py +++ b/src/rougail/tiramisureflector.py @@ -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': diff --git a/tests/dictionaries/10fill_information_multi/00-base.xml b/tests/dictionaries/10fill_information_multi/00-base.xml new file mode 100644 index 00000000..77152550 --- /dev/null +++ b/tests/dictionaries/10fill_information_multi/00-base.xml @@ -0,0 +1,14 @@ + + + + + + + + + + test_information + mode_conteneur_actif + + + diff --git a/tests/dictionaries/10fill_information_multi/__init__.py b/tests/dictionaries/10fill_information_multi/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/10fill_information_multi/makedict/after.json b/tests/dictionaries/10fill_information_multi/makedict/after.json new file mode 100644 index 00000000..07c72318 --- /dev/null +++ b/tests/dictionaries/10fill_information_multi/makedict/after.json @@ -0,0 +1,8 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": [ + "value" + ] + } +} diff --git a/tests/dictionaries/10fill_information_multi/makedict/base.json b/tests/dictionaries/10fill_information_multi/makedict/base.json new file mode 100644 index 00000000..bc0f3f5d --- /dev/null +++ b/tests/dictionaries/10fill_information_multi/makedict/base.json @@ -0,0 +1,5 @@ +{ + "rougail.general.mode_conteneur_actif": [ + "value" + ] +} diff --git a/tests/dictionaries/10fill_information_multi/makedict/before.json b/tests/dictionaries/10fill_information_multi/makedict/before.json new file mode 100644 index 00000000..07c72318 --- /dev/null +++ b/tests/dictionaries/10fill_information_multi/makedict/before.json @@ -0,0 +1,8 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": [ + "value" + ] + } +} diff --git a/tests/dictionaries/10fill_information_multi/tiramisu/base.py b/tests/dictionaries/10fill_information_multi/tiramisu/base.py new file mode 100644 index 00000000..7605b9ec --- /dev/null +++ b/tests/dictionaries/10fill_information_multi/tiramisu/base.py @@ -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]) diff --git a/tests/dictionaries/20family_dynamic_leadership/makedict/after.json b/tests/dictionaries/20family_dynamic_leadership/makedict/after.json new file mode 100644 index 00000000..12eb7e6a --- /dev/null +++ b/tests/dictionaries/20family_dynamic_leadership/makedict/after.json @@ -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": [] + } +} diff --git a/tests/dictionaries/20family_dynamic_leadership/makedict/base.json b/tests/dictionaries/20family_dynamic_leadership/makedict/base.json new file mode 100644 index 00000000..b554bc67 --- /dev/null +++ b/tests/dictionaries/20family_dynamic_leadership/makedict/base.json @@ -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": [] +} diff --git a/tests/dictionaries/20family_dynamic_leadership/makedict/before.json b/tests/dictionaries/20family_dynamic_leadership/makedict/before.json new file mode 100644 index 00000000..12eb7e6a --- /dev/null +++ b/tests/dictionaries/20family_dynamic_leadership/makedict/before.json @@ -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": [] + } +}