From 942b3f718c363cf0f002edbaecd4116d494a04e4 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Thu, 24 Dec 2020 17:52:14 +0100 Subject: [PATCH] test information in param --- src/rougail/tiramisureflector.py | 3 --- .../dictionaries/10fill_information/00-base.xml | 16 ++++++++++++++++ .../dictionaries/10fill_information/__init__.py | 0 .../10fill_information/makedict/base.json | 1 + .../10fill_information/tiramisu/__init__.py | 0 .../10fill_information/tiramisu/base.py | 14 ++++++++++++++ tests/test_2_makedict.py | 1 + 7 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 tests/dictionaries/10fill_information/00-base.xml create mode 100644 tests/dictionaries/10fill_information/__init__.py create mode 100644 tests/dictionaries/10fill_information/makedict/base.json create mode 100644 tests/dictionaries/10fill_information/tiramisu/__init__.py create mode 100644 tests/dictionaries/10fill_information/tiramisu/base.py diff --git a/src/rougail/tiramisureflector.py b/src/rougail/tiramisureflector.py index 0e3519ab..7d11612b 100644 --- a/src/rougail/tiramisureflector.py +++ b/src/rougail/tiramisureflector.py @@ -482,9 +482,6 @@ class Family(Common): if hasattr(self.elt, 'property'): for child in self.elt.property: self.populate_properties(child) - if not self.attrib['properties']: - # remove empty property - del self.attrib['properties'] def get_object_name(self): if 'suffixes' in self.attrib: diff --git a/tests/dictionaries/10fill_information/00-base.xml b/tests/dictionaries/10fill_information/00-base.xml new file mode 100644 index 00000000..94989d2d --- /dev/null +++ b/tests/dictionaries/10fill_information/00-base.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + test_information + + + + diff --git a/tests/dictionaries/10fill_information/__init__.py b/tests/dictionaries/10fill_information/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/10fill_information/makedict/base.json b/tests/dictionaries/10fill_information/makedict/base.json new file mode 100644 index 00000000..5f62f349 --- /dev/null +++ b/tests/dictionaries/10fill_information/makedict/base.json @@ -0,0 +1 @@ +{"rougail.general.mode_conteneur_actif": "value"} diff --git a/tests/dictionaries/10fill_information/tiramisu/__init__.py b/tests/dictionaries/10fill_information/tiramisu/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/dictionaries/10fill_information/tiramisu/base.py b/tests/dictionaries/10fill_information/tiramisu/base.py new file mode 100644 index 00000000..fc27b03c --- /dev/null +++ b/tests/dictionaries/10fill_information/tiramisu/base.py @@ -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]) diff --git a/tests/test_2_makedict.py b/tests/test_2_makedict.py index 90e29de9..e70525a8 100644 --- a/tests/test_2_makedict.py +++ b/tests/test_2_makedict.py @@ -43,6 +43,7 @@ async def launch_flattener(test_dir): for token in modulepath.split(".")[1:]: mod = getattr(mod, token) config = await Config(mod.option_0) + await config.information.set('test_information', 'value') await config.property.read_only() await config.property.pop('mandatory') await config.information.set('info', 'value')