From fecf0d1039e14820e604390809fc200a6c3e5b65 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Tue, 16 Jun 2026 21:19:47 +0200 Subject: [PATCH] fix: python 3.13 support --- src/rougail/convert/collect.py | 2 +- tests/test_types.py | 8 ++++++++ .../result/family_param/namespace_tiramisu.py | 14 ++++++++++++++ .../result/family_param/namespace_variables.json | 3 +++ .../family_param/namespace_variables_rw.json | 3 +++ tests/types/result/family_param/tiramisu.py | 15 +++++++++++++++ tests/types/result/family_param/variables.json | 3 +++ tests/types/result/family_param/variables_rw.json | 3 +++ .../structures/family_param/00_structure.yml | 9 +++++++++ tests/types/types/family_param/00_type.yml | 9 +++++++++ 10 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 tests/types/result/family_param/namespace_tiramisu.py create mode 100644 tests/types/result/family_param/namespace_variables.json create mode 100644 tests/types/result/family_param/namespace_variables_rw.json create mode 100644 tests/types/result/family_param/tiramisu.py create mode 100644 tests/types/result/family_param/variables.json create mode 100644 tests/types/result/family_param/variables_rw.json create mode 100644 tests/types/structures/family_param/00_structure.yml create mode 100644 tests/types/types/family_param/00_type.yml diff --git a/src/rougail/convert/collect.py b/src/rougail/convert/collect.py index 2e135090f..dc680e674 100644 --- a/src/rougail/convert/collect.py +++ b/src/rougail/convert/collect.py @@ -434,7 +434,7 @@ class Collect(CollectType, CollectFamily, CollectVariable): subpath: Optional[str], parameters: dict, comment: Optional[str], - parent_option: Optional[Collect], + parent_option: Optional["Collect"], *, raises: bool=True, test_exists: bool=True, diff --git a/tests/test_types.py b/tests/test_types.py index a93cfb554..3d46658f6 100644 --- a/tests/test_types.py +++ b/tests/test_types.py @@ -181,3 +181,11 @@ def test_type_family_redefine_type(): def test_type_family_redefine_type_namespace(): type_variable("family_redefine_type", namespace=True) + + +def test_type_family_param(): + type_variable("family_param") + + +def test_type_family_param_namespace(): + type_variable("family_param", namespace=True) diff --git a/tests/types/result/family_param/namespace_tiramisu.py b/tests/types/result/family_param/namespace_tiramisu.py new file mode 100644 index 000000000..0f9f4acd3 --- /dev/null +++ b/tests/types/result/family_param/namespace_tiramisu.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 +try: + groups.namespace +except: + groups.addgroup('namespace') +ALLOWED_LEADER_PROPERTIES.add("basic") +ALLOWED_LEADER_PROPERTIES.add("standard") +ALLOWED_LEADER_PROPERTIES.add("advanced") +option_2 = BoolOption(name="my_variable", doc="my variable", default=False, properties=frozenset({"mandatory", "standard"}), informations={'ymlfiles': ['tests/types/types/family_param/00_type.yml', 'tests/types/structures/family_param/00_structure.yml'], 'type': 'boolean'}) +optiondescription_1 = OptionDescription(name="my_family", doc="My family type", children=[option_2], properties=frozenset({"standard"}), informations={'ymlfiles': ['tests/types/types/family_param/00_type.yml', 'tests/types/structures/family_param/00_structure.yml']}) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1]) diff --git a/tests/types/result/family_param/namespace_variables.json b/tests/types/result/family_param/namespace_variables.json new file mode 100644 index 000000000..5d566d9ca --- /dev/null +++ b/tests/types/result/family_param/namespace_variables.json @@ -0,0 +1,3 @@ +{ + "my_family.my_variable": false +} \ No newline at end of file diff --git a/tests/types/result/family_param/namespace_variables_rw.json b/tests/types/result/family_param/namespace_variables_rw.json new file mode 100644 index 000000000..5d566d9ca --- /dev/null +++ b/tests/types/result/family_param/namespace_variables_rw.json @@ -0,0 +1,3 @@ +{ + "my_family.my_variable": false +} \ No newline at end of file diff --git a/tests/types/result/family_param/tiramisu.py b/tests/types/result/family_param/tiramisu.py new file mode 100644 index 000000000..01fc60358 --- /dev/null +++ b/tests/types/result/family_param/tiramisu.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 +try: + groups.namespace +except: + groups.addgroup('namespace') +ALLOWED_LEADER_PROPERTIES.add("basic") +ALLOWED_LEADER_PROPERTIES.add("standard") +ALLOWED_LEADER_PROPERTIES.add("advanced") +option_4 = BoolOption(name="my_variable", doc="my variable", default=False, properties=frozenset({"mandatory", "standard"}), informations={'ymlfiles': ['tests/types/types/family_param/00_type.yml', 'tests/types/structures/family_param/00_structure.yml'], 'type': 'boolean'}) +optiondescription_3 = OptionDescription(name="my_family", doc="My family type", children=[option_4], properties=frozenset({"standard"}), informations={'ymlfiles': ['tests/types/types/family_param/00_type.yml', 'tests/types/structures/family_param/00_structure.yml']}) +optiondescription_2 = OptionDescription(name="ns2", doc="NS2", group_type=groups.namespace, children=[optiondescription_3], properties=frozenset({"standard"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_2]) diff --git a/tests/types/result/family_param/variables.json b/tests/types/result/family_param/variables.json new file mode 100644 index 000000000..f0edbbbe1 --- /dev/null +++ b/tests/types/result/family_param/variables.json @@ -0,0 +1,3 @@ +{ + "ns2.my_family.my_variable": false +} \ No newline at end of file diff --git a/tests/types/result/family_param/variables_rw.json b/tests/types/result/family_param/variables_rw.json new file mode 100644 index 000000000..f0edbbbe1 --- /dev/null +++ b/tests/types/result/family_param/variables_rw.json @@ -0,0 +1,3 @@ +{ + "ns2.my_family.my_variable": false +} \ No newline at end of file diff --git a/tests/types/structures/family_param/00_structure.yml b/tests/types/structures/family_param/00_structure.yml new file mode 100644 index 000000000..7495ba854 --- /dev/null +++ b/tests/types/structures/family_param/00_structure.yml @@ -0,0 +1,9 @@ +%YAML 1.2 +--- +version: 1.1 + +my_family: + type: my_family_type + + my_variable: false +... diff --git a/tests/types/types/family_param/00_type.yml b/tests/types/types/family_param/00_type.yml new file mode 100644 index 000000000..0b7357541 --- /dev/null +++ b/tests/types/types/family_param/00_type.yml @@ -0,0 +1,9 @@ +%YAML 1.2 +--- +version: 1.1 + +my_family_type: + description: My family type + + my_variable: true # my variable +...