diff --git a/src/rougail/annotator/constrainte.py b/src/rougail/annotator/constrainte.py index 4f246888a..c047ab443 100644 --- a/src/rougail/annotator/constrainte.py +++ b/src/rougail/annotator/constrainte.py @@ -15,8 +15,7 @@ FREEZE_AUTOFREEZE_VARIABLE = 'module_instancie' INTERNAL_FUNCTIONS = ['valid_enum', 'valid_in_network', 'valid_differ', 'valid_entier'] -def get_actions_from_condition(condition_name: str, - ) -> List[str]: +def get_actions_from_condition(condition_name: str) -> List[str]: """get action's name from a condition """ if condition_name.startswith('hidden_if_'): @@ -71,7 +70,8 @@ class ConstrainteAnnotator: del self.objectspace.space.constraints def convert_auto_freeze(self): - """convert auto_freeze to continue + """convert auto_freeze + only if FREEZE_AUTOFREEZE_VARIABLE == 'oui' this variable is frozen """ def _convert_auto_freeze(variable, namespace): if variable.auto_freeze: diff --git a/src/rougail/annotator/family.py b/src/rougail/annotator/family.py index 496bc0124..8a4946470 100644 --- a/src/rougail/annotator/family.py +++ b/src/rougail/annotator/family.py @@ -109,7 +109,9 @@ class FamilyAnnotator: variable.mode = family_mode if variable.hidden is True: variable.frozen = True - if not variable.auto_save is True and 'force_default_on_freeze' not in vars(variable): + if not variable.auto_save is True and \ + not variable.auto_freeze and \ + 'force_default_on_freeze' not in vars(variable): variable.force_default_on_freeze = True def change_variable_mode(self): # pylint: disable=C0111 diff --git a/tests/dictionaries/80auto_autofreeze/00-base.xml b/tests/dictionaries/01auto_autofreeze/00-base.xml similarity index 100% rename from tests/dictionaries/80auto_autofreeze/00-base.xml rename to tests/dictionaries/01auto_autofreeze/00-base.xml diff --git a/tests/dictionaries/80auto_autofreeze/__init__.py b/tests/dictionaries/01auto_autofreeze/__init__.py similarity index 100% rename from tests/dictionaries/80auto_autofreeze/__init__.py rename to tests/dictionaries/01auto_autofreeze/__init__.py diff --git a/tests/dictionaries/01auto_autofreeze/makedict/base.json b/tests/dictionaries/01auto_autofreeze/makedict/base.json new file mode 100644 index 000000000..8b4451f4f --- /dev/null +++ b/tests/dictionaries/01auto_autofreeze/makedict/base.json @@ -0,0 +1 @@ +{"rougail.general.module_instancie": "non", "rougail.general.mode_conteneur_actif": "oui"} diff --git a/tests/dictionaries/01auto_autofreeze/tiramisu/base.py b/tests/dictionaries/01auto_autofreeze/tiramisu/base.py new file mode 100644 index 000000000..0a298cfaf --- /dev/null +++ b/tests/dictionaries/01auto_autofreeze/tiramisu/base.py @@ -0,0 +1,15 @@ +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 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='module_instancie', doc='No change', multi=False, default='non', values=('oui', 'non')) +option_4 = ChoiceOption(properties=frozenset({'auto_freeze', 'basic', 'force_store_value', 'frozen', 'hidden', 'mandatory', Calculation(calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))}), name='mode_conteneur_actif', doc='No change', multi=False, default=Calculation(func.calc_val, Params((ParamValue("oui")), kwargs={})), values=('oui', 'non')) +option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'basic'}), children=[option_3, option_4]) +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/80auto_autofreeze/errno_50 b/tests/dictionaries/80auto_autofreeze/errno_50 deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/test_1_flattener.py b/tests/test_1_flattener.py index 8cf309c49..5fb38cc6e 100644 --- a/tests/test_1_flattener.py +++ b/tests/test_1_flattener.py @@ -28,9 +28,9 @@ excludes = set([]) #excludes = set(['01base_file_utfchar']) test_ok -= excludes test_raise -= excludes -#test_ok = ['10valid_enum_eosfunc'] +#test_ok = ['01auto_autofreeze'] #test_ok = [] -#test_raise = ['80redefine_double_error'] +#test_raise = ['80auto_autofreeze'] #test_raise = [] ORI_DIR = getcwd()