diff --git a/src/rougail/annotator/value.py b/src/rougail/annotator/value.py index 25284a128..c231a3d82 100644 --- a/src/rougail/annotator/value.py +++ b/src/rougail/annotator/value.py @@ -76,8 +76,8 @@ class Annotator(Walk): # pylint: disable=R0903 raise DictConsistencyError(msg, 68, variable.xmlfiles) if variable.path in self.objectspace.followers and multi != "submulti": msg = _( - 'the follower "{0}" without multi attribute can only have one value' - ).format(variable.name) + 'the follower "{0}" is not multi, so cannot have a list has default value' + ).format(variable.path) raise DictConsistencyError(msg, 87, variable.xmlfiles) if not variable.default: variable.default = None diff --git a/src/rougail/annotator/variable.py b/src/rougail/annotator/variable.py index 9739fefef..7655fc169 100644 --- a/src/rougail/annotator/variable.py +++ b/src/rougail/annotator/variable.py @@ -25,10 +25,11 @@ You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . """ +from tiramisu.error import display_list from rougail.i18n import _ +from rougail.utils import calc_multi_for_type_variable from rougail.error import DictConsistencyError from rougail.object_model import Calculation, VariableCalculation -from tiramisu.error import display_list class Walk: @@ -93,21 +94,23 @@ class Annotator(Walk): # pylint: disable=R0903 def convert_variable(self): """convert variable""" - for variable in self.get_variables(): - if variable.version != "1.0": - if variable.type == "symlink": - continue - self._convert_variable_inference(variable) for variable in self.get_variables(): if variable.type == "symlink": continue if variable.version != "1.0": - self._default_variable_copy_informations(variable) - if variable.multi is None: - variable.multi = False - if variable.type is None: - variable.type = "string" - self.objectspace.informations.add(variable.path, "type", variable.type) + self._convert_variable_inference(variable) + self._convert_variable_multi(variable) + for variable in self.get_variables(): + if variable.type == "symlink": + continue + if variable.version != '1.0' and isinstance(variable.default, VariableCalculation): + calculated_variable_path, calculated_variable, identifier = variable.default.get_variable( + self.objectspace + ) + else: + calculated_variable = None + if variable.version != "1.0" and calculated_variable is not None: + self._default_variable_copy_informations(variable, calculated_variable) self._convert_variable(variable) def _convert_variable_inference( @@ -115,42 +118,52 @@ class Annotator(Walk): # pylint: disable=R0903 variable, ) -> None: # variable has no type - if variable.type is None: - # choice type inference from the `choices` attribute - if variable.choices is not None: - variable.type = "choice" - elif variable.regexp is not None: - variable.type = "regexp" - elif variable.default not in [None, []]: - if isinstance(variable.default, list): - tested_value = variable.default[0] - else: - tested_value = variable.default - variable.type = self.basic_types.get(type(tested_value), None) - # variable has no multi attribute - if variable.multi is None and not ( - variable.type is None and isinstance(variable.default, VariableCalculation) - ): - if variable.path in self.objectspace.leaders: - variable.multi = True + if variable.type is not None: + return + # choice type inference from the `choices` attribute + if variable.choices is not None: + variable.type = "choice" + elif variable.regexp is not None: + variable.type = "regexp" + elif variable.default not in [None, []]: + if isinstance(variable.default, list): + tested_value = variable.default[0] else: - variable.multi = isinstance(variable.default, list) + tested_value = variable.default + variable.type = self.basic_types.get(type(tested_value), None) + + def _convert_variable_multi( + self, + variable, + ) -> None: + # variable has no multi attribute + if variable.multi is not None: + return + if variable.path in self.objectspace.leaders: + variable.multi = self.objectspace.multis[variable.path] = True + elif variable.version != "1.0" and isinstance(variable.default, VariableCalculation): + # FIXME + calculated_variable_path, calculated_variable, identifier = variable.default.get_variable( + self.objectspace + ) + if calculated_variable is not None: + if calculated_variable.multi is None: + self._convert_variable_multi(calculated_variable) + variable.multi = calc_multi_for_type_variable(variable, calculated_variable_path, calculated_variable, self.objectspace)[1] + if calculated_variable.path in self.objectspace.followers and variable.mandatory is calculated_variable.mandatory is False and calculated_variable.path.rsplit(".", 1)[0] != variable.path.rsplit(".", 1)[0]: + variable.empty = False + else: + variable.multi = isinstance(variable.default, list) def _default_variable_copy_informations( self, variable, + calculated_variable, ) -> None: # if a variable has a variable as default value, that means the type/params or multi should has same value - if variable.type is not None or not isinstance( - variable.default, VariableCalculation - ): + if not isinstance(variable.default, VariableCalculation) or variable.type is not None: return # copy type and params - calculated_variable, identifier = variable.default.get_variable( - self.objectspace - ) - if calculated_variable is None: - return variable.type = calculated_variable.type if variable.params is None and calculated_variable.params is not None: variable.params = calculated_variable.params @@ -158,17 +171,6 @@ class Annotator(Walk): # pylint: disable=R0903 variable.choices = calculated_variable.choices if variable.type == 'regexp' and variable.regexp is None: variable.regexp = calculated_variable.regexp - # copy multi attribut - if variable.multi is None: - calculated_path = calculated_variable.path - if ( - calculated_path in self.objectspace.leaders - and variable.path in self.objectspace.followers - and calculated_path.rsplit(".")[0] == variable.path.rsplit(".")[0] - ): - variable.multi = False - else: - variable.multi = calculated_variable.multi def _convert_variable( self, @@ -177,6 +179,9 @@ class Annotator(Walk): # pylint: disable=R0903 # variable without description: description is the name if not variable.description: variable.description = variable.name + if variable.type is None: + variable.type = "string" + self.objectspace.informations.add(variable.path, "type", variable.type) if variable.path in self.objectspace.followers: if not variable.multi: self.objectspace.multis[variable.path] = True @@ -185,8 +190,6 @@ class Annotator(Walk): # pylint: disable=R0903 elif variable.multi: self.objectspace.multis[variable.path] = True if variable.path in self.objectspace.leaders: - if not self.objectspace.multis.get(variable.path, False): - variable.multi = self.objectspace.multis[variable.path] = True family = self.objectspace.paths[variable.path.rsplit(".", 1)[0]] if variable.hidden: family.hidden = variable.hidden diff --git a/src/rougail/cli b/src/rougail/cli new file mode 120000 index 000000000..99e3e84af --- /dev/null +++ b/src/rougail/cli @@ -0,0 +1 @@ +../../../rougail-cli/src/rougail/cli \ No newline at end of file diff --git a/src/rougail/object_model.py b/src/rougail/object_model.py index 7a39a7b02..cf2f493cc 100644 --- a/src/rougail/object_model.py +++ b/src/rougail/object_model.py @@ -28,7 +28,8 @@ from pydantic import ( ) from tiramisu import undefined import tiramisu -from .utils import get_jinja_variable_to_param +from tiramisu.config import get_common_path +from .utils import get_jinja_variable_to_param, calc_multi_for_type_variable from .i18n import _ from .error import DictConsistencyError, VariableCalculationDependencyError @@ -458,8 +459,17 @@ class _VariableCalculation(Calculation): path = self.path else: path = self.ori_path + if self.version != "1.0" and objectspace.paths.regexp_relative.search(self.variable): + variable_full_path = objectspace.paths.get_full_path( + self.variable, + path, + ) + elif self.version == "1.0" and "{{ suffix }}" in self.variable: + variable_full_path = self.variable.replace("{{ suffix }}", "{{ identifier }}") + else: + variable_full_path = self.variable variable, identifier = objectspace.paths.get_with_dynamic( - self.variable, + variable_full_path, path, self.version, self.namespace, @@ -467,90 +477,44 @@ class _VariableCalculation(Calculation): ) if variable and not isinstance(variable, objectspace.variable): if isinstance(variable, objectspace.family): - msg = _('a variable "{0}" is needs in attribute "{1}" for "{2}" but it\'s a family').format(variable.path, self.attribute_name, self.path) + msg = _('a variable "{0}" is needs in attribute "{1}" for "{2}" but it\'s a family').format(variable_full_path, self.attribute_name, self.path) raise DictConsistencyError(msg, 47, self.xmlfiles) else: msg = _('unknown object "{0}" in attribute "{1}" for "{2}"').format(variable, self.attribute_name, self.path) raise DictConsistencyError(msg, 48, self.xmlfiles) - return variable, identifier + return variable_full_path, variable, identifier def get_params( self, objectspace, - variable: "Variable", - identifier: Optional[str], - *, - needs_multi: Optional[bool] = None, + variable_in_calculation_path: str, + variable_in_calculation: "Variable", + variable_in_calculation_identifier: Optional[str], ): - if not variable: + if not variable_in_calculation: if not objectspace.force_optional: if self.ori_path is None: path = self.path else: path = self.ori_path - msg = _('Variable not found "{0}" for attribut "{1}" in variable "{2}"').format(self.variable, self.attribute_name, path) + msg = _('variable "{0}" has an attribute "{1}" calculated with the unknown variable "{2}"').format(path, self.attribute_name, self.variable) raise DictConsistencyError(msg, 88, self.xmlfiles) return {None: [["example"]]} param = { "type": "variable", - "variable": variable, + "variable": variable_in_calculation, "propertyerror": self.propertyerror, } - is_variable_calculation = isinstance(self, VariableCalculation) - if is_variable_calculation and self.optional: + if isinstance(self, VariableCalculation) and self.optional: param["optional"] = self.optional - if identifier: - param["identifier"] = identifier + if variable_in_calculation_identifier: + param["identifier"] = variable_in_calculation_identifier params = {None: [param]} if self.default_values: params["__default_value"] = self.default_values if self.allow_none: params["allow_none"] = True - if needs_multi is None: - if self.attribute_name == "default": - # variable is a multi or a submulti follower - attended = "submulti" if self.path in objectspace.followers else True - needs_multi = objectspace.multis.get(self.path) == attended - else: - needs_multi = True - calc_variable_is_multi = variable.path in objectspace.multis - if not calc_variable_is_multi: - # a variable in a dynamic family can be multiple - if variable.path in objectspace.paths._dynamics and ( - identifier is None or identifier[-1] is None - ): - self_dyn_path = objectspace.paths._dynamics.get(self.path) - if self_dyn_path is not None: - var_dyn_path = objectspace.paths._dynamics[variable.path] - if self_dyn_path != var_dyn_path and not self_dyn_path.startswith( - f"{var_dyn_path}." - ): - calc_variable_is_multi = True - else: - calc_variable_is_multi = True - elif identifier and "{{ identifier }}" in identifier: - calc_variable_is_multi = True - if needs_multi: - if calc_variable_is_multi: - if self.inside_list: - msg = _('the variable "{0}" has an invalid attribute "{1}", the variable "{2}" is multi but is inside a list').format(self.path, self.attribute_name, variable.path) - raise DictConsistencyError(msg, 18, self.xmlfiles) - elif not self.inside_list: - msg = _('the variable "{0}" has an invalid attribute "{1}", the variable "{2}" is not multi but is not inside a list').format(self.path, self.attribute_name, variable.path) - raise DictConsistencyError(msg, 20, self.xmlfiles) - elif self.inside_list: - msg = _('the variable "{0}" has an invalid attribute "{1}", it\'s a list').format(self.path, self.attribute_name) - raise DictConsistencyError(msg, 23, self.xmlfiles) - elif calc_variable_is_multi and self.path in objectspace.followers: - if ( - variable.path.rsplit(".", 1)[0] != self.path.rsplit(".", 1)[0] - ): - if is_variable_calculation: - # it's not a follower or not in same leadership - msg = _('the variable "{0}" has an invalid attribute "{1}", the variable "{2}" is a multi').format(self.path, self.attribute_name, variable.path) - raise DictConsistencyError(msg, 21, self.xmlfiles) - else: - params[None][0]["index"] = {"index": {"type": "index"}} + self.check_multi(objectspace, variable_in_calculation_path, variable_in_calculation) if self.path in objectspace.followers: multi = objectspace.multis[self.path] == "submulti" else: @@ -559,6 +523,53 @@ class _VariableCalculation(Calculation): params["__internal_multi"] = True return params + def check_multi(self, objectspace, variable_in_calculation_path, variable_in_calculation): + if self.ori_path is None: + path = self.path + else: + path = self.ori_path + local_variable = objectspace.paths[path] + local_variable_multi, variable_in_calculation_multi = calc_multi_for_type_variable(local_variable, variable_in_calculation_path, variable_in_calculation, objectspace) + if self.attribute_name == "default": + if variable_in_calculation_multi == 'submulti': + if objectspace.paths.is_dynamic(variable_in_calculation.path): + msg = _('the variable "{0}" has an invalid "{1}" the variable "{2}" is in a sub dynamic option').format(local_variable.path, self.attribute_name, variable_in_calculation.path) + raise DictConsistencyError(msg, 69, self.xmlfiles) + else: + msg = _('the leader "{0}" has an invalid "{1}" the follower "{2}" is a multi').format(local_variable.path, self.attribute_name, variable_in_calculation.path) + raise DictConsistencyError(msg, 74, self.xmlfiles) + if not self.inside_list: + if local_variable_multi != variable_in_calculation_multi: + if local_variable_multi: + self.check_variable_in_calculation_multi(local_variable.path, variable_in_calculation_path, variable_in_calculation_multi) + self.check_variable_in_calculation_not_multi(local_variable.path, variable_in_calculation_path, variable_in_calculation_multi) + else: + self.check_variable_in_calculation_in_list_not_multi(local_variable.path, variable_in_calculation_path, variable_in_calculation_multi) + elif self.attribute_name in ["choices", "dynamic"]: + # calculated variable must be a multi + if not self.inside_list: + self.check_variable_in_calculation_multi(local_variable.path, variable_in_calculation_path, variable_in_calculation_multi) + else: + self.check_variable_in_calculation_in_list_not_multi(local_variable.path, variable_in_calculation_path, variable_in_calculation_multi) + elif variable_in_calculation_multi is True: + msg = _('the variable "{0}" has an invalid attribute "{1}", the variable "{2}" must not be multi').format(local_variable.path, self.attribute_name, variable_in_calculation_path) + raise DictConsistencyError(msg, 23, self.xmlfiles) + + def check_variable_in_calculation_multi(self, local_variable_path, variable_in_calculation_path, variable_in_calculation_multi): + if variable_in_calculation_multi is False: + msg = _('the variable "{0}" has an invalid attribute "{1}", the variable must not be a multi or the variable "{2}" must be multi').format(local_variable_path, self.attribute_name, variable_in_calculation_path) + raise DictConsistencyError(msg, 20, self.xmlfiles) + + def check_variable_in_calculation_not_multi(self, local_variable_path, variable_in_calculation_path, variable_in_calculation_multi): + if variable_in_calculation_multi is True: + msg = _('the variable "{0}" has an invalid attribute "{1}", the variable must be a multi or the variable "{2}" must not be multi').format(local_variable_path, self.attribute_name, variable_in_calculation_path) + raise DictConsistencyError(msg, 21, self.xmlfiles) + + def check_variable_in_calculation_in_list_not_multi(self, local_variable_path, variable_in_calculation_path, variable_in_calculation_multi): + if variable_in_calculation_multi is True: + msg = _('the variable "{0}" has an invalid attribute "{1}", the variable "{2}" is multi but is inside a list').format(local_variable_path, self.attribute_name, variable_in_calculation_path) + raise DictConsistencyError(msg, 18, self.xmlfiles) + class VariableCalculation(_VariableCalculation): attribute_name: Literal["default", "choices", "dynamic"] @@ -571,22 +582,23 @@ class VariableCalculation(_VariableCalculation): if self.attribute_name != "default" and self.optional: msg = _('"{0}" attribut shall not have an "optional" attribute for variable "{1}"').format(self.attribute_name, self.variable) raise DictConsistencyError(msg, 33, self.xmlfiles) - variable, identifier = self.get_variable(objectspace) + variable_in_calculation_path, variable_in_calculation, variable_in_calculation_identifier = self.get_variable(objectspace) if ( - not variable + not variable_in_calculation and self.optional or (objectspace.force_optional and self.attribute_name == "default") ): raise VariableCalculationDependencyError() - if variable and self.attribute_name == "default": + if variable_in_calculation and self.attribute_name == "default": local_variable = objectspace.paths[self.path] - if CONVERT_OPTION.get(local_variable.type, {}).get("func", str) != CONVERT_OPTION.get(variable.type, {}).get("func", str): - msg = _('variable "{0}" has a default value calculated with "{1}" which has incompatible type').format(self.path, variable.path) + if CONVERT_OPTION.get(local_variable.type, {}).get("func", str) != CONVERT_OPTION.get(variable_in_calculation.type, {}).get("func", str): + msg = _('variable "{0}" has a default value calculated with "{1}" which has incompatible type').format(self.path, self.variable) raise DictConsistencyError(msg, 67, self.xmlfiles) params = self.get_params( objectspace, - variable, - identifier, + variable_in_calculation_path, + variable_in_calculation, + variable_in_calculation_identifier, ) return { "function": "calc_value", @@ -604,12 +616,12 @@ class VariablePropertyCalculation(_VariableCalculation): self, objectspace, ) -> dict: - variable, identifier = self.get_variable(objectspace) + variable_in_calculation_path, variable_in_calculation, variable_in_calculation_identifier = self.get_variable(objectspace) params = self.get_params( objectspace, - variable, - identifier, - needs_multi=False, + variable_in_calculation_path, + variable_in_calculation, + variable_in_calculation_identifier, ) if objectspace.force_optional and (not params[None] or "variable" not in params[None][0]): params = {None: [None, None, False]} @@ -641,10 +653,11 @@ class VariablePropertyCalculation(_VariableCalculation): params["when"] = when params["inverse"] = inverse params[None].insert(0, self.attribute_name) + func = 'variable_to_property' return { - "function": "variable_to_property", + "function": func, "params": params, - "help": "variable_to_property", + "help": func, } diff --git a/src/rougail/output_ansible b/src/rougail/output_ansible new file mode 120000 index 000000000..b5aa73963 --- /dev/null +++ b/src/rougail/output_ansible @@ -0,0 +1 @@ +../../../rougail-output-ansible/src/rougail/output_ansible \ No newline at end of file diff --git a/src/rougail/output_console b/src/rougail/output_console new file mode 120000 index 000000000..d55586023 --- /dev/null +++ b/src/rougail/output_console @@ -0,0 +1 @@ +../../../rougail-output-console/src/rougail/output_console \ No newline at end of file diff --git a/src/rougail/output_doc b/src/rougail/output_doc new file mode 120000 index 000000000..d74b57a73 --- /dev/null +++ b/src/rougail/output_doc @@ -0,0 +1 @@ +../../../rougail-output-doc/src/rougail/output_doc \ No newline at end of file diff --git a/src/rougail/output_formatter b/src/rougail/output_formatter new file mode 120000 index 000000000..888e1a19b --- /dev/null +++ b/src/rougail/output_formatter @@ -0,0 +1 @@ +../../../rougail-output-formatter/src/rougail/output_formatter \ No newline at end of file diff --git a/src/rougail/output_json b/src/rougail/output_json new file mode 120000 index 000000000..093d047a1 --- /dev/null +++ b/src/rougail/output_json @@ -0,0 +1 @@ +../../../rougail-output-json/src/rougail/output_json \ No newline at end of file diff --git a/src/rougail/path.py b/src/rougail/path.py index 7afc5c43d..a8f6d0040 100644 --- a/src/rougail/path.py +++ b/src/rougail/path.py @@ -63,6 +63,9 @@ class Paths: path: str, current_path: str, ): + if "{{ suffix }}" in path: + # version 1.0 and 1.1 + path = path.replace("{{ suffix }}", "{{ identifier }}") relative, subpath = path.split(".", 1) relative_len = len(relative) path_len = current_path.count(".") @@ -141,8 +144,6 @@ class Paths: path = new_path else: identifiers = None - if "{{ suffix }}" in path: - path = path.replace("{{ suffix }}", "{{ identifier }}") elif not path in self._data: new_path = parent_path = current_path = None identifiers = [] diff --git a/src/rougail/structural_bitwarden b/src/rougail/structural_bitwarden new file mode 120000 index 000000000..2b28a8199 --- /dev/null +++ b/src/rougail/structural_bitwarden @@ -0,0 +1 @@ +../../../rougail-structural-bitwarden/src/rougail/structural_bitwarden \ No newline at end of file diff --git a/src/rougail/structural_risotto b/src/rougail/structural_risotto new file mode 120000 index 000000000..d95969db5 --- /dev/null +++ b/src/rougail/structural_risotto @@ -0,0 +1 @@ +../../../risotto/src/rougail/structural_risotto \ No newline at end of file diff --git a/src/rougail/tiramisu.py b/src/rougail/tiramisu.py index e60a2e18c..3abbee496 100644 --- a/src/rougail/tiramisu.py +++ b/src/rougail/tiramisu.py @@ -111,7 +111,6 @@ def rougail_calc_value(*args, __default_value=None, __internal_multi=False, **kw def kw_to_string(kw, root=None): -# {'_': {'interfaces': {'ip': ['192.168.44.19', '192.168.44.12'], 'domain_name': ['nginx-reverse-proxy.reverseproxy.test.net', 'nginx-reverse-proxy.localdns.test.net']}, 'dns_client_address': 'nginx-reverse-proxy.localdns.test.net'}} for name, data in kw.items(): if root is None: path = name diff --git a/src/rougail/user_data_ansible b/src/rougail/user_data_ansible new file mode 120000 index 000000000..718bcfe84 --- /dev/null +++ b/src/rougail/user_data_ansible @@ -0,0 +1 @@ +../../../rougail-user-data-ansible/src/rougail/user_data_ansible \ No newline at end of file diff --git a/src/rougail/user_data_bitwarden b/src/rougail/user_data_bitwarden new file mode 120000 index 000000000..23cb64a4c --- /dev/null +++ b/src/rougail/user_data_bitwarden @@ -0,0 +1 @@ +../../../rougail-user-data-bitwarden/src/rougail/user_data_bitwarden \ No newline at end of file diff --git a/src/rougail/user_data_environment b/src/rougail/user_data_environment new file mode 120000 index 000000000..980033438 --- /dev/null +++ b/src/rougail/user_data_environment @@ -0,0 +1 @@ +../../../rougail-user-data-environment/src/rougail/user_data_environment \ No newline at end of file diff --git a/src/rougail/user_data_risotto b/src/rougail/user_data_risotto new file mode 120000 index 000000000..5f42de309 --- /dev/null +++ b/src/rougail/user_data_risotto @@ -0,0 +1 @@ +../../../risotto/src/rougail/user_data_risotto \ No newline at end of file diff --git a/src/rougail/user_data_yaml b/src/rougail/user_data_yaml new file mode 120000 index 000000000..370d9ce37 --- /dev/null +++ b/src/rougail/user_data_yaml @@ -0,0 +1 @@ +../../../rougail-user-data-yaml/src/rougail/user_data_yaml \ No newline at end of file diff --git a/src/rougail/utils.py b/src/rougail/utils.py index be6f73b30..ccc41e9d1 100644 --- a/src/rougail/utils.py +++ b/src/rougail/utils.py @@ -161,3 +161,41 @@ def get_jinja_variable_to_param( yield {}, None, root_path for variable_path, data in founded_variables.items(): yield data[1], data[0], variable_path + +def calc_multi_for_type_variable(local_variable: 'Variable', variable_in_calculation_path: str, variable_in_calculation: 'Variable', objectspace: 'RougailConvert') -> Union[bool, str]: + variable_in_calculation_multi = variable_in_calculation.multi + if local_variable.path in objectspace.families: + # it's a family + local_variable_multi = None + else: + local_variable_multi = local_variable.multi + # variable is a leader + if variable_in_calculation.path in objectspace.leaders: + local_variable_parent = local_variable.path.rsplit('.', 1)[0] + variable_in_calculation_parent = variable_in_calculation.path.rsplit('.', 1)[0] + if local_variable_parent == variable_in_calculation_parent: + variable_in_calculation_multi = False + # variable is a follower + elif variable_in_calculation.path in objectspace.followers: + local_variable_parent = local_variable.path.rsplit('.', 1)[0] + variable_in_calculation_parent = variable_in_calculation.path.rsplit('.', 1)[0] + if local_variable_parent != variable_in_calculation_parent: + if variable_in_calculation_multi: + variable_in_calculation_multi = 'submulti' + else: + variable_in_calculation_multi = True + # variable is in a dynamic family + if objectspace.paths.is_dynamic(variable_in_calculation.path): + common_path = get_common_path(local_variable.path, variable_in_calculation_path) + common_variable_path = variable_in_calculation_path + if common_path: + common_variable_path = common_variable_path[len(common_path) + 1:] + count_identifiers = common_variable_path.count('{{ identifier }}') + if count_identifiers == 1: + if variable_in_calculation_multi is False: + variable_in_calculation_multi = True + else: + variable_in_calculation_multi = 'submulti' + elif count_identifiers > 1: + variable_in_calculation_multi = 'submulti' + return local_variable_multi, variable_in_calculation_multi diff --git a/tests/dictionaries/40_0leadership_leader_follower/makedict/after.json b/tests/dictionaries/40_0leadership_leader_follower/makedict/after.json new file mode 100644 index 000000000..ca3f06a15 --- /dev/null +++ b/tests/dictionaries/40_0leadership_leader_follower/makedict/after.json @@ -0,0 +1,19 @@ +{ + "rougail.leadership.leader": { + "owner": "default", + "value": [ + "value1", + "value2" + ] + }, + "rougail.leadership.follower": { + "owner": [ + "default", + "default" + ], + "value": [ + "value1", + "value2" + ] + } +} diff --git a/tests/dictionaries/40_0leadership_leader_follower/makedict/base.json b/tests/dictionaries/40_0leadership_leader_follower/makedict/base.json new file mode 100644 index 000000000..c077479f8 --- /dev/null +++ b/tests/dictionaries/40_0leadership_leader_follower/makedict/base.json @@ -0,0 +1,12 @@ +{ + "rougail.leadership.leader": [ + { + "rougail.leadership.leader": "value1", + "rougail.leadership.follower": "value1" + }, + { + "rougail.leadership.leader": "value2", + "rougail.leadership.follower": "value2" + } + ] +} diff --git a/tests/dictionaries/40_0leadership_leader_follower/makedict/before.json b/tests/dictionaries/40_0leadership_leader_follower/makedict/before.json new file mode 100644 index 000000000..ca3f06a15 --- /dev/null +++ b/tests/dictionaries/40_0leadership_leader_follower/makedict/before.json @@ -0,0 +1,19 @@ +{ + "rougail.leadership.leader": { + "owner": "default", + "value": [ + "value1", + "value2" + ] + }, + "rougail.leadership.follower": { + "owner": [ + "default", + "default" + ], + "value": [ + "value1", + "value2" + ] + } +} diff --git a/tests/dictionaries/40_0leadership_leader_follower/makedict/mandatory.json b/tests/dictionaries/40_0leadership_leader_follower/makedict/mandatory.json new file mode 100644 index 000000000..0637a088a --- /dev/null +++ b/tests/dictionaries/40_0leadership_leader_follower/makedict/mandatory.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/tests/dictionaries/40_0leadership_leader_follower/tiramisu/base.py b/tests/dictionaries/40_0leadership_leader_follower/tiramisu/base.py new file mode 100644 index 000000000..875deb5be --- /dev/null +++ b/tests/dictionaries/40_0leadership_leader_follower/tiramisu/base.py @@ -0,0 +1,17 @@ +from tiramisu import * +from tiramisu.setting import ALLOWED_LEADER_PROPERTIES +from re import compile as re_compile +from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription +load_functions('../rougail-tests/funcs/test.py') +try: + groups.namespace +except: + groups.addgroup('namespace') +ALLOWED_LEADER_PROPERTIES.add("basic") +ALLOWED_LEADER_PROPERTIES.add("standard") +ALLOWED_LEADER_PROPERTIES.add("advanced") +option_3 = StrOption(name="leader", doc="a leader", multi=True, default=["value1", "value2"], properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'}) +option_4 = StrOption(name="follower", doc="a follower", multi=True, default=Calculation(func['calc_value'], Params((ParamOption(option_3)))), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'}) +optiondescription_2 = Leadership(name="leadership", doc="a leadership", children=[option_3, option_4], properties=frozenset({"standard"})) +optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[optiondescription_2], properties=frozenset({"standard"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1]) diff --git a/tests/dictionaries/40_0leadership_leader_follower/tiramisu/no_namespace.py b/tests/dictionaries/40_0leadership_leader_follower/tiramisu/no_namespace.py new file mode 100644 index 000000000..f3aed42f3 --- /dev/null +++ b/tests/dictionaries/40_0leadership_leader_follower/tiramisu/no_namespace.py @@ -0,0 +1,12 @@ +from tiramisu import * +from tiramisu.setting import ALLOWED_LEADER_PROPERTIES +from re import compile as re_compile +from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription +load_functions('../rougail-tests/funcs/test.py') +ALLOWED_LEADER_PROPERTIES.add("basic") +ALLOWED_LEADER_PROPERTIES.add("standard") +ALLOWED_LEADER_PROPERTIES.add("advanced") +option_2 = StrOption(name="leader", doc="a leader", multi=True, default=["value1", "value2"], properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'}) +option_3 = StrOption(name="follower", doc="a follower", multi=True, default=Calculation(func['calc_value'], Params((ParamOption(option_2)))), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'}) +optiondescription_1 = Leadership(name="leadership", doc="a leadership", children=[option_2, option_3], properties=frozenset({"standard"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1]) diff --git a/tests/dictionaries/40_9calculation_variable_leader_follower_multi_inside/makedict/after.json b/tests/dictionaries/40_9calculation_variable_leader_follower_multi_inside/makedict/after.json new file mode 100644 index 000000000..d784976aa --- /dev/null +++ b/tests/dictionaries/40_9calculation_variable_leader_follower_multi_inside/makedict/after.json @@ -0,0 +1,23 @@ +{ + "rougail.leadership.leader": { + "owner": "default", + "value": [ + "value1", + "value2" + ] + }, + "rougail.leadership.follower": { + "owner": [ + "default", + "default" + ], + "value": [ + [ + "value1" + ], + [ + "value2" + ] + ] + } +} diff --git a/tests/dictionaries/40_9calculation_variable_leader_follower_multi_inside/makedict/base.json b/tests/dictionaries/40_9calculation_variable_leader_follower_multi_inside/makedict/base.json new file mode 100644 index 000000000..e3cd4f3ba --- /dev/null +++ b/tests/dictionaries/40_9calculation_variable_leader_follower_multi_inside/makedict/base.json @@ -0,0 +1,16 @@ +{ + "rougail.leadership.leader": [ + { + "rougail.leadership.leader": "value1", + "rougail.leadership.follower": [ + "value1" + ] + }, + { + "rougail.leadership.leader": "value2", + "rougail.leadership.follower": [ + "value2" + ] + } + ] +} diff --git a/tests/dictionaries/40_9calculation_variable_leader_follower_multi_inside/makedict/before.json b/tests/dictionaries/40_9calculation_variable_leader_follower_multi_inside/makedict/before.json new file mode 100644 index 000000000..d784976aa --- /dev/null +++ b/tests/dictionaries/40_9calculation_variable_leader_follower_multi_inside/makedict/before.json @@ -0,0 +1,23 @@ +{ + "rougail.leadership.leader": { + "owner": "default", + "value": [ + "value1", + "value2" + ] + }, + "rougail.leadership.follower": { + "owner": [ + "default", + "default" + ], + "value": [ + [ + "value1" + ], + [ + "value2" + ] + ] + } +} diff --git a/tests/dictionaries/40_9calculation_variable_leader_follower_multi_inside/makedict/mandatory.json b/tests/dictionaries/40_9calculation_variable_leader_follower_multi_inside/makedict/mandatory.json new file mode 100644 index 000000000..0637a088a --- /dev/null +++ b/tests/dictionaries/40_9calculation_variable_leader_follower_multi_inside/makedict/mandatory.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/tests/dictionaries/40_9calculation_variable_leader_follower_multi_inside/tiramisu/base.py b/tests/dictionaries/40_9calculation_variable_leader_follower_multi_inside/tiramisu/base.py new file mode 100644 index 000000000..9d321d9d7 --- /dev/null +++ b/tests/dictionaries/40_9calculation_variable_leader_follower_multi_inside/tiramisu/base.py @@ -0,0 +1,17 @@ +from tiramisu import * +from tiramisu.setting import ALLOWED_LEADER_PROPERTIES +from re import compile as re_compile +from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription +load_functions('../rougail-tests/funcs/test.py') +try: + groups.namespace +except: + groups.addgroup('namespace') +ALLOWED_LEADER_PROPERTIES.add("basic") +ALLOWED_LEADER_PROPERTIES.add("standard") +ALLOWED_LEADER_PROPERTIES.add("advanced") +option_3 = StrOption(name="leader", doc="a leader", multi=True, default=["value1", "value2"], properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'}) +option_4 = StrOption(name="follower", doc="a follower", multi=submulti, default_multi=[Calculation(func['calc_value'], Params((ParamOption(option_3))))], properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'}) +optiondescription_2 = Leadership(name="leadership", doc="a leadership", children=[option_3, option_4], properties=frozenset({"standard"})) +optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[optiondescription_2], properties=frozenset({"standard"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1]) diff --git a/tests/dictionaries/40_9calculation_variable_leader_follower_multi_inside/tiramisu/no_namespace.py b/tests/dictionaries/40_9calculation_variable_leader_follower_multi_inside/tiramisu/no_namespace.py new file mode 100644 index 000000000..0b033625d --- /dev/null +++ b/tests/dictionaries/40_9calculation_variable_leader_follower_multi_inside/tiramisu/no_namespace.py @@ -0,0 +1,12 @@ +from tiramisu import * +from tiramisu.setting import ALLOWED_LEADER_PROPERTIES +from re import compile as re_compile +from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription +load_functions('../rougail-tests/funcs/test.py') +ALLOWED_LEADER_PROPERTIES.add("basic") +ALLOWED_LEADER_PROPERTIES.add("standard") +ALLOWED_LEADER_PROPERTIES.add("advanced") +option_2 = StrOption(name="leader", doc="a leader", multi=True, default=["value1", "value2"], properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'}) +option_3 = StrOption(name="follower", doc="a follower", multi=submulti, default_multi=[Calculation(func['calc_value'], Params((ParamOption(option_2))))], properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'}) +optiondescription_1 = Leadership(name="leadership", doc="a leadership", children=[option_2, option_3], properties=frozenset({"standard"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1]) diff --git a/tests/dictionaries/40_9leadership-calculation-outside-follower-no-mandatory/makedict/after.json b/tests/dictionaries/40_9leadership-calculation-outside-follower-no-mandatory/makedict/after.json new file mode 100644 index 000000000..ee3550fd3 --- /dev/null +++ b/tests/dictionaries/40_9leadership-calculation-outside-follower-no-mandatory/makedict/after.json @@ -0,0 +1,26 @@ +{ + "rougail.leader.leader": { + "owner": "default", + "value": [ + "a", + "b" + ] + }, + "rougail.leader.follower": { + "owner": [ + "default", + "default" + ], + "value": [ + null, + null + ] + }, + "rougail.variable": { + "owner": "default", + "value": [ + null, + null + ] + } +} diff --git a/tests/dictionaries/40_9leadership-calculation-outside-follower-no-mandatory/makedict/base.json b/tests/dictionaries/40_9leadership-calculation-outside-follower-no-mandatory/makedict/base.json new file mode 100644 index 000000000..07135b499 --- /dev/null +++ b/tests/dictionaries/40_9leadership-calculation-outside-follower-no-mandatory/makedict/base.json @@ -0,0 +1,16 @@ +{ + "rougail.leader.leader": [ + { + "rougail.leader.leader": "a", + "rougail.leader.follower": null + }, + { + "rougail.leader.leader": "b", + "rougail.leader.follower": null + } + ], + "rougail.variable": [ + null, + null + ] +} diff --git a/tests/dictionaries/40_9leadership-calculation-outside-follower-no-mandatory/makedict/before.json b/tests/dictionaries/40_9leadership-calculation-outside-follower-no-mandatory/makedict/before.json new file mode 100644 index 000000000..ee3550fd3 --- /dev/null +++ b/tests/dictionaries/40_9leadership-calculation-outside-follower-no-mandatory/makedict/before.json @@ -0,0 +1,26 @@ +{ + "rougail.leader.leader": { + "owner": "default", + "value": [ + "a", + "b" + ] + }, + "rougail.leader.follower": { + "owner": [ + "default", + "default" + ], + "value": [ + null, + null + ] + }, + "rougail.variable": { + "owner": "default", + "value": [ + null, + null + ] + } +} diff --git a/tests/dictionaries/40_9leadership-calculation-outside-follower-no-mandatory/makedict/mandatory.json b/tests/dictionaries/40_9leadership-calculation-outside-follower-no-mandatory/makedict/mandatory.json new file mode 100644 index 000000000..0637a088a --- /dev/null +++ b/tests/dictionaries/40_9leadership-calculation-outside-follower-no-mandatory/makedict/mandatory.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/tests/dictionaries/40_9leadership-calculation-outside-follower-no-mandatory/tiramisu/base.py b/tests/dictionaries/40_9leadership-calculation-outside-follower-no-mandatory/tiramisu/base.py new file mode 100644 index 000000000..4a3ecef08 --- /dev/null +++ b/tests/dictionaries/40_9leadership-calculation-outside-follower-no-mandatory/tiramisu/base.py @@ -0,0 +1,18 @@ +from tiramisu import * +from tiramisu.setting import ALLOWED_LEADER_PROPERTIES +from re import compile as re_compile +from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription +load_functions('../rougail-tests/funcs/test.py') +try: + groups.namespace +except: + groups.addgroup('namespace') +ALLOWED_LEADER_PROPERTIES.add("basic") +ALLOWED_LEADER_PROPERTIES.add("standard") +ALLOWED_LEADER_PROPERTIES.add("advanced") +option_3 = StrOption(name="leader", doc="leader", multi=True, default=["a", "b"], properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'}) +option_4 = StrOption(name="follower", doc="follower", multi=True, properties=frozenset({"standard"}), informations={'type': 'string'}) +optiondescription_2 = Leadership(name="leader", doc="leader", children=[option_3, option_4], properties=frozenset({"standard"})) +option_5 = StrOption(name="variable", doc="variable", multi=True, default=Calculation(func['calc_value'], Params((ParamOption(option_4)), kwargs={'__internal_multi': ParamValue(True)})), properties=frozenset({"notempty", "standard"}), informations={'type': 'string'}) +optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[optiondescription_2, option_5], properties=frozenset({"standard"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1]) diff --git a/tests/dictionaries/40_9leadership-calculation-outside-follower-no-mandatory/tiramisu/no_namespace.py b/tests/dictionaries/40_9leadership-calculation-outside-follower-no-mandatory/tiramisu/no_namespace.py new file mode 100644 index 000000000..92f25142d --- /dev/null +++ b/tests/dictionaries/40_9leadership-calculation-outside-follower-no-mandatory/tiramisu/no_namespace.py @@ -0,0 +1,13 @@ +from tiramisu import * +from tiramisu.setting import ALLOWED_LEADER_PROPERTIES +from re import compile as re_compile +from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription +load_functions('../rougail-tests/funcs/test.py') +ALLOWED_LEADER_PROPERTIES.add("basic") +ALLOWED_LEADER_PROPERTIES.add("standard") +ALLOWED_LEADER_PROPERTIES.add("advanced") +option_2 = StrOption(name="leader", doc="leader", multi=True, default=["a", "b"], properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'}) +option_3 = StrOption(name="follower", doc="follower", multi=True, properties=frozenset({"standard"}), informations={'type': 'string'}) +optiondescription_1 = Leadership(name="leader", doc="leader", children=[option_2, option_3], properties=frozenset({"standard"})) +option_4 = StrOption(name="variable", doc="variable", multi=True, default=Calculation(func['calc_value'], Params((ParamOption(option_3)), kwargs={'__internal_multi': ParamValue(True)})), properties=frozenset({"notempty", "standard"}), informations={'type': 'string'}) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1, option_4]) diff --git a/tests/dictionaries/40_9leadership-calculation-variable/makedict/after.json b/tests/dictionaries/40_9leadership-calculation-variable/makedict/after.json new file mode 100644 index 000000000..fd0f62009 --- /dev/null +++ b/tests/dictionaries/40_9leadership-calculation-variable/makedict/after.json @@ -0,0 +1,36 @@ +{ + "rougail.calculate": { + "owner": "default", + "value": [ + "value1", + "value2" + ] + }, + "rougail.leader.leader": { + "owner": "default", + "value": [ + "value1", + "value2" + ] + }, + "rougail.leader.follower1": { + "owner": [ + "default", + "default" + ], + "value": [ + "val11", + "val11" + ] + }, + "rougail.leader.follower2": { + "owner": [ + "default", + "default" + ], + "value": [ + "val21", + "val21" + ] + } +} diff --git a/tests/dictionaries/40_9leadership-calculation-variable/makedict/base.json b/tests/dictionaries/40_9leadership-calculation-variable/makedict/base.json new file mode 100644 index 000000000..f57f0ac29 --- /dev/null +++ b/tests/dictionaries/40_9leadership-calculation-variable/makedict/base.json @@ -0,0 +1,18 @@ +{ + "rougail.calculate": [ + "value1", + "value2" + ], + "rougail.leader.leader": [ + { + "rougail.leader.leader": "value1", + "rougail.leader.follower1": "val11", + "rougail.leader.follower2": "val21" + }, + { + "rougail.leader.leader": "value2", + "rougail.leader.follower1": "val11", + "rougail.leader.follower2": "val21" + } + ] +} diff --git a/tests/dictionaries/40_9leadership-calculation-variable/makedict/before.json b/tests/dictionaries/40_9leadership-calculation-variable/makedict/before.json new file mode 100644 index 000000000..fd0f62009 --- /dev/null +++ b/tests/dictionaries/40_9leadership-calculation-variable/makedict/before.json @@ -0,0 +1,36 @@ +{ + "rougail.calculate": { + "owner": "default", + "value": [ + "value1", + "value2" + ] + }, + "rougail.leader.leader": { + "owner": "default", + "value": [ + "value1", + "value2" + ] + }, + "rougail.leader.follower1": { + "owner": [ + "default", + "default" + ], + "value": [ + "val11", + "val11" + ] + }, + "rougail.leader.follower2": { + "owner": [ + "default", + "default" + ], + "value": [ + "val21", + "val21" + ] + } +} diff --git a/tests/dictionaries/40_9leadership-calculation-variable/makedict/mandatory.json b/tests/dictionaries/40_9leadership-calculation-variable/makedict/mandatory.json new file mode 100644 index 000000000..0637a088a --- /dev/null +++ b/tests/dictionaries/40_9leadership-calculation-variable/makedict/mandatory.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/tests/dictionaries/40_9leadership-calculation-variable/tiramisu/base.py b/tests/dictionaries/40_9leadership-calculation-variable/tiramisu/base.py new file mode 100644 index 000000000..af71aff88 --- /dev/null +++ b/tests/dictionaries/40_9leadership-calculation-variable/tiramisu/base.py @@ -0,0 +1,19 @@ +from tiramisu import * +from tiramisu.setting import ALLOWED_LEADER_PROPERTIES +from re import compile as re_compile +from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription +load_functions('../rougail-tests/funcs/test.py') +try: + groups.namespace +except: + groups.addgroup('namespace') +ALLOWED_LEADER_PROPERTIES.add("basic") +ALLOWED_LEADER_PROPERTIES.add("standard") +ALLOWED_LEADER_PROPERTIES.add("advanced") +option_2 = StrOption(name="calculate", doc="a calculated variable", multi=True, default=["value1", "value2"], default_multi="value1", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'}) +option_4 = StrOption(name="leader", doc="a leader", multi=True, default=Calculation(func['calc_value'], Params((ParamOption(option_2)), kwargs={'__internal_multi': ParamValue(True)})), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'}) +option_5 = StrOption(name="follower1", doc="a follower", multi=True, default_multi="val11", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'}) +option_6 = StrOption(name="follower2", doc="an other follower", multi=True, default_multi="val21", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'}) +optiondescription_3 = Leadership(name="leader", doc="a leadership", children=[option_4, option_5, option_6], properties=frozenset({"standard"})) +optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_2, optiondescription_3], properties=frozenset({"standard"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1]) diff --git a/tests/dictionaries/40_9leadership-calculation-variable/tiramisu/no_namespace.py b/tests/dictionaries/40_9leadership-calculation-variable/tiramisu/no_namespace.py new file mode 100644 index 000000000..2c449ab73 --- /dev/null +++ b/tests/dictionaries/40_9leadership-calculation-variable/tiramisu/no_namespace.py @@ -0,0 +1,14 @@ +from tiramisu import * +from tiramisu.setting import ALLOWED_LEADER_PROPERTIES +from re import compile as re_compile +from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription +load_functions('../rougail-tests/funcs/test.py') +ALLOWED_LEADER_PROPERTIES.add("basic") +ALLOWED_LEADER_PROPERTIES.add("standard") +ALLOWED_LEADER_PROPERTIES.add("advanced") +option_1 = StrOption(name="calculate", doc="a calculated variable", multi=True, default=["value1", "value2"], default_multi="value1", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'}) +option_3 = StrOption(name="leader", doc="a leader", multi=True, default=Calculation(func['calc_value'], Params((ParamOption(option_1)), kwargs={'__internal_multi': ParamValue(True)})), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'}) +option_4 = StrOption(name="follower1", doc="a follower", multi=True, default_multi="val11", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'}) +option_5 = StrOption(name="follower2", doc="an other follower", multi=True, default_multi="val21", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'}) +optiondescription_2 = Leadership(name="leader", doc="a leadership", children=[option_3, option_4, option_5], properties=frozenset({"standard"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, optiondescription_2]) diff --git a/tests/dictionaries/40_9leadership-calculation-variable_leader_follower/makedict/after.json b/tests/dictionaries/40_9leadership-calculation-variable_leader_follower/makedict/after.json new file mode 100644 index 000000000..2736e59c6 --- /dev/null +++ b/tests/dictionaries/40_9leadership-calculation-variable_leader_follower/makedict/after.json @@ -0,0 +1,36 @@ +{ + "rougail.leadership_1.leader": { + "owner": "default", + "value": [ + "value1", + "value2" + ] + }, + "rougail.leadership_1.follower": { + "owner": [ + "default", + "default" + ], + "value": [ + null, + null + ] + }, + "rougail.leadership_2.leader": { + "owner": "default", + "value": [ + null, + null + ] + }, + "rougail.leadership_2.follower": { + "owner": [ + "default", + "default" + ], + "value": [ + "val", + "val" + ] + } +} diff --git a/tests/dictionaries/40_9leadership-calculation-variable_leader_follower/makedict/base.json b/tests/dictionaries/40_9leadership-calculation-variable_leader_follower/makedict/base.json new file mode 100644 index 000000000..0c042a9a1 --- /dev/null +++ b/tests/dictionaries/40_9leadership-calculation-variable_leader_follower/makedict/base.json @@ -0,0 +1,22 @@ +{ + "rougail.leadership_1.leader": [ + { + "rougail.leadership_1.leader": "value1", + "rougail.leadership_1.follower": null + }, + { + "rougail.leadership_1.leader": "value2", + "rougail.leadership_1.follower": null + } + ], + "rougail.leadership_2.leader": [ + { + "rougail.leadership_2.leader": null, + "rougail.leadership_2.follower": "val" + }, + { + "rougail.leadership_2.leader": null, + "rougail.leadership_2.follower": "val" + } + ] +} diff --git a/tests/dictionaries/40_9leadership-calculation-variable_leader_follower/makedict/before.json b/tests/dictionaries/40_9leadership-calculation-variable_leader_follower/makedict/before.json new file mode 100644 index 000000000..2736e59c6 --- /dev/null +++ b/tests/dictionaries/40_9leadership-calculation-variable_leader_follower/makedict/before.json @@ -0,0 +1,36 @@ +{ + "rougail.leadership_1.leader": { + "owner": "default", + "value": [ + "value1", + "value2" + ] + }, + "rougail.leadership_1.follower": { + "owner": [ + "default", + "default" + ], + "value": [ + null, + null + ] + }, + "rougail.leadership_2.leader": { + "owner": "default", + "value": [ + null, + null + ] + }, + "rougail.leadership_2.follower": { + "owner": [ + "default", + "default" + ], + "value": [ + "val", + "val" + ] + } +} diff --git a/tests/dictionaries/40_9leadership-calculation-variable_leader_follower/makedict/mandatory.json b/tests/dictionaries/40_9leadership-calculation-variable_leader_follower/makedict/mandatory.json new file mode 100644 index 000000000..5574cdca2 --- /dev/null +++ b/tests/dictionaries/40_9leadership-calculation-variable_leader_follower/makedict/mandatory.json @@ -0,0 +1 @@ +["rougail.leadership_1.follower", "rougail.leadership_1.follower", "rougail.leadership_2.leader"] \ No newline at end of file diff --git a/tests/dictionaries/40_9leadership-calculation-variable_leader_follower/tiramisu/base.py b/tests/dictionaries/40_9leadership-calculation-variable_leader_follower/tiramisu/base.py new file mode 100644 index 000000000..8a3dae803 --- /dev/null +++ b/tests/dictionaries/40_9leadership-calculation-variable_leader_follower/tiramisu/base.py @@ -0,0 +1,20 @@ +from tiramisu import * +from tiramisu.setting import ALLOWED_LEADER_PROPERTIES +from re import compile as re_compile +from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription +load_functions('../rougail-tests/funcs/test.py') +try: + groups.namespace +except: + groups.addgroup('namespace') +ALLOWED_LEADER_PROPERTIES.add("basic") +ALLOWED_LEADER_PROPERTIES.add("standard") +ALLOWED_LEADER_PROPERTIES.add("advanced") +option_3 = StrOption(name="leader", doc="a leader", multi=True, default=["value1", "value2"], properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'}) +option_4 = StrOption(name="follower", doc="a follower", multi=True, properties=frozenset({"basic", "mandatory"}), informations={'type': 'string'}) +optiondescription_2 = Leadership(name="leadership_1", doc="a leadership", children=[option_3, option_4], properties=frozenset({"basic"})) +option_6 = StrOption(name="leader", doc="a leader", multi=True, default=Calculation(func['calc_value'], Params((ParamOption(option_4)), kwargs={'__internal_multi': ParamValue(True)})), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'}) +option_7 = StrOption(name="follower", doc="a follower", multi=True, default_multi="val", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'}) +optiondescription_5 = Leadership(name="leadership_2", doc="a second leadership", children=[option_6, option_7], properties=frozenset({"standard"})) +optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[optiondescription_2, optiondescription_5], properties=frozenset({"basic"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1]) diff --git a/tests/dictionaries/40_9leadership-calculation-variable_leader_follower/tiramisu/no_namespace.py b/tests/dictionaries/40_9leadership-calculation-variable_leader_follower/tiramisu/no_namespace.py new file mode 100644 index 000000000..be62f95ea --- /dev/null +++ b/tests/dictionaries/40_9leadership-calculation-variable_leader_follower/tiramisu/no_namespace.py @@ -0,0 +1,15 @@ +from tiramisu import * +from tiramisu.setting import ALLOWED_LEADER_PROPERTIES +from re import compile as re_compile +from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription +load_functions('../rougail-tests/funcs/test.py') +ALLOWED_LEADER_PROPERTIES.add("basic") +ALLOWED_LEADER_PROPERTIES.add("standard") +ALLOWED_LEADER_PROPERTIES.add("advanced") +option_2 = StrOption(name="leader", doc="a leader", multi=True, default=["value1", "value2"], properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'}) +option_3 = StrOption(name="follower", doc="a follower", multi=True, properties=frozenset({"basic", "mandatory"}), informations={'type': 'string'}) +optiondescription_1 = Leadership(name="leadership_1", doc="a leadership", children=[option_2, option_3], properties=frozenset({"basic"})) +option_5 = StrOption(name="leader", doc="a leader", multi=True, default=Calculation(func['calc_value'], Params((ParamOption(option_3)), kwargs={'__internal_multi': ParamValue(True)})), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'}) +option_6 = StrOption(name="follower", doc="a follower", multi=True, default_multi="val", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'}) +optiondescription_4 = Leadership(name="leadership_2", doc="a second leadership", children=[option_5, option_6], properties=frozenset({"standard"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1, optiondescription_4]) diff --git a/tests/dictionaries/40_9leadership-calculation-variable_leader_follower_not_same/makedict/after.json b/tests/dictionaries/40_9leadership-calculation-variable_leader_follower_not_same/makedict/after.json new file mode 100644 index 000000000..bd52cb66a --- /dev/null +++ b/tests/dictionaries/40_9leadership-calculation-variable_leader_follower_not_same/makedict/after.json @@ -0,0 +1,42 @@ +{ + "rougail.leadership_1.leader": { + "owner": "default", + "value": [ + "value1", + "value2" + ] + }, + "rougail.leadership_1.follower": { + "owner": [ + "default", + "default" + ], + "value": [ + null, + null + ] + }, + "rougail.leadership_2.leader": { + "owner": "default", + "value": [ + "value1", + "value2" + ] + }, + "rougail.leadership_2.follower": { + "owner": [ + "default", + "default" + ], + "value": [ + [ + "value1", + "value2" + ], + [ + "value1", + "value2" + ] + ] + } +} diff --git a/tests/dictionaries/40_9leadership-calculation-variable_leader_follower_not_same/makedict/base.json b/tests/dictionaries/40_9leadership-calculation-variable_leader_follower_not_same/makedict/base.json new file mode 100644 index 000000000..acd045e84 --- /dev/null +++ b/tests/dictionaries/40_9leadership-calculation-variable_leader_follower_not_same/makedict/base.json @@ -0,0 +1,28 @@ +{ + "rougail.leadership_1.leader": [ + { + "rougail.leadership_1.leader": "value1", + "rougail.leadership_1.follower": null + }, + { + "rougail.leadership_1.leader": "value2", + "rougail.leadership_1.follower": null + } + ], + "rougail.leadership_2.leader": [ + { + "rougail.leadership_2.leader": "value1", + "rougail.leadership_2.follower": [ + "value1", + "value2" + ] + }, + { + "rougail.leadership_2.leader": "value2", + "rougail.leadership_2.follower": [ + "value1", + "value2" + ] + } + ] +} diff --git a/tests/dictionaries/40_9leadership-calculation-variable_leader_follower_not_same/makedict/before.json b/tests/dictionaries/40_9leadership-calculation-variable_leader_follower_not_same/makedict/before.json new file mode 100644 index 000000000..bd52cb66a --- /dev/null +++ b/tests/dictionaries/40_9leadership-calculation-variable_leader_follower_not_same/makedict/before.json @@ -0,0 +1,42 @@ +{ + "rougail.leadership_1.leader": { + "owner": "default", + "value": [ + "value1", + "value2" + ] + }, + "rougail.leadership_1.follower": { + "owner": [ + "default", + "default" + ], + "value": [ + null, + null + ] + }, + "rougail.leadership_2.leader": { + "owner": "default", + "value": [ + "value1", + "value2" + ] + }, + "rougail.leadership_2.follower": { + "owner": [ + "default", + "default" + ], + "value": [ + [ + "value1", + "value2" + ], + [ + "value1", + "value2" + ] + ] + } +} diff --git a/tests/dictionaries/40_9leadership-calculation-variable_leader_follower_not_same/makedict/mandatory.json b/tests/dictionaries/40_9leadership-calculation-variable_leader_follower_not_same/makedict/mandatory.json new file mode 100644 index 000000000..f78951f79 --- /dev/null +++ b/tests/dictionaries/40_9leadership-calculation-variable_leader_follower_not_same/makedict/mandatory.json @@ -0,0 +1 @@ +["rougail.leadership_1.follower", "rougail.leadership_1.follower"] \ No newline at end of file diff --git a/tests/dictionaries/40_9leadership-calculation-variable_leader_follower_not_same/tiramisu/base.py b/tests/dictionaries/40_9leadership-calculation-variable_leader_follower_not_same/tiramisu/base.py new file mode 100644 index 000000000..3d36536d8 --- /dev/null +++ b/tests/dictionaries/40_9leadership-calculation-variable_leader_follower_not_same/tiramisu/base.py @@ -0,0 +1,20 @@ +from tiramisu import * +from tiramisu.setting import ALLOWED_LEADER_PROPERTIES +from re import compile as re_compile +from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription +load_functions('../rougail-tests/funcs/test.py') +try: + groups.namespace +except: + groups.addgroup('namespace') +ALLOWED_LEADER_PROPERTIES.add("basic") +ALLOWED_LEADER_PROPERTIES.add("standard") +ALLOWED_LEADER_PROPERTIES.add("advanced") +option_3 = StrOption(name="leader", doc="a leader", multi=True, default=["value1", "value2"], properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'}) +option_4 = StrOption(name="follower", doc="a follower", multi=True, properties=frozenset({"basic", "mandatory"}), informations={'type': 'string'}) +optiondescription_2 = Leadership(name="leadership_1", doc="a leadership", children=[option_3, option_4], properties=frozenset({"basic"})) +option_6 = StrOption(name="leader", doc="a leader", multi=True, default=["value1", "value2"], properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'}) +option_7 = StrOption(name="follower", doc="a follower", multi=submulti, default=Calculation(func['calc_value'], Params((ParamOption(option_3)), kwargs={'__internal_multi': ParamValue(True)})), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'}) +optiondescription_5 = Leadership(name="leadership_2", doc="a second leadership", children=[option_6, option_7], properties=frozenset({"standard"})) +optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[optiondescription_2, optiondescription_5], properties=frozenset({"basic"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1]) diff --git a/tests/dictionaries/40_9leadership-calculation-variable_leader_follower_not_same/tiramisu/no_namespace.py b/tests/dictionaries/40_9leadership-calculation-variable_leader_follower_not_same/tiramisu/no_namespace.py new file mode 100644 index 000000000..15044817f --- /dev/null +++ b/tests/dictionaries/40_9leadership-calculation-variable_leader_follower_not_same/tiramisu/no_namespace.py @@ -0,0 +1,15 @@ +from tiramisu import * +from tiramisu.setting import ALLOWED_LEADER_PROPERTIES +from re import compile as re_compile +from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription +load_functions('../rougail-tests/funcs/test.py') +ALLOWED_LEADER_PROPERTIES.add("basic") +ALLOWED_LEADER_PROPERTIES.add("standard") +ALLOWED_LEADER_PROPERTIES.add("advanced") +option_2 = StrOption(name="leader", doc="a leader", multi=True, default=["value1", "value2"], properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'}) +option_3 = StrOption(name="follower", doc="a follower", multi=True, properties=frozenset({"basic", "mandatory"}), informations={'type': 'string'}) +optiondescription_1 = Leadership(name="leadership_1", doc="a leadership", children=[option_2, option_3], properties=frozenset({"basic"})) +option_5 = StrOption(name="leader", doc="a leader", multi=True, default=["value1", "value2"], properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'}) +option_6 = StrOption(name="follower", doc="a follower", multi=submulti, default=Calculation(func['calc_value'], Params((ParamOption(option_2)), kwargs={'__internal_multi': ParamValue(True)})), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'}) +optiondescription_4 = Leadership(name="leadership_2", doc="a second leadership", children=[option_5, option_6], properties=frozenset({"standard"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1, optiondescription_4]) diff --git a/tests/dictionaries/60_0family_dynamic_upper_char/makedict/after.json b/tests/dictionaries/60_0family_dynamic_upper_char/makedict/after.json new file mode 100644 index 000000000..fd222bf5c --- /dev/null +++ b/tests/dictionaries/60_0family_dynamic_upper_char/makedict/after.json @@ -0,0 +1,17 @@ +{ + "rougail.var": { + "owner": "default", + "value": [ + "Val1", + "VAL2" + ] + }, + "rougail.dynval1.var": { + "owner": "default", + "value": null + }, + "rougail.dynval2.var": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/60_0family_dynamic_upper_char/makedict/base.json b/tests/dictionaries/60_0family_dynamic_upper_char/makedict/base.json new file mode 100644 index 000000000..178e1eac1 --- /dev/null +++ b/tests/dictionaries/60_0family_dynamic_upper_char/makedict/base.json @@ -0,0 +1,8 @@ +{ + "rougail.var": [ + "Val1", + "VAL2" + ], + "rougail.dynval1.var": null, + "rougail.dynval2.var": null +} diff --git a/tests/dictionaries/60_0family_dynamic_upper_char/makedict/before.json b/tests/dictionaries/60_0family_dynamic_upper_char/makedict/before.json new file mode 100644 index 000000000..fd222bf5c --- /dev/null +++ b/tests/dictionaries/60_0family_dynamic_upper_char/makedict/before.json @@ -0,0 +1,17 @@ +{ + "rougail.var": { + "owner": "default", + "value": [ + "Val1", + "VAL2" + ] + }, + "rougail.dynval1.var": { + "owner": "default", + "value": null + }, + "rougail.dynval2.var": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/60_0family_dynamic_upper_char/makedict/mandatory.json b/tests/dictionaries/60_0family_dynamic_upper_char/makedict/mandatory.json new file mode 100644 index 000000000..ab51d9ec5 --- /dev/null +++ b/tests/dictionaries/60_0family_dynamic_upper_char/makedict/mandatory.json @@ -0,0 +1 @@ +["rougail.dynval1.var", "rougail.dynval2.var"] \ No newline at end of file diff --git a/tests/dictionaries/60_6family_dynamic_suffix_auto_multi/makedict/after.json b/tests/dictionaries/60_6family_dynamic_suffix_auto_multi/makedict/after.json new file mode 100644 index 000000000..7f32d937e --- /dev/null +++ b/tests/dictionaries/60_6family_dynamic_suffix_auto_multi/makedict/after.json @@ -0,0 +1,32 @@ +{ + "rougail.var1": { + "owner": "default", + "value": [ + "val1", + "val2" + ] + }, + "rougail.dynval1.dynval1.var": { + "owner": "default", + "value": null + }, + "rougail.dynval1.dynval2.var": { + "owner": "default", + "value": null + }, + "rougail.dynval2.dynval1.var": { + "owner": "default", + "value": null + }, + "rougail.dynval2.dynval2.var": { + "owner": "default", + "value": null + }, + "rougail.var2": { + "owner": "default", + "value": [ + null, + null + ] + } +} diff --git a/tests/dictionaries/60_6family_dynamic_suffix_auto_multi/makedict/base.json b/tests/dictionaries/60_6family_dynamic_suffix_auto_multi/makedict/base.json new file mode 100644 index 000000000..cccd7c422 --- /dev/null +++ b/tests/dictionaries/60_6family_dynamic_suffix_auto_multi/makedict/base.json @@ -0,0 +1,14 @@ +{ + "rougail.var1": [ + "val1", + "val2" + ], + "rougail.dynval1.dynval1.var": null, + "rougail.dynval1.dynval2.var": null, + "rougail.dynval2.dynval1.var": null, + "rougail.dynval2.dynval2.var": null, + "rougail.var2": [ + null, + null + ] +} diff --git a/tests/dictionaries/60_6family_dynamic_suffix_auto_multi/makedict/before.json b/tests/dictionaries/60_6family_dynamic_suffix_auto_multi/makedict/before.json new file mode 100644 index 000000000..7f32d937e --- /dev/null +++ b/tests/dictionaries/60_6family_dynamic_suffix_auto_multi/makedict/before.json @@ -0,0 +1,32 @@ +{ + "rougail.var1": { + "owner": "default", + "value": [ + "val1", + "val2" + ] + }, + "rougail.dynval1.dynval1.var": { + "owner": "default", + "value": null + }, + "rougail.dynval1.dynval2.var": { + "owner": "default", + "value": null + }, + "rougail.dynval2.dynval1.var": { + "owner": "default", + "value": null + }, + "rougail.dynval2.dynval2.var": { + "owner": "default", + "value": null + }, + "rougail.var2": { + "owner": "default", + "value": [ + null, + null + ] + } +} diff --git a/tests/dictionaries/60_6family_dynamic_suffix_auto_multi/makedict/mandatory.json b/tests/dictionaries/60_6family_dynamic_suffix_auto_multi/makedict/mandatory.json new file mode 100644 index 000000000..15fa27a3e --- /dev/null +++ b/tests/dictionaries/60_6family_dynamic_suffix_auto_multi/makedict/mandatory.json @@ -0,0 +1 @@ +["rougail.dynval1.dynval1.var", "rougail.dynval1.dynval2.var", "rougail.dynval2.dynval1.var", "rougail.dynval2.dynval2.var", "rougail.var2"] \ No newline at end of file diff --git a/tests/dictionaries/60_6family_dynamic_suffix_auto_multi/tiramisu/base.py b/tests/dictionaries/60_6family_dynamic_suffix_auto_multi/tiramisu/base.py new file mode 100644 index 000000000..e4069d48d --- /dev/null +++ b/tests/dictionaries/60_6family_dynamic_suffix_auto_multi/tiramisu/base.py @@ -0,0 +1,19 @@ +from tiramisu import * +from tiramisu.setting import ALLOWED_LEADER_PROPERTIES +from re import compile as re_compile +from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription +load_functions('../rougail-tests/funcs/test.py') +try: + groups.namespace +except: + groups.addgroup('namespace') +ALLOWED_LEADER_PROPERTIES.add("basic") +ALLOWED_LEADER_PROPERTIES.add("standard") +ALLOWED_LEADER_PROPERTIES.add("advanced") +option_2 = StrOption(name="var1", doc="A suffix variable", multi=True, default=["val1", "val2"], default_multi="val1", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'}) +option_5 = StrOption(name="var", doc="A dynamic variable", properties=frozenset({"basic", "mandatory"}), informations={'type': 'string'}) +optiondescription_4 = ConvertDynOptionDescription(name="dyn{{ identifier }}", doc="dyn{{ identifier }}", identifiers=Calculation(func['calc_value'], Params((ParamOption(option_2)))), children=[option_5], properties=frozenset({"basic"}), informations={'dynamic_variable': 'rougail.var1'}) +optiondescription_3 = ConvertDynOptionDescription(name="dyn{{ identifier }}", doc="dyn{{ identifier }}", identifiers=Calculation(func['calc_value'], Params((ParamOption(option_2)))), children=[optiondescription_4], properties=frozenset({"basic"}), informations={'dynamic_variable': 'rougail.var1'}) +option_6 = StrOption(name="var2", doc="A variable calculated", multi=True, default=Calculation(func['calc_value'], Params((ParamDynOption(option_5, ["val1"])), kwargs={'__internal_multi': ParamValue(True)})), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'}) +optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_2, optiondescription_3, option_6], properties=frozenset({"basic"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1]) diff --git a/tests/errors/21_0calculation_variable_inside_list_non_list/errno_68 b/tests/errors/21_0calculation_variable_inside_list_non_list/errno_68 new file mode 100644 index 000000000..e69de29bb diff --git a/tests/errors/21_0calculation_variable_inside_list_non_list/rougail/00-base.yml b/tests/errors/21_0calculation_variable_inside_list_non_list/rougail/00-base.yml new file mode 100644 index 000000000..b2f377466 --- /dev/null +++ b/tests/errors/21_0calculation_variable_inside_list_non_list/rougail/00-base.yml @@ -0,0 +1,10 @@ +--- +version: 1.1 + +var1: "no" # a variable + +var2: + description: a varaible + multi: false + default: + - variable: _.var1 diff --git a/tests/errors/21_0calculation_variable_multi_inside_list/errno_18 b/tests/errors/21_0calculation_variable_multi_inside_list/errno_18 new file mode 100644 index 000000000..e69de29bb diff --git a/tests/errors/21_0calculation_variable_multi_inside_list/rougail/00-base.yml b/tests/errors/21_0calculation_variable_multi_inside_list/rougail/00-base.yml new file mode 100644 index 000000000..6d71956b2 --- /dev/null +++ b/tests/errors/21_0calculation_variable_multi_inside_list/rougail/00-base.yml @@ -0,0 +1,9 @@ +--- +version: 1.1 + +var1: # a variable + - val1 + +var2: + default: + - variable: _.var1 diff --git a/tests/errors/21_0calculation_variable_multi_non_multi/errno_20 b/tests/errors/21_0calculation_variable_multi_non_multi/errno_20 new file mode 100644 index 000000000..e69de29bb diff --git a/tests/errors/21_0calculation_variable_multi_non_multi/rougail/00-base.yml b/tests/errors/21_0calculation_variable_multi_non_multi/rougail/00-base.yml new file mode 100644 index 000000000..f992e01b2 --- /dev/null +++ b/tests/errors/21_0calculation_variable_multi_non_multi/rougail/00-base.yml @@ -0,0 +1,10 @@ +--- +version: 1.1 + +var1: "no" # a variable + +var2: + description: a varaible + multi: true + default: + variable: _.var1 diff --git a/tests/errors/21_0calculation_variable_multi_non_multi_2/errno_21 b/tests/errors/21_0calculation_variable_multi_non_multi_2/errno_21 new file mode 100644 index 000000000..e69de29bb diff --git a/tests/errors/21_0calculation_variable_multi_non_multi_2/rougail/00-base.yml b/tests/errors/21_0calculation_variable_multi_non_multi_2/rougail/00-base.yml new file mode 100644 index 000000000..59fa04263 --- /dev/null +++ b/tests/errors/21_0calculation_variable_multi_non_multi_2/rougail/00-base.yml @@ -0,0 +1,11 @@ +--- +version: 1.1 + +var1: # a variable + - no + +var2: + description: a varaible + multi: false + default: + variable: _.var1 diff --git a/tests/errors/22_0calculation_variable_follower_follower/errno_21 b/tests/errors/22_0calculation_variable_follower_follower/errno_21 new file mode 100644 index 000000000..e69de29bb diff --git a/tests/errors/22_0calculation_variable_follower_follower/rougail/00-base.yml b/tests/errors/22_0calculation_variable_follower_follower/rougail/00-base.yml new file mode 100644 index 000000000..cd2a094f3 --- /dev/null +++ b/tests/errors/22_0calculation_variable_follower_follower/rougail/00-base.yml @@ -0,0 +1,28 @@ +--- +version: 1.1 + +leadership_1: + description: a leadership + type: leadership + + leader: + description: a leader + default: + - value1 + - value2 + + follower: + description: a follower + +leadership_2: + description: a second leadership + type: leadership + + leader: + description: a leader + + follower: + description: a follower + multi: false + default: + variable: __.leadership_1.follower diff --git a/tests/errors/22_0calculation_variable_follower_multi_inside_list/errno_18 b/tests/errors/22_0calculation_variable_follower_multi_inside_list/errno_18 new file mode 100644 index 000000000..e69de29bb diff --git a/tests/errors/22_0calculation_variable_follower_multi_inside_list/rougail/00-base.yml b/tests/errors/22_0calculation_variable_follower_multi_inside_list/rougail/00-base.yml new file mode 100644 index 000000000..ae50c0ea7 --- /dev/null +++ b/tests/errors/22_0calculation_variable_follower_multi_inside_list/rougail/00-base.yml @@ -0,0 +1,19 @@ +--- +version: 1.1 + +variable: + default: + - val1 + +leader: + type: leadership + + leader: + default: + - a + - b + + follower: + multi: true + default: + - variable: __.variable diff --git a/tests/errors/22_0calculation_variable_follower_multi_no_multi/errno_20 b/tests/errors/22_0calculation_variable_follower_multi_no_multi/errno_20 new file mode 100644 index 000000000..e69de29bb diff --git a/tests/errors/22_0calculation_variable_follower_multi_no_multi/rougail/00-base.yml b/tests/errors/22_0calculation_variable_follower_multi_no_multi/rougail/00-base.yml new file mode 100644 index 000000000..8d8270540 --- /dev/null +++ b/tests/errors/22_0calculation_variable_follower_multi_no_multi/rougail/00-base.yml @@ -0,0 +1,18 @@ +--- +version: 1.1 + +variable: + default: val1 + +leader: + type: leadership + + leader: + default: + - a + - b + + follower: + multi: true + default: + variable: __.variable diff --git a/tests/errors/22_0calculation_variable_follower_no_multi_inside_list/errno_87 b/tests/errors/22_0calculation_variable_follower_no_multi_inside_list/errno_87 new file mode 100644 index 000000000..e69de29bb diff --git a/tests/errors/22_0calculation_variable_follower_no_multi_inside_list/rougail/00-base.yml b/tests/errors/22_0calculation_variable_follower_no_multi_inside_list/rougail/00-base.yml new file mode 100644 index 000000000..d46dd44bc --- /dev/null +++ b/tests/errors/22_0calculation_variable_follower_no_multi_inside_list/rougail/00-base.yml @@ -0,0 +1,19 @@ +--- +version: 1.1 + +variable: + default: + - val1 + +leader: + type: leadership + + leader: + default: + - a + - b + + follower: + multi: false + default: + - variable: __.variable diff --git a/tests/errors/22_0calculation_variable_follower_no_multi_multi/errno_21 b/tests/errors/22_0calculation_variable_follower_no_multi_multi/errno_21 new file mode 100644 index 000000000..e69de29bb diff --git a/tests/errors/22_0calculation_variable_follower_no_multi_multi/rougail/00-base.yml b/tests/errors/22_0calculation_variable_follower_no_multi_multi/rougail/00-base.yml new file mode 100644 index 000000000..acc57dffc --- /dev/null +++ b/tests/errors/22_0calculation_variable_follower_no_multi_multi/rougail/00-base.yml @@ -0,0 +1,19 @@ +--- +version: 1.1 + +variable: + default: + - val1 + +leader: + type: leadership + + leader: + default: + - a + - b + + follower: + multi: false + default: + variable: __.variable diff --git a/tests/errors/22_0calculation_variable_leader_follower/errno_18 b/tests/errors/22_0calculation_variable_leader_follower/errno_18 new file mode 100644 index 000000000..e69de29bb diff --git a/tests/errors/22_0calculation_variable_leader_follower/rougail/00-base.yml b/tests/errors/22_0calculation_variable_leader_follower/rougail/00-base.yml new file mode 100644 index 000000000..5f2376abd --- /dev/null +++ b/tests/errors/22_0calculation_variable_leader_follower/rougail/00-base.yml @@ -0,0 +1,28 @@ +--- +version: 1.1 + +leadership_1: + description: a leadership + type: leadership + + leader: + description: a leader + default: + - value1 + - value2 + + follower: + description: a follower + +leadership_2: + description: a second leadership + type: leadership + + leader: + description: a leader + default: + - variable: __.leadership_1.follower + + follower: + description: a follower + default: val diff --git a/tests/errors/22_0calculation_variable_leader_follower_multi/errno_20 b/tests/errors/22_0calculation_variable_leader_follower_multi/errno_20 new file mode 100644 index 000000000..e69de29bb diff --git a/tests/errors/22_0calculation_variable_leader_follower_multi/rougail/00-base.yml b/tests/errors/22_0calculation_variable_leader_follower_multi/rougail/00-base.yml new file mode 100644 index 000000000..b5edb84e3 --- /dev/null +++ b/tests/errors/22_0calculation_variable_leader_follower_multi/rougail/00-base.yml @@ -0,0 +1,18 @@ +--- +version: 1.1 + +leadership: + description: a leadership + type: leadership + + leader: + description: a leader + default: + - value1 + - value2 + + follower: + description: a follower + multi: true + default: + variable: _.leader diff --git a/tests/errors/22_0calculation_variable_leader_follower_multi2/errno_74 b/tests/errors/22_0calculation_variable_leader_follower_multi2/errno_74 new file mode 100644 index 000000000..e69de29bb diff --git a/tests/errors/22_0calculation_variable_leader_follower_multi2/rougail/00-base.yml b/tests/errors/22_0calculation_variable_leader_follower_multi2/rougail/00-base.yml new file mode 100644 index 000000000..12d1c1969 --- /dev/null +++ b/tests/errors/22_0calculation_variable_leader_follower_multi2/rougail/00-base.yml @@ -0,0 +1,29 @@ +--- +version: 1.1 + +leadership_1: + description: a leadership + type: leadership + + leader: + description: a leader + default: + - value1 + - value2 + + follower: + description: a follower + multi: true + +leadership_2: + description: a second leadership + type: leadership + + leader: + description: a leader + default: + variable: __.leadership_1.follower + + follower: + description: a follower + default: val diff --git a/tests/errors/22_0calculation_variable_leader_follower_not_same/errno_21 b/tests/errors/22_0calculation_variable_leader_follower_not_same/errno_21 new file mode 100644 index 000000000..e69de29bb diff --git a/tests/errors/22_0calculation_variable_leader_follower_not_same/rougail/00-base.yml b/tests/errors/22_0calculation_variable_leader_follower_not_same/rougail/00-base.yml new file mode 100644 index 000000000..0a59702a9 --- /dev/null +++ b/tests/errors/22_0calculation_variable_leader_follower_not_same/rougail/00-base.yml @@ -0,0 +1,31 @@ +--- +version: 1.1 + +leadership_1: + description: a leadership + type: leadership + + leader: + description: a leader + default: + - value1 + - value2 + + follower: + description: a follower + +leadership_2: + description: a second leadership + type: leadership + + leader: + description: a leader + default: + - value1 + - value2 + + follower: + description: a follower + multi: false + default: + variable: __.leadership_1.leader diff --git a/tests/errors/22_0calculation_variable_leader_follower_not_same_inside_list/errno_18 b/tests/errors/22_0calculation_variable_leader_follower_not_same_inside_list/errno_18 new file mode 100644 index 000000000..e69de29bb diff --git a/tests/errors/22_0calculation_variable_leader_follower_not_same_inside_list/rougail/00-base.yml b/tests/errors/22_0calculation_variable_leader_follower_not_same_inside_list/rougail/00-base.yml new file mode 100644 index 000000000..7e168b4e8 --- /dev/null +++ b/tests/errors/22_0calculation_variable_leader_follower_not_same_inside_list/rougail/00-base.yml @@ -0,0 +1,30 @@ +--- +version: 1.1 + +leadership_1: + description: a leadership + type: leadership + + leader: + description: a leader + default: + - value1 + - value2 + + follower: + description: a follower + +leadership_2: + description: a second leadership + type: leadership + + leader: + description: a leader + default: + - value1 + - value2 + + follower: + description: a follower + default: + - variable: __.leadership_1.leader diff --git a/tests/errors/22_0calculation_variable_leader_multi_in_list/errno_18 b/tests/errors/22_0calculation_variable_leader_multi_in_list/errno_18 new file mode 100644 index 000000000..e69de29bb diff --git a/tests/errors/22_0calculation_variable_leader_multi_in_list/rougail/00-base.yml b/tests/errors/22_0calculation_variable_leader_multi_in_list/rougail/00-base.yml new file mode 100644 index 000000000..9fd872420 --- /dev/null +++ b/tests/errors/22_0calculation_variable_leader_multi_in_list/rougail/00-base.yml @@ -0,0 +1,19 @@ +--- +version: 1.1 + +calculate: + description: a calculated variable + default: + - value1 + - value2 + +leadership: + description: a leadership + type: leadership + + leader: + description: a leader + default: + - variable: __.calculate + + follower: val11 # a follower diff --git a/tests/errors/22_0calculation_variable_leader_non_multi/errno_20 b/tests/errors/22_0calculation_variable_leader_non_multi/errno_20 new file mode 100644 index 000000000..e69de29bb diff --git a/tests/errors/22_0calculation_variable_leader_non_multi/rougail/00-base.yml b/tests/errors/22_0calculation_variable_leader_non_multi/rougail/00-base.yml new file mode 100644 index 000000000..706fb047d --- /dev/null +++ b/tests/errors/22_0calculation_variable_leader_non_multi/rougail/00-base.yml @@ -0,0 +1,17 @@ +--- +version: 1.1 + +calculate: + description: a calculated variable + default: value1 + +leadership: + description: a leadership + type: leadership + + leader: + description: a leader + default: + variable: __.calculate + + follower: val11 # a follower diff --git a/tests/errors/23_0disabled_calculation_variable_multi2/errno_23 b/tests/errors/23_0disabled_calculation_variable_multi2/errno_23 new file mode 100644 index 000000000..e69de29bb diff --git a/tests/errors/23_0disabled_calculation_variable_multi2/rougail/00-base.yml b/tests/errors/23_0disabled_calculation_variable_multi2/rougail/00-base.yml new file mode 100644 index 000000000..8f1543579 --- /dev/null +++ b/tests/errors/23_0disabled_calculation_variable_multi2/rougail/00-base.yml @@ -0,0 +1,10 @@ +--- +version: '1.1' +condition: + description: a condition + multi: true +variable: + description: a variable + multi: true + disabled: + variable: _.condition diff --git a/tests/errors/23_0disabled_calculation_variable_multi3/errno_23 b/tests/errors/23_0disabled_calculation_variable_multi3/errno_23 new file mode 100644 index 000000000..e69de29bb diff --git a/tests/errors/23_0disabled_calculation_variable_multi3/rougail/00-base.yml b/tests/errors/23_0disabled_calculation_variable_multi3/rougail/00-base.yml new file mode 100644 index 000000000..4b88f3370 --- /dev/null +++ b/tests/errors/23_0disabled_calculation_variable_multi3/rougail/00-base.yml @@ -0,0 +1,13 @@ +--- +version: '1.1' +condition: + description: a condition + multi: true + default: + - val1 + - val2 +variable: + description: a variable + multi: true + disabled: + variable: _.condition diff --git a/tests/errors/24_0family_dynamic_calc_identifier_multi/errno_20 b/tests/errors/24_0family_dynamic_calc_identifier_multi/errno_20 new file mode 100644 index 000000000..e69de29bb diff --git a/tests/errors/24_0family_dynamic_calc_identifier_multi/rougail/00-base.yml b/tests/errors/24_0family_dynamic_calc_identifier_multi/rougail/00-base.yml new file mode 100644 index 000000000..65b44a1d8 --- /dev/null +++ b/tests/errors/24_0family_dynamic_calc_identifier_multi/rougail/00-base.yml @@ -0,0 +1,21 @@ +--- +version: 1.1 + +var1: + description: A suffix variable + default: + - val1 + - val2 + +dyn{{ identifier }}: + dynamic: + variable: _.var1 + + var: + description: A dynamic variable + +var2: + description: A variable calculated + multi: true + default: + variable: rougail.dynval1.var diff --git a/tests/errors/24_0family_dynamic_calc_identifier_multi_2/errno_21 b/tests/errors/24_0family_dynamic_calc_identifier_multi_2/errno_21 new file mode 100644 index 000000000..e69de29bb diff --git a/tests/errors/24_0family_dynamic_calc_identifier_multi_2/rougail/00-base.yml b/tests/errors/24_0family_dynamic_calc_identifier_multi_2/rougail/00-base.yml new file mode 100644 index 000000000..d91477204 --- /dev/null +++ b/tests/errors/24_0family_dynamic_calc_identifier_multi_2/rougail/00-base.yml @@ -0,0 +1,22 @@ +--- +version: 1.1 + +var1: + description: A suffix variable + default: + - val1 + - val2 + +dyn{{ identifier }}: + dynamic: + variable: _.var1 + + var: + description: A dynamic variable + multi: true + +var2: + description: A variable calculated + multi: false + default: + variable: rougail.dynval1.var diff --git a/tests/errors/24_1family_dynamic_calc/errno_21 b/tests/errors/24_1family_dynamic_calc/errno_21 new file mode 100644 index 000000000..e69de29bb diff --git a/tests/errors/24_1family_dynamic_calc/rougail/00-base.yml b/tests/errors/24_1family_dynamic_calc/rougail/00-base.yml new file mode 100644 index 000000000..ad726fd8c --- /dev/null +++ b/tests/errors/24_1family_dynamic_calc/rougail/00-base.yml @@ -0,0 +1,25 @@ +--- +version: 1.1 + +var1: + description: A suffix variable + default: + - val1 + - val2 + +dyn{{ identifier }}: + dynamic: + variable: _.var1 + + dyn{{ identifier }}: + dynamic: + variable: __.var1 + + var: + description: A dynamic variable + +var2: + description: A variable calculated + multi: false + default: + variable: rougail.dyn{{ identifier }}.dynval1.var diff --git a/tests/errors/24_1family_dynamic_calc_submulti/errno_69 b/tests/errors/24_1family_dynamic_calc_submulti/errno_69 new file mode 100644 index 000000000..e69de29bb diff --git a/tests/errors/24_1family_dynamic_calc_submulti/rougail/00-base.yml b/tests/errors/24_1family_dynamic_calc_submulti/rougail/00-base.yml new file mode 100644 index 000000000..563788ced --- /dev/null +++ b/tests/errors/24_1family_dynamic_calc_submulti/rougail/00-base.yml @@ -0,0 +1,24 @@ +--- +version: 1.1 + +var1: + description: A suffix variable + default: + - val1 + - val2 + +dyn{{ identifier }}: + dynamic: + variable: _.var1 + + dyn{{ identifier }}: + dynamic: + variable: __.var1 + + var: + description: A dynamic variable + +var2: + description: A variable calculated + default: + variable: rougail.dyn{{ identifier }}.dyn{{ identifier }}.var diff --git a/tests/test_1_flattener.py b/tests/test_1_flattener.py index 8ae3968d1..494ebfc88 100644 --- a/tests/test_1_flattener.py +++ b/tests/test_1_flattener.py @@ -47,9 +47,9 @@ excludes = set([ ]) test_ok -= excludes test_raise -= excludes -# test_ok = ['00_8calculation_param_namespace'] +# test_ok = ['40_9leadership-calculation-outside-follower-no-mandatory'] #test_ok = [] -#test_raise = ['88valid_enum_invalid_default'] +# test_raise = ['22_0calculation_variable_leader_follower_multi'] #test_raise = [] test_multi = True #test_multi = False diff --git a/tests/test_2_makedict.py b/tests/test_2_makedict.py index 3a13dd9b6..64c2c4592 100644 --- a/tests/test_2_makedict.py +++ b/tests/test_2_makedict.py @@ -31,7 +31,7 @@ excludes = set([]) # excludes = set(['60_5family_dynamic_variable_outside_sub_suffix']) test_ok -= excludes -# test_ok = ['60_0family_dynamic_static'] +# test_ok = ['40_9calculation_variable_leader_follower_multi_inside'] test_ok = list(test_ok)