feat: variable with an index is an integer variable

This commit is contained in:
egarette@silique.fr 2025-09-28 16:32:46 +02:00
parent af6d11f457
commit 68c4baa634
3 changed files with 4 additions and 4 deletions

View file

@ -238,8 +238,7 @@ class RougailOutputFormatter:
continue continue
if attr in children: if attr in children:
attr = f"_{attr}" attr = f"_{attr}"
value = self.object_to_yaml(attr, type_, value, False, path) family[attr] = self.object_to_yaml(attr, type_, value, False, path)
family[attr] = value
if type_ == "dynamic" or (children and type_ == "family"): if type_ == "dynamic" or (children and type_ == "family"):
if "_type" in family: if "_type" in family:
del family["_type"] del family["_type"]
@ -333,6 +332,8 @@ class RougailOutputFormatter:
del variable["type"] del variable["type"]
if is_multi and obj.multi: if is_multi and obj.multi:
del variable["multi"] del variable["multi"]
if "type" in variable and isinstance(obj.default, IndexCalculation) and variable["type"] == "integer":
del variable["type"]
if "type" in variable and variable["type"] in [ if "type" in variable and variable["type"] in [
"string", "string",
"boolean", "boolean",

View file

@ -13,7 +13,6 @@ leader:
follower1: follower1:
description: a follower description: a follower
type: integer
default: default:
type: index type: index
... ...

View file

@ -15,7 +15,7 @@ excludes = [
] ]
test_ok = get_structures_list(excludes) test_ok = get_structures_list(excludes)
# test_ok = [Path('../rougail-tests/structures/00_2default_calculated_variable')] # test_ok = [Path('../rougail-tests/structures/40_2leadership_calculation_index')]
def idfn(fixture_value): def idfn(fixture_value):