diff --git a/README.md b/README.md new file mode 100644 index 00000000..076eb543 --- /dev/null +++ b/README.md @@ -0,0 +1,27 @@ +Rougail + +Created by: +EOLE (http://eole.orion.education.fr) +Copyright (C) 2005-2018 + +Forked by: +Cadoles (http://www.cadoles.com) +Copyright (C) 2019-2021 + +distribued with GPL-2 or later license + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +[Documentation (french)](doc/README.md) diff --git a/doc/README.md b/doc/README.md new file mode 100644 index 00000000..0faf2312 --- /dev/null +++ b/doc/README.md @@ -0,0 +1,37 @@ +# Rougail + +Rougail est un bibliothèque python3 qui permet de charger des dictionnaires (fichiers au format XML), de charger les variables dans Tiramisu et de générer des templates. + +## La bibliothèque + + - [Utiliser la bibliothèque](dev/README.md) + - [Personnaliser la configration de la bibliothèque](dev/config.md) + +## Les dictionnaires + + - [Les dictionnaires](dictionary/rougail.md) + - [Les dictionnaires extra](dictionary/extra.md) + +### Les variables + + - [Les familles](family/README.md) + - [Les variables](variable/README.md) + +### Les services + + - [La gestion d'un fichier](service/file.md) + - [La gestion d'un fichier de service systemd](service/override.md) + - [La gestion d'une ip](service/ip.md) + +### Les contraintes + + - [Les calcules automatiques](fill/README.md) + - [Les vérifications des valeurs](check/README.md) + - [Les conditions](condition/README.md) + - [Les variables meneuses ou suiveuses](variable/leadership.md) + +## Les templates + + - Type creole + - Type jinja2 +FIXME ^^ diff --git a/doc/auto.rst b/doc/auto.rst deleted file mode 100644 index 322719f9..00000000 --- a/doc/auto.rst +++ /dev/null @@ -1,23 +0,0 @@ -Valeur automatiquement modifiée -=============================== - -Une variable avec valeur automatiquement modifiée est une variable dont la valeur sera considéré comme modifié quand le serveur sera déployé. - -Voici un variable a valeur automatiquement modifiée : - - - -Dans ce cas la valeur est fixée à la valeur actuelle. -Par exemple, si la valeur de cette variable est issue d'un calcul, la valeur ne sera plus recalculée. - -Valeur en lecture seule automatique -=================================== - -Une variable avec valeur en lecture seule automatique est une variable dont la valeur ne sera plus modifiable par l'utilisateur quand le serveur sera déployé. - -Voici un variable à valeur en lecture seule automatique : - - - -Dans ce cas la valeur est fixée à la valeur actuelle et elle ne sera plus modifiable par l'utilisateur. -Par exemple, si la valeur de cette variable est issue d'un calcul, la valeur ne sera plus recalculée. diff --git a/doc/check/README.md b/doc/check/README.md new file mode 100644 index 00000000..5127691d --- /dev/null +++ b/doc/check/README.md @@ -0,0 +1,5 @@ +# Les vérifications des valeurs + + - [Fonction de vérification](function.md) + - [Les variables à choix](valid_enum.md) + - [Réfinition](redefine.md) diff --git a/doc/check/function.md b/doc/check/function.md new file mode 100644 index 00000000..016164c2 --- /dev/null +++ b/doc/check/function.md @@ -0,0 +1,53 @@ +# Fonction de vérification + +## Vérification stricte des valeurs + +Une fonction de vérification est une fonction complémentaire au type qui permet de valider plus précisement le contenu d'une variable. + +Voici un exemple simple de validation des valeurs : + +``` + + + + + + my_variable + + +``` + +La [cible (de type variable)](../target/variable.md) de la fonction de vérification est ici "my_variable". + +Dans cette exemple, la valeur de la variable "my_variable" va être validé par la fonction islower. + +Voici le contenu de la fonction : + +``` +def islower(value): + if value is None: + return + if not value.islower(): + raise ValueError(f'"{value}" is not lowercase string') +``` + +Une fonction de vérification doit prendre en compte 2 aspects important : + +- la valeur peut ne pas être renseigné (même si la variable est obligatoire), la valeur None doit être prise en compte +- si la valeur est invalide, il faut faire un raise de type ValueError avec, si possible, un message explicite. + +À partir de maintenant seule None et des valeurs en minuscule seront autorisés. + +Il est possible de définir des [paramètres](../param/README.md) à cette fonction. + +## Vérification des valeurs avec avertissement + +Dans la contrainte, il est possible de spécifier le niveau d'erreur et le mettre en avertissement : + +``` + + my_variable + +``` + +Dans ce cas une valeur avec une majuscule sera accepté, mais un message d'avertissement apparaitra. diff --git a/doc/check/redefine.md b/doc/check/redefine.md new file mode 100644 index 00000000..bb8914ce --- /dev/null +++ b/doc/check/redefine.md @@ -0,0 +1,61 @@ +# Rédéfinition + +## Redéfinition des vérification + +Dans un premier dictionnaire déclarons notre variable et sa fonction de vérification : + +``` + + + + + + my_variable + + +``` + +Dans un second dictionnaire il est possible de redéfinir le calcul : + +``` + + + + + + my_variable + + +``` + +Dans ce cas, la fonction "islower" exécuté. Si cette fonction ne retourne pas d'erreur, la seconde fonction "isspace" sera exécuté. + +## Redéfinition avec suppression d'un calcul + +Il se peut que dans un dictionnaire on décide de vérifier la valeur d'une variable. + +Dans un second dictionnaire il est possible de supprimer cette vérification. + +Dans un premier dictionnaire déclarons notre variable et notre fonction de vérification : + +``` + + + + + + my_variable + + +``` + +Dans un second dictionnaire supprimer cette vérification : + +``` + + + + + +``` + diff --git a/doc/check/valid_enum.md b/doc/check/valid_enum.md new file mode 100644 index 00000000..64cf29c7 --- /dev/null +++ b/doc/check/valid_enum.md @@ -0,0 +1,46 @@ +# Les variables à choix + +Une variable à choix est d'abord une variable avec une [fonction check](function.md). + +## Les variables à choix simple + +Il est possible d'imposer une liste de valeur pour une variable particulière : + +``` + + yes + no + maybe + my_variable + +``` + +Dans ce cas, seule les valeurs proposés sont possible pour cette variable. + +Par défaut, cette variable est obligatoire. Cela signifie qu'il n'est pas possible de spécifier "None" à cette variable. + +## Les variables à choix avec valeur None + +Il y a deux possibilités pour avoir une valeur "None" dans les choix : + +- rendre la variable non obligatoire, cela va ajouter un choix "None" dans la liste : + +``` + +``` + +Ou en ajoutant le paramètre "None" : + +``` + + yes + no + + maybe + my_variable + +``` + +## La valeur par défaut + +Si aucune valeur n'est spécifié pour la variable, automatiquement le premier choix va est placé comme valeur par défaut. diff --git a/doc/condition/README.md b/doc/condition/README.md new file mode 100644 index 00000000..6808380f --- /dev/null +++ b/doc/condition/README.md @@ -0,0 +1,5 @@ +# Les conditions + + - [Déclaration d'une condition](condition.md) + - [Les différentes conditions](conditions.md) + - [Réfinition](redefine.md) diff --git a/doc/condition/condition.md b/doc/condition/condition.md new file mode 100644 index 00000000..37198d86 --- /dev/null +++ b/doc/condition/condition.md @@ -0,0 +1,76 @@ +# Les conditions + +## Un condition + +Les conditions permettent d'ajouter ou de supprimer des propriétés à une [variable](../variable/README.md), une [famille](../family/README.md), un [service](../service/service.md), un [fichier](../service/file.md) ou une [ip](../service/ip.md) suivant le contexte. + +Nous allons nous concentrer ici sur la condition hidden_if_in, mais [il existe d'autre conditions](conditions.md). + +La condition hidden_if_in permet de cacher une variable où une famille à l'utilisateur, mais cette variable est toujours accessible dans un calcul, un vérification ou dans un template. + +``` + + + + + + + + True + my_variable + + +``` + +Le [paramètres](../param/README.md) de la condition permet de définir les valeurs que doit avoir la source pour appliquer l'action. + +La [cible](../target/README.md) de la condition est ici "my_variable". + +Donc ici la variable est caché à l'utilisateur si la variable "condition" est à True (le paramètre). + +## Un condition avec plusieurs paramètres + +Il est également possible de mettre plusieurs paramètre : + +``` + + + + + + + + yes + maybe + my_variable + + +``` + +## Une condition optionnelle + +Il est possible de définir une condition avec une variable source qui n'existe pas dans toutes les contextes. + +Dans ce cas, on met la condition en "optionnelle". + +Si la variable source existe, la condition s'applique. + +Si la variable source n'existe pas : + +- si le nom fini en _if_in (par exemple hidden_if_in), l'action est forcée sans condition (les cibles sont hidden) +- si le nom fini en _if_not_in (par exemple hidden_if_not_in), la condition est totalement ignorée + +Ces deux comportements peuvent être changé à tout moment avec l'attribut "apply_on_fallback". Dans ce cas : + +- si la valeur de "apply_on_fallback" est "True", l'action est forcée sans condition +- si la valeur de "apply_on_fallback" est "False", la condition est totalement ignorée + +Exemple : + +``` + + yes + maybe + my_variable + +``` diff --git a/doc/condition/conditions.md b/doc/condition/conditions.md new file mode 100644 index 00000000..2dfc25f3 --- /dev/null +++ b/doc/condition/conditions.md @@ -0,0 +1,29 @@ +# Les conditions + +## Les conditions \_if_in et \_if_not_in + +Il existe deux types de conditions : + +- les conditions dont le nom fini par \_if_in : dans ce cas si la variable source est égal à un des paramètres, l'action est effective +- les conditions dont le nom fini par \_if_not_in : dans ce cas si la variable source est différents de tous les paramètres, l'action est effective + +## Désactivation + +Il est possible de désactiver une [variable](../variable/README.md) ou une [famille](../family/README.md) avec les conditions : + +- disabled_if_in +- disabled_if_not_in + +## Caché + +Il est possible de cacher une [variable](../variable/README.md), une [famille](../family/README.md), un [service](../service/service.md), un [fichier](../service/file.md) ou une [ip](../service/ip.md) avec les conditions : + +- hidden_if_in +- hidden_if_not_in + +## Obligatoire + +Il est possible de rendre obligatoire une [variable](../variable/README.md) avec les conditions : + +- mandatory_if_in +- mandatory_if_not_in diff --git a/doc/condition/redefine.md b/doc/condition/redefine.md new file mode 100644 index 00000000..b076205c --- /dev/null +++ b/doc/condition/redefine.md @@ -0,0 +1,29 @@ +# Rédéfinition + +Il se peut que dans un dictionnaire on décide de définir une condition. + +Dans un second dictionnaire il est possible de supprimer cette condition. + +Dans un premier dictionnaire déclarons notre variable et notre calcule : + +``` + + + + + + + + True + my_variable + + +``` + +Dans un second dictionnaire supprimer ce calcul : + +``` + + + +``` diff --git a/doc/dev/README.md b/doc/dev/README.md new file mode 100644 index 00000000..cfd79ba3 --- /dev/null +++ b/doc/dev/README.md @@ -0,0 +1,191 @@ +# La bibliothèque rougail + +Rougail est une bibliothèque simple a utiliser. + +Dans les exemples suivant, nous utilisons la configuration par défaut de Rougail. Vous pouvez [personnaliser les répertoires utilisés](config.md). + +## Convertisons un dictionnaire en objet tiramisu + +Commençons par créer un dictionnaire simple. + +Voici un premier dictionnaire /srv/rougail/dictionaries/00-base.xml : + +``` + + + + + my_value + + + +``` + +Construisons les objets tiramisu : + +```python +from rougail import RougailConvert + +rougail = RougailConvert() +rougail.save('example.py') +``` + +Un nouveau fichier 'example.py' va être créé dans le répertoire local + +## Convertisons un dictionnaire extra en objet tiramisu + +En plus du dictionnaire précédent, créons un dictionnaire extra /srv/rougail/extra_dictionaries/00-base.xml + +``` + + + + + my_value_extra + + + +``` + +Construisons les objets tiramisu : + +```python +from rougail import RougailConvert, RougailConfig + +RougailConfig['extra_dictionaries']['example'] = ['/srv/rougail/extra_dictionaries/'] + +rougail = RougailConvert() +rougail.save('example.py') +``` + +## Templatisons un template + +Nous créons un dictionnaire complémentaire pour ajouter notre template /srv/rougail/dictionaries/00-template.xml : + +``` + + + + + + + + +``` + +Et un template /srv/rougail/templates/example.conf : + +``` +The value: %%my_variable + +The extra value: %%example.my_variable_extra +``` + +Générons le fichier tiramisu : + +```python +from rougail import RougailConvert, RougailConfig + +RougailConfig['extra_dictionaries']['example'] = ['/srv/rougail/extra_dictionaries/'] + +rougail = RougailConvert() +rougail.save('example.py') +``` + +Créer les répertoires utils pour la templatisation : + +```bash +mkdir /srv/rougail/destinations /srv/rougail/tmp +``` + +Générons le template : + +```python +import asyncio +from example import option_0 +from tiramisu import Config +from rougail import RougailSystemdTemplate + +async def template(): + config = await Config(option_0) + engine = RougailSystemdTemplate(config) + await engine.instance_files() + +loop = asyncio.get_event_loop() +loop.run_until_complete(template()) +loop.close() +``` + +Le fichier /srv/rougail/destinations/etc/example.conf est maintenant créé avec le contenu attendu suivant : + +``` +The value: my_value + +The extra value: my_value_extra +``` + +## Appliquons un patch au template + +Il peut être intéressant de réaliser un patch à un template pour corriger un problème spécifique à notre environnement, sans attendre que le mainteneur du template n'est fait la correction. + +Testons en créant le patch /srv/rougail/patches/example.conf.patch : + +``` +--- /srv/rougail/templates/example.conf 2021-02-13 19:41:38.677491087 +0100 ++++ tmp/example.conf 2021-02-13 20:12:55.525089820 +0100 +@@ -1,3 +1,5 @@ + The value: %%my_variable + + The extra value: %%example.my_variable_extra ++ ++Add by a patch +``` + +Le patch est bien appliquer sur notre fichier /srv/rougail/destinations/etc/example.conf : + +``` +The value: my_value + +The extra value: my_value_extra + +Add by a patch +``` + +Deux choses importantes à savoir sur les patchs : + +- le nom du patch est obligatoire le nom du template source + ".patch" +- la deuxième ligne doit toujours commencer par "+++ tmp/" + le nom du template source + +## Créons une fonction personnalisé + +Nous créons un dictionnaire complémentaire pour ajouter un calcul à la variable "my_variable" dans /srv/rougail/dictionaries/00-fill.xml : + +``` + + + + + my_variable + + + +``` + +Puis créons la fonction "return_no" dans /srv/rougail/functions.py : + +```python +def return_no(): + return 'no' +``` + +Après avoir reconverti les dictionnaires et regénérer le template nous avons donc le contenu du fichier /srv/rougail/destinations/etc/example.conf : + +``` +The value: no + +The extra value: my_value_extra + +Add by a patch +``` + +La valeur de la variable "my_variable" est bien calculé à partir de la fonction "return_no". diff --git a/doc/dev/config.md b/doc/dev/config.md new file mode 100644 index 00000000..5e1210f8 --- /dev/null +++ b/doc/dev/config.md @@ -0,0 +1,94 @@ +# Personnalisons la configuration de Rougail + +La configuration de rougail se trouve dans l'objet RougailConfig : + +```python +from rougail import RougailConfig +``` + +C'est un simple dictionnaire python avec différentes clefs. + +Pour modifier il suffit de faire : + +```python +RougailConfig[key] = value +``` + +## Les répertoires des dictionnaires + +Il existe deux types de répertoires de dictionnaires : + +- les dictionnaires principaux avec la clef "dictionaries_dir". La valeur par défaut est ['/srv/rougail/dictionaries']. Cette variable doit contenir la liste des répertoires contenants des dictionnaires. + +Les dictionnaires sont chargés dans l'ordre des répertoires. Chaque répertoire est chargé les uns après les autres. A l'intérieur de ces répertoires les fichiers XML seront classés par ordre alphabétique. + +Il n'y a pas de classement par ordre alphabétique de l'ensemble des fichiers XML de tous les répertoires. + +Les familles et variables de ces dictionnaires sont classés, par défaut, dans l'espace de nom "rougail". Il est possible de changer le nom de cet espace de nom avec la clef "variable_namespace". + +- les dictionnaires extra avec la clef "extra_dictionaries". La valeur est un dictionnaire avec l'ensemble des espaces de nom. La clef étant l'espace de nom et la valeur étant une liste de répertoire. + +Par exemple pour ajouter l'extra "example" il faut faire : + +``` +RougailConfig['extra_dictionaries']['example'] = ['/dir1', '/dir2'] +``` + +Les dictionnaires sont chargés dans le même ordre que les dictionnaires principaux. + +## La DTD + +Rougail a besoin du fichier de DTD pour lire les fichiers dictionnaire. + +Par défaut le fichier de la DTD est dans le sous répertoire "data" du répertoire de code. Le nom du fichier est rougail.dtd. + +Pour pouvez changer le répertoire de destination de la DTD et le nom du fichier avec la clef "dtdfilename". + +## Le fichier de fonction + +Le fichier qui contient les fonctions personnalisés est géré dans la clef "functions_file" et a comme valeur par défaut "/srv/rougail/functions.py". + +## Le répertoire des templates + +Le répertoire des templates est géré dans la clef "templates_dir" et a comme valeur par défaut : "/srv/rougail/templates". + +## Le moteur de templates par défaut + +Le moteur de template est géré dans la clef "default_engine" et a comme valeur par défaut : "creole". Les valeurs possible sont "none", "creole" ou "jinja2". + +## Le répertoire des patchs + +Le répertoire des patches est géré dans la clef "patches_dir" et a comme valeur par défaut : "/srv/rougail/patches". + +## Le répertoire temporaire + +Le répertoire temporaire est utile lors de la génération de template. Il contient une copie des templates avec, éventuellement, les patches appliqués sur les templates. + +Le répertoire de temporaire est géré dans la clef "tmp_dir" et a comme valeur par défaut : "/srv/rougail/tmp". + +## Le répertoire de destination des fichiers générés + +Le répertoire de destination des fichiers générés est géré dans la clef "destinations_dir" et a comme valeur par défaut : "/srv/rougail/destinations". + +## La variable auto_freeze + +La propriété auto_freeze n'est appliqué que une variable spécifique passe à True. Par défaut le nom de la variable est "instancied_module", mais il est possible de changer le nom de cette variable via la clef "auto_freeze_variable". + +## Les modes + +Les modes sont personnalisables dans Rougail. Par défaut les modes sont "basic", "normal" et "expert". +Il est possible de changer cette liste via la clef "modes_level". + +Si vous changer ces valeurs, penser à changer les modes par défaut des familles et des variables. + +## Le mode par défaut pour une famille + +Le mode par défaut d'une famille est "basic". Il est possible de changer le mode par défaut d'une famille via la clef "default_family_mode". + +## Le mode par défaut pour une variable + +Le mode par défaut d'une variable est "normal". Il est possible de changer le mode par défaut d'une variable via la clef "default_variable_mode". + +## Le nom des fonctions internes + +Il est possible d'ajouter des fonctions interne via la clef "internal_functions". diff --git a/doc/dictionary/extra.md b/doc/dictionary/extra.md new file mode 100644 index 00000000..4fea90c9 --- /dev/null +++ b/doc/dictionary/extra.md @@ -0,0 +1,12 @@ +# Les dictionnaires extra + +Un extra est un espace de nom différent. L'idée et de pouvoir classer les variables par thématique. + +Les espaces de nom extra doivent être déclaré au moment [de la configuration de Rougail](../dev/config.md). + +Dans cet espace de nom : + +- des variables et des familles peuvent avoir le même nom dans différentes familles +- la valeur d'un cible, source, leader ou follower des contraintes doivent être avec un chemin complet +- on ne peut pas déclarer des services dans cet espace de nom +- dans un template il faut utiliser des chemins complet (%%my_extra.my_family.my_variable ou %%my_extra.my_family.leader.follower pour une variable suiveuse) diff --git a/doc/dictionary/rougail.md b/doc/dictionary/rougail.md new file mode 100644 index 00000000..1fa0c4f4 --- /dev/null +++ b/doc/dictionary/rougail.md @@ -0,0 +1,22 @@ +# Les dictionnaires + +## Un dictionnaire ? + +Un dictionnaire est un fichier XML donc la structure est décrite dans cette documentation. + +Un dictionnaire contient en ensemble de variable chargé dans Tiramisu, utilisable à tout moment, notamment dans des templates. + +Les familles, les variables et les contraintes peuvent être défini dans plusieurs dictionnaires. Ces dictionnaires s'aggrège alors. + +Il est également possible de redéfinir des éléments pour changer les comportement d'une variable ou d'un service. + +## L'espace de nom par défaut + +L'espace de nom par défaut s'appelle "rougail" ([ce nom est personnalisable](../dev/config.md)). + +Cet espace de nom est un peu particulier : + +- le nom des variables et des familles doivent être unique pour l'ensemble de cet espace (même si ces variables ou familles sont dans des familles différentes) +- la valeur d'un cible, source, leader ou follower des contraintes peuvent être avec nom de la variable ou de la famille ou leurs chemins complet +- on peut déclarer des services dans cet espace de nom +- dans un template on peut utiliser cette variable sans le chemin complet (%%my_variable) ou avec (%%rougail.my_family.my_variable) diff --git a/doc/family/README.md b/doc/family/README.md new file mode 100644 index 00000000..1aff0572 --- /dev/null +++ b/doc/family/README.md @@ -0,0 +1,5 @@ +# Famille + + - [Une famille](simple.md) + - [Famille crée dynamiquement](auto.md) + diff --git a/doc/family/auto.md b/doc/family/auto.md new file mode 100644 index 00000000..1209dd30 --- /dev/null +++ b/doc/family/auto.md @@ -0,0 +1,27 @@ +# Famille crée dynamiquement + +Pour créer une famille dynamiquement, il faut créer une famille fictive lié à une variable. +Le nom et la description de la famille et des variables qu'elle contient sera en réalité le prefix du nouveau nom/description. Le suffix viendra de la variable liée. + +Par exemple : + +``` + + val1 + val2 + + + + +``` + +Créera deux familles : + +- la famille dynamique : "my_dyn_family_val1" avec la description "Describe val1" +- la famille dynamique : "my_dyn_family_val2" avec la description "Describe val2" + +Dans la famille dynamique "my_dyn_family_val1" on retrouvera une variable "my_dyn_var_val1". + +Bien évidement si le contenu de "varname" venait a évolué, de nouvelles familles dynamiques pouvent apparaitre ou des familles dynamiques peuvent disparaître. + +Attention la variable lié à la famille doit être obligatoirement une variable multiple et il n'est pas possible de mettre une famille dans une famille dynamique. diff --git a/doc/family/simple.md b/doc/family/simple.md new file mode 100644 index 00000000..ac3e9cdc --- /dev/null +++ b/doc/family/simple.md @@ -0,0 +1,68 @@ +# Une famille + +Une famille est un conteneur de variables. Elle peut contenir également des familles. + +Pour décrire une famille il faut mettre au minimum un nom : + +``` + +``` + +Cette famille doit être placé dans une balise [variables](../variables.md) : + +``` + + + +``` + +Ou dans une autre famille : + +``` + + + + + +``` + +Attention, une famille vide sera automatiquement supprimée. + +## Description et aide de la famille + +En plus d'un nom, il est possible de mettre une "description" à la famille. C'est une information "utilisateur" qui nous permettra d'avoir des informations complémentaires sur le contenu de cette famille : + +``` + +``` + +En plus de la description, il est possible de préciser une aide complémentaire : + +``` + +``` + +## Mode de la famille + +Le [mode](../mode.md) par défaut d'une famille correspond au [mode](../mode.md) du mode le plus petit entre la famille parente, les variables enfants ou des familles enfants qui sont contenu dans cette famille. + +Changer le [mode](../mode.md) d'une famille permet de définir le [mode](../mode.md) par défaut des variables ou des familles inclusent dans cette famille. + +Pour définir le [mode](../mode.md) : + +``` + +``` + +## Famille invisible + +Il est possible de cacher une famille, ainsi que toutes les variables et des familles inclusent dans cette famille. + +Cacher une famille signifie qu'elle ne sera pas visible lorsqu'on modifie la configuration du service. +Par contre ces variables sont accessibles lorsqu'on va utiliser ces variables. + +Pour cacher une famille : + +``` + - + valfill + follower1 - + follower1 + follower2 follower1 diff --git a/tests/dictionaries/10load_leadership_description/makedict/after.json b/tests/dictionaries/10load_leadership_description/makedict/after.json new file mode 100644 index 00000000..f77abfc0 --- /dev/null +++ b/tests/dictionaries/10load_leadership_description/makedict/after.json @@ -0,0 +1,18 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general1.leader.leader": { + "owner": "default", + "value": [] + }, + "rougail.general1.leader.follower1": { + "owner": [], + "value": [] + }, + "rougail.general1.leader.follower2": { + "owner": [], + "value": [] + } +} diff --git a/tests/dictionaries/10load_leadership_description/makedict/base.json b/tests/dictionaries/10load_leadership_description/makedict/base.json index a84a00cf..14aaf55f 100644 --- a/tests/dictionaries/10load_leadership_description/makedict/base.json +++ b/tests/dictionaries/10load_leadership_description/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general1.leader.leader": [], "rougail.general1.leader.follower1": [], "rougail.general1.leader.follower2": []} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general1.leader.leader": [] +} diff --git a/tests/dictionaries/10load_leadership_description/makedict/before.json b/tests/dictionaries/10load_leadership_description/makedict/before.json new file mode 100644 index 00000000..f77abfc0 --- /dev/null +++ b/tests/dictionaries/10load_leadership_description/makedict/before.json @@ -0,0 +1,18 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general1.leader.leader": { + "owner": "default", + "value": [] + }, + "rougail.general1.leader.follower1": { + "owner": [], + "value": [] + }, + "rougail.general1.leader.follower2": { + "owner": [], + "value": [] + } +} diff --git a/tests/dictionaries/10load_leadership_description/tiramisu/base.py b/tests/dictionaries/10load_leadership_description/tiramisu/base.py index b46cb5be..89bb47ae 100644 --- a/tests/dictionaries/10load_leadership_description/tiramisu/base.py +++ b/tests/dictionaries/10load_leadership_description/tiramisu/base.py @@ -1,19 +1,22 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3]) -option_6 = StrOption(name='leader', doc='leader', multi=True) -option_7 = StrOption(properties=frozenset({'normal'}), name='follower1', doc='follower1', multi=True, default=Calculation(func.calc_val, Params((), kwargs={'valeur': ParamValue("valfill")}))) -option_8 = StrOption(properties=frozenset({'normal'}), name='follower2', doc='follower2', multi=True, default=Calculation(func.calc_val, Params((ParamOption(option_7, notraisepropertyerror=False, todict=False)), kwargs={}))) -option_5 = Leadership(name='leader', doc='other description', properties=frozenset({'normal'}), children=[option_6, option_7, option_8]) -option_4 = OptionDescription(name='general1', doc='general1', properties=frozenset({'normal'}), children=[option_5]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2, option_4]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) +option_6 = StrOption(name="leader", doc="leader", multi=True) +option_7 = StrOption(name="follower1", doc="follower1", multi=True, default=Calculation(func.calc_val, Params((), kwargs={'valeur': ParamValue("valfill")})), properties=frozenset({"normal"})) +option_8 = StrOption(name="follower2", doc="follower2", multi=True, default=Calculation(func.calc_val, Params((ParamOption(option_7)))), properties=frozenset({"normal"})) +option_5 = Leadership(name="leader", doc="other description", children=[option_6, option_7, option_8], properties=frozenset({"normal"})) +option_4 = OptionDescription(name="general1", doc="general1", children=[option_5], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10load_leadership_name/00-base.xml b/tests/dictionaries/10load_leadership_name/00-base.xml index b0dfda28..9d75b178 100644 --- a/tests/dictionaries/10load_leadership_name/00-base.xml +++ b/tests/dictionaries/10load_leadership_name/00-base.xml @@ -1,8 +1,8 @@ - + - + non @@ -13,11 +13,13 @@ - + valfill + follower1 - + follower1 + follower2 follower1 diff --git a/tests/dictionaries/10load_leadership_name/makedict/after.json b/tests/dictionaries/10load_leadership_name/makedict/after.json new file mode 100644 index 00000000..c38c753a --- /dev/null +++ b/tests/dictionaries/10load_leadership_name/makedict/after.json @@ -0,0 +1,18 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general1.other_name.leader": { + "owner": "default", + "value": [] + }, + "rougail.general1.other_name.follower1": { + "owner": [], + "value": [] + }, + "rougail.general1.other_name.follower2": { + "owner": [], + "value": [] + } +} diff --git a/tests/dictionaries/10load_leadership_name/makedict/base.json b/tests/dictionaries/10load_leadership_name/makedict/base.json index e02048af..0f5932d1 100644 --- a/tests/dictionaries/10load_leadership_name/makedict/base.json +++ b/tests/dictionaries/10load_leadership_name/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general1.other_name.leader": [], "rougail.general1.other_name.follower1": [], "rougail.general1.other_name.follower2": []} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general1.other_name.leader": [] +} diff --git a/tests/dictionaries/10load_leadership_name/makedict/before.json b/tests/dictionaries/10load_leadership_name/makedict/before.json new file mode 100644 index 00000000..c38c753a --- /dev/null +++ b/tests/dictionaries/10load_leadership_name/makedict/before.json @@ -0,0 +1,18 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general1.other_name.leader": { + "owner": "default", + "value": [] + }, + "rougail.general1.other_name.follower1": { + "owner": [], + "value": [] + }, + "rougail.general1.other_name.follower2": { + "owner": [], + "value": [] + } +} diff --git a/tests/dictionaries/10load_leadership_name/tiramisu/base.py b/tests/dictionaries/10load_leadership_name/tiramisu/base.py index 6a5fb478..91b5dd2c 100644 --- a/tests/dictionaries/10load_leadership_name/tiramisu/base.py +++ b/tests/dictionaries/10load_leadership_name/tiramisu/base.py @@ -1,19 +1,22 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3]) -option_6 = StrOption(name='leader', doc='leader', multi=True) -option_7 = StrOption(properties=frozenset({'normal'}), name='follower1', doc='follower1', multi=True, default=Calculation(func.calc_val, Params((), kwargs={'valeur': ParamValue("valfill")}))) -option_8 = StrOption(properties=frozenset({'normal'}), name='follower2', doc='follower2', multi=True, default=Calculation(func.calc_val, Params((ParamOption(option_7, notraisepropertyerror=False, todict=False)), kwargs={}))) -option_5 = Leadership(name='other_name', doc='leader', properties=frozenset({'normal'}), children=[option_6, option_7, option_8]) -option_4 = OptionDescription(name='general1', doc='general1', properties=frozenset({'normal'}), children=[option_5]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2, option_4]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) +option_6 = StrOption(name="leader", doc="leader", multi=True) +option_7 = StrOption(name="follower1", doc="follower1", multi=True, default=Calculation(func.calc_val, Params((), kwargs={'valeur': ParamValue("valfill")})), properties=frozenset({"normal"})) +option_8 = StrOption(name="follower2", doc="follower2", multi=True, default=Calculation(func.calc_val, Params((ParamOption(option_7)))), properties=frozenset({"normal"})) +option_5 = Leadership(name="other_name", doc="other_name", children=[option_6, option_7, option_8], properties=frozenset({"normal"})) +option_4 = OptionDescription(name="general1", doc="general1", children=[option_5], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10load_leadership_normalize_family/00-base.xml b/tests/dictionaries/10load_leadership_normalize_family/00-base.xml deleted file mode 100644 index c68db10e..00000000 --- a/tests/dictionaries/10load_leadership_normalize_family/00-base.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - non - - - - - - - - - - - - follower1 - follower2 - - - - - - diff --git a/tests/dictionaries/10load_leadership_normalize_family/01-base.xml b/tests/dictionaries/10load_leadership_normalize_family/01-base.xml deleted file mode 100644 index d0926cce..00000000 --- a/tests/dictionaries/10load_leadership_normalize_family/01-base.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/tests/dictionaries/10load_leadership_normalize_family/makedict/base.json b/tests/dictionaries/10load_leadership_normalize_family/makedict/base.json deleted file mode 100644 index c2596da8..00000000 --- a/tests/dictionaries/10load_leadership_normalize_family/makedict/base.json +++ /dev/null @@ -1 +0,0 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general_1.leader.leader": [], "rougail.general_1.leader.follower1": [], "rougail.general_1.leader.follower2": []} diff --git a/tests/dictionaries/10load_leadership_normalize_family/tiramisu/base.py b/tests/dictionaries/10load_leadership_normalize_family/tiramisu/base.py deleted file mode 100644 index 6202f6f3..00000000 --- a/tests/dictionaries/10load_leadership_normalize_family/tiramisu/base.py +++ /dev/null @@ -1,19 +0,0 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') -for key, value in dict(locals()).items(): - if key != ['imp', 'func']: - setattr(func, key, value) -try: - from tiramisu3 import * -except: - from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3]) -option_6 = StrOption(properties=frozenset({'mandatory'}), name='leader', doc='leader', multi=True) -option_7 = StrOption(properties=frozenset({'normal'}), name='follower1', doc='follower1', multi=True) -option_8 = StrOption(properties=frozenset({'normal'}), name='follower2', doc='follower2', multi=True) -option_5 = Leadership(name='leader', doc='leader', properties=frozenset({'basic'}), children=[option_6, option_7, option_8]) -option_4 = OptionDescription(name='general_1', doc='general-1', properties=frozenset({'basic'}), children=[option_5]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2, option_4]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) diff --git a/tests/dictionaries/10load_leadership_submulti/00-base.xml b/tests/dictionaries/10load_leadership_submulti/00-base.xml index 48377ba3..35dca241 100644 --- a/tests/dictionaries/10load_leadership_submulti/00-base.xml +++ b/tests/dictionaries/10load_leadership_submulti/00-base.xml @@ -1,11 +1,8 @@ - - - - + - + non @@ -17,18 +14,17 @@ - + valfill + follower1 - + follower1 + follower2 follower1 follower2 - - - diff --git a/tests/dictionaries/10load_leadership_submulti/makedict/after.json b/tests/dictionaries/10load_leadership_submulti/makedict/after.json new file mode 100644 index 00000000..f77abfc0 --- /dev/null +++ b/tests/dictionaries/10load_leadership_submulti/makedict/after.json @@ -0,0 +1,18 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general1.leader.leader": { + "owner": "default", + "value": [] + }, + "rougail.general1.leader.follower1": { + "owner": [], + "value": [] + }, + "rougail.general1.leader.follower2": { + "owner": [], + "value": [] + } +} diff --git a/tests/dictionaries/10load_leadership_submulti/makedict/base.json b/tests/dictionaries/10load_leadership_submulti/makedict/base.json index a84a00cf..14aaf55f 100644 --- a/tests/dictionaries/10load_leadership_submulti/makedict/base.json +++ b/tests/dictionaries/10load_leadership_submulti/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general1.leader.leader": [], "rougail.general1.leader.follower1": [], "rougail.general1.leader.follower2": []} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general1.leader.leader": [] +} diff --git a/tests/dictionaries/10load_leadership_submulti/makedict/before.json b/tests/dictionaries/10load_leadership_submulti/makedict/before.json new file mode 100644 index 00000000..f77abfc0 --- /dev/null +++ b/tests/dictionaries/10load_leadership_submulti/makedict/before.json @@ -0,0 +1,18 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general1.leader.leader": { + "owner": "default", + "value": [] + }, + "rougail.general1.leader.follower1": { + "owner": [], + "value": [] + }, + "rougail.general1.leader.follower2": { + "owner": [], + "value": [] + } +} diff --git a/tests/dictionaries/10load_leadership_submulti/tiramisu/base.py b/tests/dictionaries/10load_leadership_submulti/tiramisu/base.py index b5b069b4..c2eb1b41 100644 --- a/tests/dictionaries/10load_leadership_submulti/tiramisu/base.py +++ b/tests/dictionaries/10load_leadership_submulti/tiramisu/base.py @@ -1,19 +1,22 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3]) -option_6 = StrOption(name='leader', doc='leader', multi=True) -option_7 = StrOption(properties=frozenset({'normal'}), name='follower1', doc='follower1', multi=True, default=Calculation(func.calc_val, Params((), kwargs={'valeur': ParamValue("valfill")}))) -option_8 = StrOption(properties=frozenset({'normal'}), name='follower2', doc='follower2', multi=submulti, default=Calculation(func.calc_val, Params((ParamOption(option_7, notraisepropertyerror=False, todict=False)), kwargs={})), default_multi=[]) -option_5 = Leadership(name='leader', doc='leader', properties=frozenset({'normal'}), children=[option_6, option_7, option_8]) -option_4 = OptionDescription(name='general1', doc='general1', properties=frozenset({'normal'}), children=[option_5]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2, option_4]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) +option_6 = StrOption(name="leader", doc="leader", multi=True) +option_7 = StrOption(name="follower1", doc="follower1", multi=True, default=Calculation(func.calc_val, Params((), kwargs={'valeur': ParamValue("valfill")})), properties=frozenset({"normal"})) +option_8 = StrOption(name="follower2", doc="follower2", multi=submulti, default=[Calculation(func.calc_val, Params((ParamOption(option_7))))], properties=frozenset({"normal"})) +option_5 = Leadership(name="leader", doc="leader", children=[option_6, option_7, option_8], properties=frozenset({"normal"})) +option_4 = OptionDescription(name="general1", doc="general1", children=[option_5], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10load_mandatoryifin/00-base.xml b/tests/dictionaries/10load_mandatoryifin/00-base.xml index 718a24f7..1ba37c14 100644 --- a/tests/dictionaries/10load_mandatoryifin/00-base.xml +++ b/tests/dictionaries/10load_mandatoryifin/00-base.xml @@ -1,11 +1,8 @@ - - - - + - + non @@ -15,7 +12,6 @@ non - @@ -25,9 +21,6 @@ mode_conteneur_actif2 - - - diff --git a/tests/dictionaries/10load_mandatoryifin/makedict/after.json b/tests/dictionaries/10load_mandatoryifin/makedict/after.json new file mode 100644 index 00000000..f51f5230 --- /dev/null +++ b/tests/dictionaries/10load_mandatoryifin/makedict/after.json @@ -0,0 +1,14 @@ +{ + "rougail.general.condition": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif2": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/10load_mandatoryifin/makedict/base.json b/tests/dictionaries/10load_mandatoryifin/makedict/base.json index 25db64a2..c6e0314e 100644 --- a/tests/dictionaries/10load_mandatoryifin/makedict/base.json +++ b/tests/dictionaries/10load_mandatoryifin/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non"} +{ + "rougail.general.condition": "non", + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif2": "non" +} diff --git a/tests/dictionaries/10load_mandatoryifin/makedict/before.json b/tests/dictionaries/10load_mandatoryifin/makedict/before.json new file mode 100644 index 00000000..f51f5230 --- /dev/null +++ b/tests/dictionaries/10load_mandatoryifin/makedict/before.json @@ -0,0 +1,14 @@ +{ + "rougail.general.condition": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif2": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/10load_mandatoryifin/tiramisu/base.py b/tests/dictionaries/10load_mandatoryifin/tiramisu/base.py index aaf23b1a..1e189936 100644 --- a/tests/dictionaries/10load_mandatoryifin/tiramisu/base.py +++ b/tests/dictionaries/10load_mandatoryifin/tiramisu/base.py @@ -1,16 +1,19 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='condition', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_4 = StrOption(properties=frozenset({'mandatory', 'normal', Calculation(calc_value, Params(ParamValue('mandatory'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))}), name='mode_conteneur_actif', doc='No change', multi=False, default='non') -option_5 = StrOption(properties=frozenset({'mandatory', 'normal', Calculation(calc_value, Params(ParamValue('mandatory'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))}), name='mode_conteneur_actif2', doc='No change', multi=False, default='non') -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('mandatory'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")}))})) +option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('mandatory'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")}))})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10load_mandatoryifnotin_noexist/00-base.xml b/tests/dictionaries/10load_mandatoryifnotin_noexist/00-base.xml new file mode 100644 index 00000000..36588ca9 --- /dev/null +++ b/tests/dictionaries/10load_mandatoryifnotin_noexist/00-base.xml @@ -0,0 +1,36 @@ + + + + + + + + tous + + + + + + + + + tous + authentifié + aucun + condition + + + oui + non + mode_conteneur_actif + mode_conteneur_actif2 + + + + + diff --git a/tests/dictionaries/10leadership_leadermandatory/tiramisu/__init__.py b/tests/dictionaries/10load_mandatoryifnotin_noexist/__init__.py similarity index 100% rename from tests/dictionaries/10leadership_leadermandatory/tiramisu/__init__.py rename to tests/dictionaries/10load_mandatoryifnotin_noexist/__init__.py diff --git a/tests/dictionaries/10load_mandatoryifnotin_noexist/makedict/after.json b/tests/dictionaries/10load_mandatoryifnotin_noexist/makedict/after.json new file mode 100644 index 00000000..8647ce6a --- /dev/null +++ b/tests/dictionaries/10load_mandatoryifnotin_noexist/makedict/after.json @@ -0,0 +1,14 @@ +{ + "rougail.general.condition": { + "owner": "default", + "value": "tous" + }, + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif2": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/10load_mandatoryifnotin_noexist/makedict/base.json b/tests/dictionaries/10load_mandatoryifnotin_noexist/makedict/base.json new file mode 100644 index 00000000..13a9e66c --- /dev/null +++ b/tests/dictionaries/10load_mandatoryifnotin_noexist/makedict/base.json @@ -0,0 +1,5 @@ +{ + "rougail.general.condition": "tous", + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif2": "non" +} diff --git a/tests/dictionaries/10load_mandatoryifnotin_noexist/makedict/before.json b/tests/dictionaries/10load_mandatoryifnotin_noexist/makedict/before.json new file mode 100644 index 00000000..8647ce6a --- /dev/null +++ b/tests/dictionaries/10load_mandatoryifnotin_noexist/makedict/before.json @@ -0,0 +1,14 @@ +{ + "rougail.general.condition": { + "owner": "default", + "value": "tous" + }, + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif2": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/10load_mandatoryifnotin_noexist/tiramisu/base.py b/tests/dictionaries/10load_mandatoryifnotin_noexist/tiramisu/base.py new file mode 100644 index 00000000..969a0b76 --- /dev/null +++ b/tests/dictionaries/10load_mandatoryifnotin_noexist/tiramisu/base.py @@ -0,0 +1,19 @@ +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +option_3 = ChoiceOption(name="condition", doc="No change", values=('tous', 'authentifié', 'aucun'), default="tous", properties=frozenset({"mandatory", "normal"})) +option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10load_multivalue/00-base.xml b/tests/dictionaries/10load_multivalue/00-base.xml index 5ee2a5ee..938a8ac9 100644 --- a/tests/dictionaries/10load_multivalue/00-base.xml +++ b/tests/dictionaries/10load_multivalue/00-base.xml @@ -1,23 +1,13 @@ - - - - + - - - - - - - - diff --git a/tests/dictionaries/10load_multivalue/makedict/after.json b/tests/dictionaries/10load_multivalue/makedict/after.json new file mode 100644 index 00000000..279b934d --- /dev/null +++ b/tests/dictionaries/10load_multivalue/makedict/after.json @@ -0,0 +1,9 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": [ + "non", + "oui" + ] + } +} diff --git a/tests/dictionaries/10load_multivalue/makedict/base.json b/tests/dictionaries/10load_multivalue/makedict/base.json index d65d28b0..d82bd782 100644 --- a/tests/dictionaries/10load_multivalue/makedict/base.json +++ b/tests/dictionaries/10load_multivalue/makedict/base.json @@ -1 +1,6 @@ -{"rougail.general.mode_conteneur_actif": ["non", "oui"]} +{ + "rougail.general.mode_conteneur_actif": [ + "non", + "oui" + ] +} diff --git a/tests/dictionaries/10load_multivalue/makedict/before.json b/tests/dictionaries/10load_multivalue/makedict/before.json new file mode 100644 index 00000000..279b934d --- /dev/null +++ b/tests/dictionaries/10load_multivalue/makedict/before.json @@ -0,0 +1,9 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": [ + "non", + "oui" + ] + } +} diff --git a/tests/dictionaries/10load_multivalue/tiramisu/base.py b/tests/dictionaries/10load_multivalue/tiramisu/base.py index 1bf9e43e..f9956563 100644 --- a/tests/dictionaries/10load_multivalue/tiramisu/base.py +++ b/tests/dictionaries/10load_multivalue/tiramisu/base.py @@ -1,14 +1,17 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=True, default=['non', 'oui'], default_multi='oui', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", multi=True, default=['non', 'oui'], default_multi="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10valid_enum_accent/00-base.xml b/tests/dictionaries/10valid_enum_accent/00-base.xml index 12720be4..f9982b36 100644 --- a/tests/dictionaries/10valid_enum_accent/00-base.xml +++ b/tests/dictionaries/10valid_enum_accent/00-base.xml @@ -1,35 +1,27 @@ - - - - + - + non - + c - - + a b c é + enumvar - - - bla bla bla - - diff --git a/tests/dictionaries/10valid_enum_accent/makedict/after.json b/tests/dictionaries/10valid_enum_accent/makedict/after.json new file mode 100644 index 00000000..d6497f42 --- /dev/null +++ b/tests/dictionaries/10valid_enum_accent/makedict/after.json @@ -0,0 +1,10 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.enumfam.enumvar": { + "owner": "default", + "value": "c" + } +} diff --git a/tests/dictionaries/10valid_enum_accent/makedict/base.json b/tests/dictionaries/10valid_enum_accent/makedict/base.json index 51f95bc0..58c810c5 100644 --- a/tests/dictionaries/10valid_enum_accent/makedict/base.json +++ b/tests/dictionaries/10valid_enum_accent/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.enumfam.enumvar": "c"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.enumfam.enumvar": "c" +} diff --git a/tests/dictionaries/10valid_enum_accent/makedict/before.json b/tests/dictionaries/10valid_enum_accent/makedict/before.json new file mode 100644 index 00000000..d6497f42 --- /dev/null +++ b/tests/dictionaries/10valid_enum_accent/makedict/before.json @@ -0,0 +1,10 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.enumfam.enumvar": { + "owner": "default", + "value": "c" + } +} diff --git a/tests/dictionaries/10valid_enum_accent/tiramisu/base.py b/tests/dictionaries/10valid_enum_accent/tiramisu/base.py index 8661e0e2..f0792cdb 100644 --- a/tests/dictionaries/10valid_enum_accent/tiramisu/base.py +++ b/tests/dictionaries/10valid_enum_accent/tiramisu/base.py @@ -1,17 +1,20 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'expert', 'mandatory'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'expert'}), children=[option_3]) -option_5 = ChoiceOption(properties=frozenset({'expert', 'mandatory'}), name='enumvar', doc='multi', multi=False, default='c', values=('a', 'b', 'c', 'é')) -option_5.impl_set_information("help", "bla bla bla") -option_4 = OptionDescription(name='enumfam', doc='enumfam', properties=frozenset({'expert'}), children=[option_5]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2, option_4]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"expert", "mandatory"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"expert"})) +option_5 = ChoiceOption(name="enumvar", doc="multi", values=('a', 'b', 'c', 'é'), default="c", properties=frozenset({"expert", "mandatory"})) +option_5.impl_set_information('help', "bla bla bla") +option_4 = OptionDescription(name="enumfam", doc="enumfam", children=[option_5], properties=frozenset({"expert"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10valid_enum_base/00-base.xml b/tests/dictionaries/10valid_enum_base/00-base.xml index 9c8d133e..307b21ce 100644 --- a/tests/dictionaries/10valid_enum_base/00-base.xml +++ b/tests/dictionaries/10valid_enum_base/00-base.xml @@ -1,34 +1,26 @@ - - - - + - + non - + c - - + a b c + enumvar - - - bla bla bla - - diff --git a/tests/dictionaries/10valid_enum_base/makedict/after.json b/tests/dictionaries/10valid_enum_base/makedict/after.json new file mode 100644 index 00000000..d6497f42 --- /dev/null +++ b/tests/dictionaries/10valid_enum_base/makedict/after.json @@ -0,0 +1,10 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.enumfam.enumvar": { + "owner": "default", + "value": "c" + } +} diff --git a/tests/dictionaries/10valid_enum_base/makedict/base.json b/tests/dictionaries/10valid_enum_base/makedict/base.json index 51f95bc0..58c810c5 100644 --- a/tests/dictionaries/10valid_enum_base/makedict/base.json +++ b/tests/dictionaries/10valid_enum_base/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.enumfam.enumvar": "c"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.enumfam.enumvar": "c" +} diff --git a/tests/dictionaries/10valid_enum_base/makedict/before.json b/tests/dictionaries/10valid_enum_base/makedict/before.json new file mode 100644 index 00000000..d6497f42 --- /dev/null +++ b/tests/dictionaries/10valid_enum_base/makedict/before.json @@ -0,0 +1,10 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.enumfam.enumvar": { + "owner": "default", + "value": "c" + } +} diff --git a/tests/dictionaries/10valid_enum_base/tiramisu/base.py b/tests/dictionaries/10valid_enum_base/tiramisu/base.py index 86bd114b..0f349e81 100644 --- a/tests/dictionaries/10valid_enum_base/tiramisu/base.py +++ b/tests/dictionaries/10valid_enum_base/tiramisu/base.py @@ -1,17 +1,20 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'expert', 'mandatory'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'expert'}), children=[option_3]) -option_5 = ChoiceOption(properties=frozenset({'expert', 'mandatory'}), name='enumvar', doc='multi', multi=False, default='c', values=('a', 'b', 'c')) -option_5.impl_set_information("help", "bla bla bla") -option_4 = OptionDescription(name='enumfam', doc='enumfam', properties=frozenset({'expert'}), children=[option_5]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2, option_4]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"expert", "mandatory"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"expert"})) +option_5 = ChoiceOption(name="enumvar", doc="multi", values=('a', 'b', 'c'), default="c", properties=frozenset({"expert", "mandatory"})) +option_5.impl_set_information('help', "bla bla bla") +option_4 = OptionDescription(name="enumfam", doc="enumfam", children=[option_5], properties=frozenset({"expert"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10valid_enum_base_no_mandatory/00-base.xml b/tests/dictionaries/10valid_enum_base_no_mandatory/00-base.xml new file mode 100644 index 00000000..275d9f18 --- /dev/null +++ b/tests/dictionaries/10valid_enum_base_no_mandatory/00-base.xml @@ -0,0 +1,26 @@ + + + + + + non + + + + + c + + + + + + + a + b + c + enumvar + + + + diff --git a/tests/dictionaries/10leadership_mandatory/tiramisu/__init__.py b/tests/dictionaries/10valid_enum_base_no_mandatory/__init__.py similarity index 100% rename from tests/dictionaries/10leadership_mandatory/tiramisu/__init__.py rename to tests/dictionaries/10valid_enum_base_no_mandatory/__init__.py diff --git a/tests/dictionaries/10valid_enum_base_no_mandatory/makedict/after.json b/tests/dictionaries/10valid_enum_base_no_mandatory/makedict/after.json new file mode 100644 index 00000000..d6497f42 --- /dev/null +++ b/tests/dictionaries/10valid_enum_base_no_mandatory/makedict/after.json @@ -0,0 +1,10 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.enumfam.enumvar": { + "owner": "default", + "value": "c" + } +} diff --git a/tests/dictionaries/10valid_enum_base_no_mandatory/makedict/base.json b/tests/dictionaries/10valid_enum_base_no_mandatory/makedict/base.json new file mode 100644 index 00000000..58c810c5 --- /dev/null +++ b/tests/dictionaries/10valid_enum_base_no_mandatory/makedict/base.json @@ -0,0 +1,4 @@ +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.enumfam.enumvar": "c" +} diff --git a/tests/dictionaries/10valid_enum_base_no_mandatory/makedict/before.json b/tests/dictionaries/10valid_enum_base_no_mandatory/makedict/before.json new file mode 100644 index 00000000..d6497f42 --- /dev/null +++ b/tests/dictionaries/10valid_enum_base_no_mandatory/makedict/before.json @@ -0,0 +1,10 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.enumfam.enumvar": { + "owner": "default", + "value": "c" + } +} diff --git a/tests/dictionaries/10valid_enum_base_no_mandatory/tiramisu/base.py b/tests/dictionaries/10valid_enum_base_no_mandatory/tiramisu/base.py new file mode 100644 index 00000000..042e251e --- /dev/null +++ b/tests/dictionaries/10valid_enum_base_no_mandatory/tiramisu/base.py @@ -0,0 +1,19 @@ +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"expert", "mandatory"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"expert"})) +option_5 = ChoiceOption(name="enumvar", doc="enumvar", values=('a', 'b', 'c', None), default="c", properties=frozenset({"expert"})) +option_4 = OptionDescription(name="enumfam", doc="enumfam", children=[option_5], properties=frozenset({"expert"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10valid_enum_base_redefine/00-base.xml b/tests/dictionaries/10valid_enum_base_redefine/00-base.xml index 0b6101aa..45f6e437 100644 --- a/tests/dictionaries/10valid_enum_base_redefine/00-base.xml +++ b/tests/dictionaries/10valid_enum_base_redefine/00-base.xml @@ -1,11 +1,8 @@ - - - - + - + non @@ -13,30 +10,26 @@ c - + c - - + a b c + enumvar - + a b c + enumvar2 - - - bla bla bla - - diff --git a/tests/dictionaries/10valid_enum_base_redefine/01-base.xml b/tests/dictionaries/10valid_enum_base_redefine/01-base.xml index 87b45ceb..9d572c95 100644 --- a/tests/dictionaries/10valid_enum_base_redefine/01-base.xml +++ b/tests/dictionaries/10valid_enum_base_redefine/01-base.xml @@ -1,27 +1,20 @@ - - - - + - + c - - + a c + enumvar - - - - diff --git a/tests/dictionaries/10valid_enum_base_redefine/makedict/after.json b/tests/dictionaries/10valid_enum_base_redefine/makedict/after.json new file mode 100644 index 00000000..bf91d2f7 --- /dev/null +++ b/tests/dictionaries/10valid_enum_base_redefine/makedict/after.json @@ -0,0 +1,14 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.enumfam.enumvar2": { + "owner": "default", + "value": "c" + }, + "rougail.enumfam.enumvar": { + "owner": "default", + "value": "c" + } +} diff --git a/tests/dictionaries/10valid_enum_base_redefine/makedict/base.json b/tests/dictionaries/10valid_enum_base_redefine/makedict/base.json index ec589332..6c0cbe28 100644 --- a/tests/dictionaries/10valid_enum_base_redefine/makedict/base.json +++ b/tests/dictionaries/10valid_enum_base_redefine/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.enumfam.enumvar2": "c", "rougail.enumfam.enumvar": "c"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.enumfam.enumvar2": "c", + "rougail.enumfam.enumvar": "c" +} diff --git a/tests/dictionaries/10valid_enum_base_redefine/makedict/before.json b/tests/dictionaries/10valid_enum_base_redefine/makedict/before.json new file mode 100644 index 00000000..bf91d2f7 --- /dev/null +++ b/tests/dictionaries/10valid_enum_base_redefine/makedict/before.json @@ -0,0 +1,14 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.enumfam.enumvar2": { + "owner": "default", + "value": "c" + }, + "rougail.enumfam.enumvar": { + "owner": "default", + "value": "c" + } +} diff --git a/tests/dictionaries/10valid_enum_base_redefine/tiramisu/base.py b/tests/dictionaries/10valid_enum_base_redefine/tiramisu/base.py index dbfd219e..b0bd34df 100644 --- a/tests/dictionaries/10valid_enum_base_redefine/tiramisu/base.py +++ b/tests/dictionaries/10valid_enum_base_redefine/tiramisu/base.py @@ -1,18 +1,21 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'expert', 'mandatory'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'expert'}), children=[option_3]) -option_5 = ChoiceOption(properties=frozenset({'expert', 'mandatory'}), name='enumvar2', doc='multi', multi=False, default='c', values=('a', 'b', 'c')) -option_6 = ChoiceOption(properties=frozenset({'expert', 'mandatory'}), name='enumvar', doc='multi', multi=False, default='c', values=('a', 'c')) -option_6.impl_set_information("help", "bla bla bla") -option_4 = OptionDescription(name='enumfam', doc='enumfam', properties=frozenset({'expert'}), children=[option_5, option_6]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2, option_4]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"expert", "mandatory"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"expert"})) +option_5 = ChoiceOption(name="enumvar2", doc="multi", values=('a', 'b', 'c'), default="c", properties=frozenset({"expert", "mandatory"})) +option_6 = ChoiceOption(name="enumvar", doc="multi", values=('a', 'c'), default="c", properties=frozenset({"expert", "mandatory"})) +option_6.impl_set_information('help', "bla bla bla") +option_4 = OptionDescription(name="enumfam", doc="enumfam", children=[option_5, option_6], properties=frozenset({"expert"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10valid_enum_eosfunc/tiramisu/base.py b/tests/dictionaries/10valid_enum_eosfunc/tiramisu/base.py deleted file mode 100644 index adf637ed..00000000 --- a/tests/dictionaries/10valid_enum_eosfunc/tiramisu/base.py +++ /dev/null @@ -1,11 +0,0 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') -for key, value in dict(locals()).items(): - if key != ['imp', 'func']: - setattr(func, key, value) -try: - from tiramisu3 import * -except: - from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[]) diff --git a/tests/dictionaries/10valid_enum_leader/00-base.xml b/tests/dictionaries/10valid_enum_leader/00-base.xml index 27161903..c90911fe 100644 --- a/tests/dictionaries/10valid_enum_leader/00-base.xml +++ b/tests/dictionaries/10valid_enum_leader/00-base.xml @@ -1,34 +1,28 @@ - - - - + - + non - - + a b c + follower1 follower1 follower2 - - - diff --git a/tests/dictionaries/10valid_enum_leader/makedict/after.json b/tests/dictionaries/10valid_enum_leader/makedict/after.json new file mode 100644 index 00000000..dd62b980 --- /dev/null +++ b/tests/dictionaries/10valid_enum_leader/makedict/after.json @@ -0,0 +1,18 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.leader.leader": { + "owner": "default", + "value": [] + }, + "rougail.general.leader.follower1": { + "owner": [], + "value": [] + }, + "rougail.general.leader.follower2": { + "owner": [], + "value": [] + } +} diff --git a/tests/dictionaries/10valid_enum_leader/makedict/base.json b/tests/dictionaries/10valid_enum_leader/makedict/base.json index 3ff8a0ae..9031a92a 100644 --- a/tests/dictionaries/10valid_enum_leader/makedict/base.json +++ b/tests/dictionaries/10valid_enum_leader/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.leader.leader": [], "rougail.general.leader.follower1": [], "rougail.general.leader.follower2": []} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.leader.leader": [] +} diff --git a/tests/dictionaries/10valid_enum_leader/makedict/before.json b/tests/dictionaries/10valid_enum_leader/makedict/before.json new file mode 100644 index 00000000..dd62b980 --- /dev/null +++ b/tests/dictionaries/10valid_enum_leader/makedict/before.json @@ -0,0 +1,18 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.leader.leader": { + "owner": "default", + "value": [] + }, + "rougail.general.leader.follower1": { + "owner": [], + "value": [] + }, + "rougail.general.leader.follower2": { + "owner": [], + "value": [] + } +} diff --git a/tests/dictionaries/10valid_enum_leader/tiramisu/base.py b/tests/dictionaries/10valid_enum_leader/tiramisu/base.py index 644c6fbc..a7089875 100644 --- a/tests/dictionaries/10valid_enum_leader/tiramisu/base.py +++ b/tests/dictionaries/10valid_enum_leader/tiramisu/base.py @@ -1,18 +1,21 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_5 = StrOption(name='leader', doc='leader', multi=True) -option_6 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='follower1', doc='follower1', multi=True, default_multi='a', values=('a', 'b', 'c')) -option_7 = StrOption(properties=frozenset({'normal'}), name='follower2', doc='follower2', multi=True) -option_4 = Leadership(name='leader', doc='leader', properties=frozenset({'normal'}), children=[option_5, option_6, option_7]) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_5 = StrOption(name="leader", doc="leader", multi=True) +option_6 = ChoiceOption(name="follower1", doc="follower1", values=('a', 'b', 'c'), multi=True, default_multi="a", properties=frozenset({"mandatory", "normal"})) +option_7 = StrOption(name="follower2", doc="follower2", multi=True, properties=frozenset({"normal"})) +option_4 = Leadership(name="leader", doc="leader", children=[option_5, option_6, option_7], properties=frozenset({"normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10valid_enum_mandatory/00-base.xml b/tests/dictionaries/10valid_enum_mandatory/00-base.xml index 4d104156..595c9149 100644 --- a/tests/dictionaries/10valid_enum_mandatory/00-base.xml +++ b/tests/dictionaries/10valid_enum_mandatory/00-base.xml @@ -1,23 +1,23 @@ - + - + non - - + a b c + enumvar diff --git a/tests/dictionaries/10valid_enum_mandatory/makedict/after.json b/tests/dictionaries/10valid_enum_mandatory/makedict/after.json new file mode 100644 index 00000000..01451701 --- /dev/null +++ b/tests/dictionaries/10valid_enum_mandatory/makedict/after.json @@ -0,0 +1,10 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.enumfam.enumvar": { + "owner": "default", + "value": "a" + } +} diff --git a/tests/dictionaries/10valid_enum_mandatory/makedict/base.json b/tests/dictionaries/10valid_enum_mandatory/makedict/base.json index d875ba96..41a55286 100644 --- a/tests/dictionaries/10valid_enum_mandatory/makedict/base.json +++ b/tests/dictionaries/10valid_enum_mandatory/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.enumfam.enumvar": "a"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.enumfam.enumvar": "a" +} diff --git a/tests/dictionaries/10valid_enum_mandatory/makedict/before.json b/tests/dictionaries/10valid_enum_mandatory/makedict/before.json new file mode 100644 index 00000000..01451701 --- /dev/null +++ b/tests/dictionaries/10valid_enum_mandatory/makedict/before.json @@ -0,0 +1,10 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.enumfam.enumvar": { + "owner": "default", + "value": "a" + } +} diff --git a/tests/dictionaries/10valid_enum_mandatory/tiramisu/base.py b/tests/dictionaries/10valid_enum_mandatory/tiramisu/base.py index 3694c214..344356ff 100644 --- a/tests/dictionaries/10valid_enum_mandatory/tiramisu/base.py +++ b/tests/dictionaries/10valid_enum_mandatory/tiramisu/base.py @@ -1,16 +1,19 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'expert', 'mandatory'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'expert'}), children=[option_3]) -option_5 = ChoiceOption(properties=frozenset({'expert', 'mandatory'}), name='enumvar', doc='multi', multi=False, default='a', values=('a', 'b', 'c')) -option_4 = OptionDescription(name='enumfam', doc='enumfam', properties=frozenset({'expert'}), children=[option_5]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2, option_4]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"expert", "mandatory"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"expert"})) +option_5 = ChoiceOption(name="enumvar", doc="multi", values=('a', 'b', 'c'), default="a", properties=frozenset({"expert", "mandatory"})) +option_4 = OptionDescription(name="enumfam", doc="enumfam", children=[option_5], properties=frozenset({"expert"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10valid_enum_multi/00-base.xml b/tests/dictionaries/10valid_enum_multi/00-base.xml index 6ea4bfa1..8e75b7ba 100644 --- a/tests/dictionaries/10valid_enum_multi/00-base.xml +++ b/tests/dictionaries/10valid_enum_multi/00-base.xml @@ -1,28 +1,22 @@ - - - - + - + non - - + a b c + multi - - - diff --git a/tests/dictionaries/10valid_enum_multi/makedict/after.json b/tests/dictionaries/10valid_enum_multi/makedict/after.json new file mode 100644 index 00000000..e9b5a8d3 --- /dev/null +++ b/tests/dictionaries/10valid_enum_multi/makedict/after.json @@ -0,0 +1,12 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.multi": { + "owner": "default", + "value": [ + "a" + ] + } +} diff --git a/tests/dictionaries/10valid_enum_multi/makedict/base.json b/tests/dictionaries/10valid_enum_multi/makedict/base.json index e40e3d93..b581c6d9 100644 --- a/tests/dictionaries/10valid_enum_multi/makedict/base.json +++ b/tests/dictionaries/10valid_enum_multi/makedict/base.json @@ -1 +1,6 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.multi": ["a"]} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.multi": [ + "a" + ] +} diff --git a/tests/dictionaries/10valid_enum_multi/makedict/before.json b/tests/dictionaries/10valid_enum_multi/makedict/before.json new file mode 100644 index 00000000..e9b5a8d3 --- /dev/null +++ b/tests/dictionaries/10valid_enum_multi/makedict/before.json @@ -0,0 +1,12 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.multi": { + "owner": "default", + "value": [ + "a" + ] + } +} diff --git a/tests/dictionaries/10valid_enum_multi/tiramisu/base.py b/tests/dictionaries/10valid_enum_multi/tiramisu/base.py index 49f57dd8..260c17ff 100644 --- a/tests/dictionaries/10valid_enum_multi/tiramisu/base.py +++ b/tests/dictionaries/10valid_enum_multi/tiramisu/base.py @@ -1,15 +1,18 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='multi', doc='multi', multi=True, default=['a'], default_multi='a', values=('a', 'b', 'c')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_4 = ChoiceOption(name="multi", doc="multi", values=('a', 'b', 'c'), multi=True, default=['a'], default_multi="a", properties=frozenset({"mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10valid_enum_none/00-base.xml b/tests/dictionaries/10valid_enum_none/00-base.xml index f03d3e1a..289af701 100644 --- a/tests/dictionaries/10valid_enum_none/00-base.xml +++ b/tests/dictionaries/10valid_enum_none/00-base.xml @@ -1,34 +1,26 @@ - - - - + - + non - + b - - + a b - + + enumvar - - - bla bla bla - - diff --git a/tests/dictionaries/10valid_enum_none/makedict/after.json b/tests/dictionaries/10valid_enum_none/makedict/after.json new file mode 100644 index 00000000..d6511618 --- /dev/null +++ b/tests/dictionaries/10valid_enum_none/makedict/after.json @@ -0,0 +1,10 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.enumfam.enumvar": { + "owner": "default", + "value": "b" + } +} diff --git a/tests/dictionaries/10valid_enum_none/makedict/base.json b/tests/dictionaries/10valid_enum_none/makedict/base.json index 0a000772..07f78c4a 100644 --- a/tests/dictionaries/10valid_enum_none/makedict/base.json +++ b/tests/dictionaries/10valid_enum_none/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.enumfam.enumvar": "b"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.enumfam.enumvar": "b" +} diff --git a/tests/dictionaries/10valid_enum_none/makedict/before.json b/tests/dictionaries/10valid_enum_none/makedict/before.json new file mode 100644 index 00000000..d6511618 --- /dev/null +++ b/tests/dictionaries/10valid_enum_none/makedict/before.json @@ -0,0 +1,10 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.enumfam.enumvar": { + "owner": "default", + "value": "b" + } +} diff --git a/tests/dictionaries/10valid_enum_none/tiramisu/base.py b/tests/dictionaries/10valid_enum_none/tiramisu/base.py index b625b414..1625920d 100644 --- a/tests/dictionaries/10valid_enum_none/tiramisu/base.py +++ b/tests/dictionaries/10valid_enum_none/tiramisu/base.py @@ -1,17 +1,20 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'expert', 'mandatory'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'expert'}), children=[option_3]) -option_5 = ChoiceOption(properties=frozenset({'expert', 'mandatory'}), name='enumvar', doc='multi', multi=False, default='b', values=('a', 'b', None)) -option_5.impl_set_information("help", "bla bla bla") -option_4 = OptionDescription(name='enumfam', doc='enumfam', properties=frozenset({'expert'}), children=[option_5]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2, option_4]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"expert", "mandatory"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"expert"})) +option_5 = ChoiceOption(name="enumvar", doc="multi", values=('a', 'b', '', None), default="b", properties=frozenset({"expert"})) +option_5.impl_set_information('help', "bla bla bla") +option_4 = OptionDescription(name="enumfam", doc="enumfam", children=[option_5], properties=frozenset({"expert"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10valid_enum_number/00-base.xml b/tests/dictionaries/10valid_enum_number/00-base.xml index 2ab66988..58d54d99 100644 --- a/tests/dictionaries/10valid_enum_number/00-base.xml +++ b/tests/dictionaries/10valid_enum_number/00-base.xml @@ -1,32 +1,25 @@ - - - - + - + non - + - - + 1 2 3 + enumvar - - bla bla bla - - diff --git a/tests/dictionaries/10valid_enum_number/makedict/after.json b/tests/dictionaries/10valid_enum_number/makedict/after.json new file mode 100644 index 00000000..9e95f9bc --- /dev/null +++ b/tests/dictionaries/10valid_enum_number/makedict/after.json @@ -0,0 +1,10 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.enumfam.enumvar": { + "owner": "default", + "value": 1 + } +} diff --git a/tests/dictionaries/10valid_enum_number/makedict/base.json b/tests/dictionaries/10valid_enum_number/makedict/base.json index b69cd0a7..ef9d9758 100644 --- a/tests/dictionaries/10valid_enum_number/makedict/base.json +++ b/tests/dictionaries/10valid_enum_number/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.enumfam.enumvar": 1} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.enumfam.enumvar": 1 +} diff --git a/tests/dictionaries/10valid_enum_number/makedict/before.json b/tests/dictionaries/10valid_enum_number/makedict/before.json new file mode 100644 index 00000000..9e95f9bc --- /dev/null +++ b/tests/dictionaries/10valid_enum_number/makedict/before.json @@ -0,0 +1,10 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.enumfam.enumvar": { + "owner": "default", + "value": 1 + } +} diff --git a/tests/dictionaries/10valid_enum_number/tiramisu/base.py b/tests/dictionaries/10valid_enum_number/tiramisu/base.py index 18f94276..1454d749 100644 --- a/tests/dictionaries/10valid_enum_number/tiramisu/base.py +++ b/tests/dictionaries/10valid_enum_number/tiramisu/base.py @@ -1,17 +1,20 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'expert', 'mandatory'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'expert'}), children=[option_3]) -option_5 = ChoiceOption(properties=frozenset({'expert', 'mandatory'}), name='enumvar', doc='enumvar', multi=False, default=1, values=(1, 2, 3)) -option_5.impl_set_information("help", "bla bla bla") -option_4 = OptionDescription(name='enumfam', doc='enumfam', properties=frozenset({'expert'}), children=[option_5]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2, option_4]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"expert", "mandatory"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"expert"})) +option_5 = ChoiceOption(name="enumvar", doc="enumvar", values=(1, 2, 3), default=1, properties=frozenset({"expert", "mandatory"})) +option_5.impl_set_information('help', "bla bla bla") +option_4 = OptionDescription(name="enumfam", doc="enumfam", children=[option_5], properties=frozenset({"expert"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10valid_enum_numberdefault/00-base.xml b/tests/dictionaries/10valid_enum_numberdefault/00-base.xml index 531b177f..3975516d 100644 --- a/tests/dictionaries/10valid_enum_numberdefault/00-base.xml +++ b/tests/dictionaries/10valid_enum_numberdefault/00-base.xml @@ -1,34 +1,26 @@ - - - - + - + non - + 3 - - + 1 2 3 + enumvar - - - bla bla bla - - diff --git a/tests/dictionaries/10valid_enum_numberdefault/makedict/after.json b/tests/dictionaries/10valid_enum_numberdefault/makedict/after.json new file mode 100644 index 00000000..080ba821 --- /dev/null +++ b/tests/dictionaries/10valid_enum_numberdefault/makedict/after.json @@ -0,0 +1,10 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.enumfam.enumvar": { + "owner": "default", + "value": 3 + } +} diff --git a/tests/dictionaries/10valid_enum_numberdefault/makedict/base.json b/tests/dictionaries/10valid_enum_numberdefault/makedict/base.json index 7047db72..e8e0dc0f 100644 --- a/tests/dictionaries/10valid_enum_numberdefault/makedict/base.json +++ b/tests/dictionaries/10valid_enum_numberdefault/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.enumfam.enumvar": 3} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.enumfam.enumvar": 3 +} diff --git a/tests/dictionaries/10valid_enum_numberdefault/makedict/before.json b/tests/dictionaries/10valid_enum_numberdefault/makedict/before.json new file mode 100644 index 00000000..080ba821 --- /dev/null +++ b/tests/dictionaries/10valid_enum_numberdefault/makedict/before.json @@ -0,0 +1,10 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.enumfam.enumvar": { + "owner": "default", + "value": 3 + } +} diff --git a/tests/dictionaries/10valid_enum_numberdefault/tiramisu/base.py b/tests/dictionaries/10valid_enum_numberdefault/tiramisu/base.py index df4da567..a33048cd 100644 --- a/tests/dictionaries/10valid_enum_numberdefault/tiramisu/base.py +++ b/tests/dictionaries/10valid_enum_numberdefault/tiramisu/base.py @@ -1,17 +1,20 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'expert', 'mandatory'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'expert'}), children=[option_3]) -option_5 = ChoiceOption(properties=frozenset({'expert', 'mandatory'}), name='enumvar', doc='enumvar', multi=False, default=3, values=(1, 2, 3)) -option_5.impl_set_information("help", "bla bla bla") -option_4 = OptionDescription(name='enumfam', doc='enumfam', properties=frozenset({'expert'}), children=[option_5]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2, option_4]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"expert", "mandatory"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"expert"})) +option_5 = ChoiceOption(name="enumvar", doc="enumvar", values=(1, 2, 3), default=3, properties=frozenset({"expert", "mandatory"})) +option_5.impl_set_information('help', "bla bla bla") +option_4 = OptionDescription(name="enumfam", doc="enumfam", children=[option_5], properties=frozenset({"expert"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10valid_enum_param_empty/00-base.xml b/tests/dictionaries/10valid_enum_param_empty/00-base.xml new file mode 100644 index 00000000..1e2cd8ed --- /dev/null +++ b/tests/dictionaries/10valid_enum_param_empty/00-base.xml @@ -0,0 +1,22 @@ + + + + + + non + + + + + + + + + + + enumvar + + + + diff --git a/tests/dictionaries/10leadership_mandatoryfollower/tiramisu/__init__.py b/tests/dictionaries/10valid_enum_param_empty/__init__.py similarity index 100% rename from tests/dictionaries/10leadership_mandatoryfollower/tiramisu/__init__.py rename to tests/dictionaries/10valid_enum_param_empty/__init__.py diff --git a/tests/dictionaries/10valid_enum_param_empty/makedict/after.json b/tests/dictionaries/10valid_enum_param_empty/makedict/after.json new file mode 100644 index 00000000..4c3ef489 --- /dev/null +++ b/tests/dictionaries/10valid_enum_param_empty/makedict/after.json @@ -0,0 +1,10 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.enumfam.enumvar": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/10valid_enum_param_empty/makedict/base.json b/tests/dictionaries/10valid_enum_param_empty/makedict/base.json new file mode 100644 index 00000000..53dfede8 --- /dev/null +++ b/tests/dictionaries/10valid_enum_param_empty/makedict/base.json @@ -0,0 +1,4 @@ +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.enumfam.enumvar": null +} diff --git a/tests/dictionaries/10valid_enum_param_empty/makedict/before.json b/tests/dictionaries/10valid_enum_param_empty/makedict/before.json new file mode 100644 index 00000000..4c3ef489 --- /dev/null +++ b/tests/dictionaries/10valid_enum_param_empty/makedict/before.json @@ -0,0 +1,10 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.enumfam.enumvar": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/10valid_enum_param_empty/tiramisu/base.py b/tests/dictionaries/10valid_enum_param_empty/tiramisu/base.py new file mode 100644 index 00000000..782b6a33 --- /dev/null +++ b/tests/dictionaries/10valid_enum_param_empty/tiramisu/base.py @@ -0,0 +1,20 @@ +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"expert", "mandatory"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"expert"})) +option_5 = ChoiceOption(name="enumvar", doc="multi", values=(None,), properties=frozenset({"expert"})) +option_5.impl_set_information('help', "bla bla bla") +option_4 = OptionDescription(name="enumfam", doc="enumfam", children=[option_5], properties=frozenset({"expert"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10valid_enum_param_empty2/00-base.xml b/tests/dictionaries/10valid_enum_param_empty2/00-base.xml new file mode 100644 index 00000000..2bfd69bf --- /dev/null +++ b/tests/dictionaries/10valid_enum_param_empty2/00-base.xml @@ -0,0 +1,22 @@ + + + + + + non + + + + + + + + + + + enumvar + + + + diff --git a/tests/dictionaries/10leadership_multi/tiramisu/__init__.py b/tests/dictionaries/10valid_enum_param_empty2/__init__.py similarity index 100% rename from tests/dictionaries/10leadership_multi/tiramisu/__init__.py rename to tests/dictionaries/10valid_enum_param_empty2/__init__.py diff --git a/tests/dictionaries/10valid_enum_param_empty2/makedict/after.json b/tests/dictionaries/10valid_enum_param_empty2/makedict/after.json new file mode 100644 index 00000000..4c3ef489 --- /dev/null +++ b/tests/dictionaries/10valid_enum_param_empty2/makedict/after.json @@ -0,0 +1,10 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.enumfam.enumvar": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/10valid_enum_param_empty2/makedict/base.json b/tests/dictionaries/10valid_enum_param_empty2/makedict/base.json new file mode 100644 index 00000000..53dfede8 --- /dev/null +++ b/tests/dictionaries/10valid_enum_param_empty2/makedict/base.json @@ -0,0 +1,4 @@ +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.enumfam.enumvar": null +} diff --git a/tests/dictionaries/10valid_enum_param_empty2/makedict/before.json b/tests/dictionaries/10valid_enum_param_empty2/makedict/before.json new file mode 100644 index 00000000..4c3ef489 --- /dev/null +++ b/tests/dictionaries/10valid_enum_param_empty2/makedict/before.json @@ -0,0 +1,10 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.enumfam.enumvar": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/10valid_enum_param_empty2/tiramisu/base.py b/tests/dictionaries/10valid_enum_param_empty2/tiramisu/base.py new file mode 100644 index 00000000..782b6a33 --- /dev/null +++ b/tests/dictionaries/10valid_enum_param_empty2/tiramisu/base.py @@ -0,0 +1,20 @@ +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"expert", "mandatory"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"expert"})) +option_5 = ChoiceOption(name="enumvar", doc="multi", values=(None,), properties=frozenset({"expert"})) +option_5.impl_set_information('help', "bla bla bla") +option_4 = OptionDescription(name="enumfam", doc="enumfam", children=[option_5], properties=frozenset({"expert"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10valid_enum_python/tiramisu/base.py b/tests/dictionaries/10valid_enum_python/tiramisu/base.py deleted file mode 100644 index adf637ed..00000000 --- a/tests/dictionaries/10valid_enum_python/tiramisu/base.py +++ /dev/null @@ -1,11 +0,0 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') -for key, value in dict(locals()).items(): - if key != ['imp', 'func']: - setattr(func, key, value) -try: - from tiramisu3 import * -except: - from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[]) diff --git a/tests/dictionaries/10valid_enum_quote/00-base.xml b/tests/dictionaries/10valid_enum_quote/00-base.xml new file mode 100644 index 00000000..1614931b --- /dev/null +++ b/tests/dictionaries/10valid_enum_quote/00-base.xml @@ -0,0 +1,24 @@ + + + + + + non + + + + + + + + + + quote' + quote" + quote"' + enumvar + + + + diff --git a/tests/dictionaries/10load_disabled_if_in/tiramisu/__init__.py b/tests/dictionaries/10valid_enum_quote/__init__.py similarity index 100% rename from tests/dictionaries/10load_disabled_if_in/tiramisu/__init__.py rename to tests/dictionaries/10valid_enum_quote/__init__.py diff --git a/tests/dictionaries/10valid_enum_quote/makedict/after.json b/tests/dictionaries/10valid_enum_quote/makedict/after.json new file mode 100644 index 00000000..4d231f85 --- /dev/null +++ b/tests/dictionaries/10valid_enum_quote/makedict/after.json @@ -0,0 +1,10 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.enumfam.enumvar": { + "owner": "default", + "value": "quote'" + } +} diff --git a/tests/dictionaries/10valid_enum_quote/makedict/base.json b/tests/dictionaries/10valid_enum_quote/makedict/base.json new file mode 100644 index 00000000..c63f634d --- /dev/null +++ b/tests/dictionaries/10valid_enum_quote/makedict/base.json @@ -0,0 +1,4 @@ +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.enumfam.enumvar": "quote'" +} diff --git a/tests/dictionaries/10valid_enum_quote/makedict/before.json b/tests/dictionaries/10valid_enum_quote/makedict/before.json new file mode 100644 index 00000000..4d231f85 --- /dev/null +++ b/tests/dictionaries/10valid_enum_quote/makedict/before.json @@ -0,0 +1,10 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.enumfam.enumvar": { + "owner": "default", + "value": "quote'" + } +} diff --git a/tests/dictionaries/10valid_enum_quote/tiramisu/base.py b/tests/dictionaries/10valid_enum_quote/tiramisu/base.py new file mode 100644 index 00000000..ff69f9e1 --- /dev/null +++ b/tests/dictionaries/10valid_enum_quote/tiramisu/base.py @@ -0,0 +1,20 @@ +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"expert", "mandatory"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"expert"})) +option_5 = ChoiceOption(name="enumvar", doc="multi", values=("quote'", 'quote"', 'quote"\''), default="quote'", properties=frozenset({"expert", "mandatory"})) +option_5.impl_set_information('help', "bla bla bla") +option_4 = OptionDescription(name="enumfam", doc="enumfam", children=[option_5], properties=frozenset({"expert"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/10valid_enum_value/00-base.xml b/tests/dictionaries/10valid_enum_value/00-base.xml index 1794b78e..a55be036 100644 --- a/tests/dictionaries/10valid_enum_value/00-base.xml +++ b/tests/dictionaries/10valid_enum_value/00-base.xml @@ -1,27 +1,21 @@ - - - - + b - - + a b c + mode_conteneur_actif - - - diff --git a/tests/dictionaries/10valid_enum_value/makedict/after.json b/tests/dictionaries/10valid_enum_value/makedict/after.json new file mode 100644 index 00000000..b0f53f2b --- /dev/null +++ b/tests/dictionaries/10valid_enum_value/makedict/after.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "b" + } +} diff --git a/tests/dictionaries/10valid_enum_value/makedict/base.json b/tests/dictionaries/10valid_enum_value/makedict/base.json index bcf489f7..9e37bc12 100644 --- a/tests/dictionaries/10valid_enum_value/makedict/base.json +++ b/tests/dictionaries/10valid_enum_value/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "b"} +{ + "rougail.general.mode_conteneur_actif": "b" +} diff --git a/tests/dictionaries/10valid_enum_value/makedict/before.json b/tests/dictionaries/10valid_enum_value/makedict/before.json new file mode 100644 index 00000000..b0f53f2b --- /dev/null +++ b/tests/dictionaries/10valid_enum_value/makedict/before.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "b" + } +} diff --git a/tests/dictionaries/10valid_enum_value/tiramisu/base.py b/tests/dictionaries/10valid_enum_value/tiramisu/base.py index 9c4f9248..0d7ed6a5 100644 --- a/tests/dictionaries/10valid_enum_value/tiramisu/base.py +++ b/tests/dictionaries/10valid_enum_value/tiramisu/base.py @@ -1,14 +1,17 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='b', values=('a', 'b', 'c')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = ChoiceOption(name="mode_conteneur_actif", doc="No change", values=('a', 'b', 'c'), default="b", properties=frozenset({"mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/11disabled_if_in_filelist/00-base.xml b/tests/dictionaries/11disabled_if_in_filelist/00-base.xml index 6a391d6b..8a0fb898 100644 --- a/tests/dictionaries/11disabled_if_in_filelist/00-base.xml +++ b/tests/dictionaries/11disabled_if_in_filelist/00-base.xml @@ -1,23 +1,22 @@ - + - + /etc/file - + non - + non - @@ -28,9 +27,6 @@ afilllist - - - diff --git a/tests/dictionaries/11disabled_if_in_filelist/makedict/after.json b/tests/dictionaries/11disabled_if_in_filelist/makedict/after.json new file mode 100644 index 00000000..75e27edb --- /dev/null +++ b/tests/dictionaries/11disabled_if_in_filelist/makedict/after.json @@ -0,0 +1,54 @@ +{ + "rougail.general.condition": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif2": { + "owner": "default", + "value": true + }, + "services.test.files.file.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.file.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.file.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.file.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.file.name": { + "owner": "default", + "value": "/etc/file" + }, + "services.test.files.file.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.file.source": { + "owner": "default", + "value": "file" + }, + "services.test.files.file.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/11disabled_if_in_filelist/makedict/base.json b/tests/dictionaries/11disabled_if_in_filelist/makedict/base.json index 8841e51c..f2fd3666 100644 --- a/tests/dictionaries/11disabled_if_in_filelist/makedict/base.json +++ b/tests/dictionaries/11disabled_if_in_filelist/makedict/base.json @@ -1 +1,15 @@ -{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": true, "services.test.files.file.group": "root", "services.test.files.file.mode": "0644", "services.test.files.file.name": "/etc/file", "services.test.files.file.owner": "root", "services.test.files.file.source": "file", "services.test.files.file.templating": true, "services.test.files.file.activate": true} +{ + "rougail.general.condition": "non", + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif2": true, + "services.test.files.file.engine": "creole", + "services.test.files.file.group": "root", + "services.test.files.file.included": "no", + "services.test.files.file.mode": "0644", + "services.test.files.file.name": "/etc/file", + "services.test.files.file.owner": "root", + "services.test.files.file.source": "file", + "services.test.files.file.activate": true, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/11disabled_if_in_filelist/makedict/before.json b/tests/dictionaries/11disabled_if_in_filelist/makedict/before.json new file mode 100644 index 00000000..75e27edb --- /dev/null +++ b/tests/dictionaries/11disabled_if_in_filelist/makedict/before.json @@ -0,0 +1,54 @@ +{ + "rougail.general.condition": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif2": { + "owner": "default", + "value": true + }, + "services.test.files.file.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.file.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.file.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.file.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.file.name": { + "owner": "default", + "value": "/etc/file" + }, + "services.test.files.file.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.file.source": { + "owner": "default", + "value": "file" + }, + "services.test.files.file.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/11disabled_if_in_filelist/result/tmpfiles.d/rougail.conf b/tests/dictionaries/11disabled_if_in_filelist/result/tmpfiles.d/rougail.conf new file mode 100644 index 00000000..574c7b82 --- /dev/null +++ b/tests/dictionaries/11disabled_if_in_filelist/result/tmpfiles.d/rougail.conf @@ -0,0 +1,2 @@ +C /etc/file 0644 root root - /usr/local/lib/etc/file +z /etc/file - - - - - diff --git a/tests/dictionaries/11disabled_if_in_filelist/tiramisu/base.py b/tests/dictionaries/11disabled_if_in_filelist/tiramisu/base.py index 52775683..c867565c 100644 --- a/tests/dictionaries/11disabled_if_in_filelist/tiramisu/base.py +++ b/tests/dictionaries/11disabled_if_in_filelist/tiramisu/base.py @@ -1,28 +1,33 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='condition', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal', Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_5 = BoolOption(properties=frozenset({'mandatory', 'normal', Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))}), name='mode_conteneur_actif2', doc='No change', multi=False, default=True) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_10 = StrOption(name='group', doc='group', multi=False, default='root') -option_11 = StrOption(name='mode', doc='mode', multi=False, default='0644') -option_12 = StrOption(name='name', doc='name', multi=False, default='/etc/file') -option_13 = StrOption(name='owner', doc='owner', multi=False, default='root') -option_14 = StrOption(name='source', doc='source', multi=False, default='file') -option_15 = BoolOption(name='templating', doc='templating', multi=False, default=True) -option_16 = BoolOption(properties=frozenset({Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))}), name='activate', doc='activate', multi=False, default=True) -option_9 = OptionDescription(name='file', doc='file', children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16]) -option_8 = OptionDescription(name='files', doc='files', children=[option_9]) -option_7 = OptionDescription(name='test', doc='test', children=[option_8]) -option_7.impl_set_information("manage", True) -option_6 = OptionDescription(name='services', doc='services', properties=frozenset({'hidden'}), children=[option_7]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1, option_6]) +option_3 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")}))})) +option_5 = BoolOption(name="mode_conteneur_actif2", doc="No change", default=True, properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")}))})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_10 = StrOption(name="engine", doc="engine", default="creole") +option_11 = StrOption(name="group", doc="group", default="root") +option_12 = StrOption(name="included", doc="included", default="no") +option_13 = StrOption(name="mode", doc="mode", default="0644") +option_14 = FilenameOption(name="name", doc="name", default="/etc/file") +option_15 = StrOption(name="owner", doc="owner", default="root") +option_16 = StrOption(name="source", doc="source", default="file") +option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=True), 'expected_0': ParamValue("oui")}))) +option_9 = OptionDescription(name="file", doc="file", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17]) +option_8 = OptionDescription(name="files", doc="files", children=[option_9]) +option_18 = BoolOption(name="activate", doc="activate", default=True) +option_19 = BoolOption(name="manage", doc="manage", default=True) +option_7 = OptionDescription(name="test", doc="test", children=[option_8, option_18, option_19]) +option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6]) diff --git a/tests/dictionaries/11disabled_if_in_filelist_boolean/00-base.xml b/tests/dictionaries/11disabled_if_in_filelist_boolean/00-base.xml new file mode 100644 index 00000000..1898469e --- /dev/null +++ b/tests/dictionaries/11disabled_if_in_filelist_boolean/00-base.xml @@ -0,0 +1,22 @@ + + + + + /tmp/file1 + + + + + + + + + + + True + afilllist + + + + diff --git a/tests/dictionaries/10load_disabled_if_in_none/tiramisu/__init__.py b/tests/dictionaries/11disabled_if_in_filelist_boolean/__init__.py similarity index 100% rename from tests/dictionaries/10load_disabled_if_in_none/tiramisu/__init__.py rename to tests/dictionaries/11disabled_if_in_filelist_boolean/__init__.py diff --git a/tests/dictionaries/11disabled_if_in_filelist_boolean/makedict/after.json b/tests/dictionaries/11disabled_if_in_filelist_boolean/makedict/after.json new file mode 100644 index 00000000..eff249b1 --- /dev/null +++ b/tests/dictionaries/11disabled_if_in_filelist_boolean/makedict/after.json @@ -0,0 +1,46 @@ +{ + "rougail.general.condition": { + "owner": "default", + "value": true + }, + "services.test.files.file1.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.file1.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.file1.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.file1.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.file1.name": { + "owner": "default", + "value": "/tmp/file1" + }, + "services.test.files.file1.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.file1.source": { + "owner": "default", + "value": "file1" + }, + "services.test.files.file1.activate": { + "owner": "default", + "value": false + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/11disabled_if_in_filelist_boolean/makedict/base.json b/tests/dictionaries/11disabled_if_in_filelist_boolean/makedict/base.json new file mode 100644 index 00000000..e031fca5 --- /dev/null +++ b/tests/dictionaries/11disabled_if_in_filelist_boolean/makedict/base.json @@ -0,0 +1,13 @@ +{ + "rougail.general.condition": true, + "services.test.files.file1.engine": "creole", + "services.test.files.file1.group": "root", + "services.test.files.file1.included": "no", + "services.test.files.file1.mode": "0644", + "services.test.files.file1.name": "/tmp/file1", + "services.test.files.file1.owner": "root", + "services.test.files.file1.source": "file1", + "services.test.files.file1.activate": false, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/11disabled_if_in_filelist_boolean/makedict/before.json b/tests/dictionaries/11disabled_if_in_filelist_boolean/makedict/before.json new file mode 100644 index 00000000..eff249b1 --- /dev/null +++ b/tests/dictionaries/11disabled_if_in_filelist_boolean/makedict/before.json @@ -0,0 +1,46 @@ +{ + "rougail.general.condition": { + "owner": "default", + "value": true + }, + "services.test.files.file1.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.file1.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.file1.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.file1.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.file1.name": { + "owner": "default", + "value": "/tmp/file1" + }, + "services.test.files.file1.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.file1.source": { + "owner": "default", + "value": "file1" + }, + "services.test.files.file1.activate": { + "owner": "default", + "value": false + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/11disabled_if_in_filelist_boolean/tiramisu/base.py b/tests/dictionaries/11disabled_if_in_filelist_boolean/tiramisu/base.py new file mode 100644 index 00000000..acf353d6 --- /dev/null +++ b/tests/dictionaries/11disabled_if_in_filelist_boolean/tiramisu/base.py @@ -0,0 +1,31 @@ +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +option_3 = BoolOption(name="condition", doc="condition", default=True, properties=frozenset({"mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_8 = StrOption(name="engine", doc="engine", default="creole") +option_9 = StrOption(name="group", doc="group", default="root") +option_10 = StrOption(name="included", doc="included", default="no") +option_11 = StrOption(name="mode", doc="mode", default="0644") +option_12 = FilenameOption(name="name", doc="name", default="/tmp/file1") +option_13 = StrOption(name="owner", doc="owner", default="root") +option_14 = StrOption(name="source", doc="source", default="file1") +option_15 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=True), 'expected_0': ParamValue(True)}))) +option_7 = OptionDescription(name="file1", doc="file1", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14, option_15]) +option_6 = OptionDescription(name="files", doc="files", children=[option_7]) +option_16 = BoolOption(name="activate", doc="activate", default=True) +option_17 = BoolOption(name="manage", doc="manage", default=True) +option_5 = OptionDescription(name="test", doc="test", children=[option_6, option_16, option_17]) +option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/11disabled_if_in_filelist_boolean2/00-base.xml b/tests/dictionaries/11disabled_if_in_filelist_boolean2/00-base.xml new file mode 100644 index 00000000..b7868809 --- /dev/null +++ b/tests/dictionaries/11disabled_if_in_filelist_boolean2/00-base.xml @@ -0,0 +1,24 @@ + + + + + /tmp/file1 + + + + + + False + + + + + + + True + afilllist + + + + diff --git a/tests/dictionaries/10load_disabled_if_inaccent_family/__init__.py b/tests/dictionaries/11disabled_if_in_filelist_boolean2/__init__.py similarity index 100% rename from tests/dictionaries/10load_disabled_if_inaccent_family/__init__.py rename to tests/dictionaries/11disabled_if_in_filelist_boolean2/__init__.py diff --git a/tests/dictionaries/11disabled_if_in_filelist_boolean2/makedict/after.json b/tests/dictionaries/11disabled_if_in_filelist_boolean2/makedict/after.json new file mode 100644 index 00000000..df82f9b0 --- /dev/null +++ b/tests/dictionaries/11disabled_if_in_filelist_boolean2/makedict/after.json @@ -0,0 +1,46 @@ +{ + "rougail.general.condition": { + "owner": "default", + "value": false + }, + "services.test.files.file1.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.file1.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.file1.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.file1.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.file1.name": { + "owner": "default", + "value": "/tmp/file1" + }, + "services.test.files.file1.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.file1.source": { + "owner": "default", + "value": "file1" + }, + "services.test.files.file1.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/11disabled_if_in_filelist_boolean2/makedict/base.json b/tests/dictionaries/11disabled_if_in_filelist_boolean2/makedict/base.json new file mode 100644 index 00000000..4b7d64d9 --- /dev/null +++ b/tests/dictionaries/11disabled_if_in_filelist_boolean2/makedict/base.json @@ -0,0 +1,13 @@ +{ + "rougail.general.condition": false, + "services.test.files.file1.engine": "creole", + "services.test.files.file1.group": "root", + "services.test.files.file1.included": "no", + "services.test.files.file1.mode": "0644", + "services.test.files.file1.name": "/tmp/file1", + "services.test.files.file1.owner": "root", + "services.test.files.file1.source": "file1", + "services.test.files.file1.activate": true, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/11disabled_if_in_filelist_boolean2/makedict/before.json b/tests/dictionaries/11disabled_if_in_filelist_boolean2/makedict/before.json new file mode 100644 index 00000000..df82f9b0 --- /dev/null +++ b/tests/dictionaries/11disabled_if_in_filelist_boolean2/makedict/before.json @@ -0,0 +1,46 @@ +{ + "rougail.general.condition": { + "owner": "default", + "value": false + }, + "services.test.files.file1.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.file1.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.file1.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.file1.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.file1.name": { + "owner": "default", + "value": "/tmp/file1" + }, + "services.test.files.file1.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.file1.source": { + "owner": "default", + "value": "file1" + }, + "services.test.files.file1.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/11disabled_if_in_filelist_boolean2/tiramisu/base.py b/tests/dictionaries/11disabled_if_in_filelist_boolean2/tiramisu/base.py new file mode 100644 index 00000000..d44a6fbc --- /dev/null +++ b/tests/dictionaries/11disabled_if_in_filelist_boolean2/tiramisu/base.py @@ -0,0 +1,31 @@ +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +option_3 = BoolOption(name="condition", doc="condition", default=False, properties=frozenset({"mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_8 = StrOption(name="engine", doc="engine", default="creole") +option_9 = StrOption(name="group", doc="group", default="root") +option_10 = StrOption(name="included", doc="included", default="no") +option_11 = StrOption(name="mode", doc="mode", default="0644") +option_12 = FilenameOption(name="name", doc="name", default="/tmp/file1") +option_13 = StrOption(name="owner", doc="owner", default="root") +option_14 = StrOption(name="source", doc="source", default="file1") +option_15 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=True), 'expected_0': ParamValue(True)}))) +option_7 = OptionDescription(name="file1", doc="file1", children=[option_8, option_9, option_10, option_11, option_12, option_13, option_14, option_15]) +option_6 = OptionDescription(name="files", doc="files", children=[option_7]) +option_16 = BoolOption(name="activate", doc="activate", default=True) +option_17 = BoolOption(name="manage", doc="manage", default=True) +option_5 = OptionDescription(name="test", doc="test", children=[option_6, option_16, option_17]) +option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/11disabled_if_in_filelist_disabled/00-base.xml b/tests/dictionaries/11disabled_if_in_filelist_disabled/00-base.xml index 32c9fdb1..950d9a77 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_disabled/00-base.xml +++ b/tests/dictionaries/11disabled_if_in_filelist_disabled/00-base.xml @@ -1,25 +1,24 @@ - + - + /etc/file - + oui - + non - + non - @@ -30,9 +29,6 @@ afilllist - - - diff --git a/tests/dictionaries/11disabled_if_in_filelist_disabled/makedict/after.json b/tests/dictionaries/11disabled_if_in_filelist_disabled/makedict/after.json new file mode 100644 index 00000000..62ad099f --- /dev/null +++ b/tests/dictionaries/11disabled_if_in_filelist_disabled/makedict/after.json @@ -0,0 +1,46 @@ +{ + "rougail.general.condition": { + "owner": "default", + "value": "oui" + }, + "services.test.files.file.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.file.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.file.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.file.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.file.name": { + "owner": "default", + "value": "/etc/file" + }, + "services.test.files.file.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.file.source": { + "owner": "default", + "value": "file" + }, + "services.test.files.file.activate": { + "owner": "default", + "value": false + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/11disabled_if_in_filelist_disabled/makedict/base.json b/tests/dictionaries/11disabled_if_in_filelist_disabled/makedict/base.json index aa8b1724..332511ae 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_disabled/makedict/base.json +++ b/tests/dictionaries/11disabled_if_in_filelist_disabled/makedict/base.json @@ -1 +1,13 @@ -{"rougail.general.condition": "oui", "services.test.files.file.group": "root", "services.test.files.file.mode": "0644", "services.test.files.file.name": "/etc/file", "services.test.files.file.owner": "root", "services.test.files.file.source": "file", "services.test.files.file.templating": true} +{ + "rougail.general.condition": "oui", + "services.test.files.file.engine": "creole", + "services.test.files.file.group": "root", + "services.test.files.file.included": "no", + "services.test.files.file.mode": "0644", + "services.test.files.file.name": "/etc/file", + "services.test.files.file.owner": "root", + "services.test.files.file.source": "file", + "services.test.files.file.activate": false, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/11disabled_if_in_filelist_disabled/makedict/before.json b/tests/dictionaries/11disabled_if_in_filelist_disabled/makedict/before.json new file mode 100644 index 00000000..62ad099f --- /dev/null +++ b/tests/dictionaries/11disabled_if_in_filelist_disabled/makedict/before.json @@ -0,0 +1,46 @@ +{ + "rougail.general.condition": { + "owner": "default", + "value": "oui" + }, + "services.test.files.file.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.file.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.file.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.file.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.file.name": { + "owner": "default", + "value": "/etc/file" + }, + "services.test.files.file.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.file.source": { + "owner": "default", + "value": "file" + }, + "services.test.files.file.activate": { + "owner": "default", + "value": false + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/10load_disabled_if_inaccent_family/tiramisu/__init__.py b/tests/dictionaries/11disabled_if_in_filelist_disabled/result/tmpfiles.d/rougail.conf similarity index 100% rename from tests/dictionaries/10load_disabled_if_inaccent_family/tiramisu/__init__.py rename to tests/dictionaries/11disabled_if_in_filelist_disabled/result/tmpfiles.d/rougail.conf diff --git a/tests/dictionaries/11disabled_if_in_filelist_disabled/tiramisu/base.py b/tests/dictionaries/11disabled_if_in_filelist_disabled/tiramisu/base.py index 272d5d66..8e122af1 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_disabled/tiramisu/base.py +++ b/tests/dictionaries/11disabled_if_in_filelist_disabled/tiramisu/base.py @@ -1,28 +1,33 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='condition', doc='No change', multi=False, default='oui', values=('oui', 'non')) -option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal', Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_5 = ChoiceOption(properties=frozenset({'mandatory', 'normal', Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))}), name='mode_conteneur_actif2', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_10 = StrOption(name='group', doc='group', multi=False, default='root') -option_11 = StrOption(name='mode', doc='mode', multi=False, default='0644') -option_12 = StrOption(name='name', doc='name', multi=False, default='/etc/file') -option_13 = StrOption(name='owner', doc='owner', multi=False, default='root') -option_14 = StrOption(name='source', doc='source', multi=False, default='file') -option_15 = BoolOption(name='templating', doc='templating', multi=False, default=True) -option_16 = BoolOption(properties=frozenset({Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))}), name='activate', doc='activate', multi=False, default=True) -option_9 = OptionDescription(name='file', doc='file', children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16]) -option_8 = OptionDescription(name='files', doc='files', children=[option_9]) -option_7 = OptionDescription(name='test', doc='test', children=[option_8]) -option_7.impl_set_information("manage", True) -option_6 = OptionDescription(name='services', doc='services', properties=frozenset({'hidden'}), children=[option_7]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1, option_6]) +option_3 = StrOption(name="condition", doc="No change", default="oui", properties=frozenset({"mandatory", "normal"})) +option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")}))})) +option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")}))})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_10 = StrOption(name="engine", doc="engine", default="creole") +option_11 = StrOption(name="group", doc="group", default="root") +option_12 = StrOption(name="included", doc="included", default="no") +option_13 = StrOption(name="mode", doc="mode", default="0644") +option_14 = FilenameOption(name="name", doc="name", default="/etc/file") +option_15 = StrOption(name="owner", doc="owner", default="root") +option_16 = StrOption(name="source", doc="source", default="file") +option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=True), 'expected_0': ParamValue("oui")}))) +option_9 = OptionDescription(name="file", doc="file", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17]) +option_8 = OptionDescription(name="files", doc="files", children=[option_9]) +option_18 = BoolOption(name="activate", doc="activate", default=True) +option_19 = BoolOption(name="manage", doc="manage", default=True) +option_7 = OptionDescription(name="test", doc="test", children=[option_8, option_18, option_19]) +option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6]) diff --git a/tests/dictionaries/11disabled_if_in_filelist_multi/00-base.xml b/tests/dictionaries/11disabled_if_in_filelist_multi/00-base.xml index def894a2..fdca7b2a 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_multi/00-base.xml +++ b/tests/dictionaries/11disabled_if_in_filelist_multi/00-base.xml @@ -1,26 +1,25 @@ - + - - + /tmp/file1 + /tmp/file2 - + non - + non - + non - @@ -31,9 +30,6 @@ afilllist - - - diff --git a/tests/dictionaries/11disabled_if_in_filelist_multi/makedict/after.json b/tests/dictionaries/11disabled_if_in_filelist_multi/makedict/after.json new file mode 100644 index 00000000..5c33f2a1 --- /dev/null +++ b/tests/dictionaries/11disabled_if_in_filelist_multi/makedict/after.json @@ -0,0 +1,86 @@ +{ + "rougail.general.condition": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif2": { + "owner": "default", + "value": "non" + }, + "services.test.files.file1.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.file1.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.file1.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.file1.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.file1.name": { + "owner": "default", + "value": "/tmp/file1" + }, + "services.test.files.file1.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.file1.source": { + "owner": "default", + "value": "file1" + }, + "services.test.files.file1.activate": { + "owner": "default", + "value": true + }, + "services.test.files.file2.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.file2.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.file2.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.file2.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.file2.name": { + "owner": "default", + "value": "/tmp/file2" + }, + "services.test.files.file2.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.file2.source": { + "owner": "default", + "value": "file2" + }, + "services.test.files.file2.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/11disabled_if_in_filelist_multi/makedict/base.json b/tests/dictionaries/11disabled_if_in_filelist_multi/makedict/base.json index 02bbdbb6..5590d9b3 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_multi/makedict/base.json +++ b/tests/dictionaries/11disabled_if_in_filelist_multi/makedict/base.json @@ -1 +1,23 @@ -{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non", "services.test.files.file1.group": "root", "services.test.files.file1.mode": "0644", "services.test.files.file1.name": "/tmp/file1", "services.test.files.file1.owner": "root", "services.test.files.file1.source": "file1", "services.test.files.file1.templating": true, "services.test.files.file1.activate": true, "services.test.files.file2.group": "root", "services.test.files.file2.mode": "0644", "services.test.files.file2.name": "/tmp/file2", "services.test.files.file2.owner": "root", "services.test.files.file2.source": "file2", "services.test.files.file2.templating": true, "services.test.files.file2.activate": true} +{ + "rougail.general.condition": "non", + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif2": "non", + "services.test.files.file1.engine": "creole", + "services.test.files.file1.group": "root", + "services.test.files.file1.included": "no", + "services.test.files.file1.mode": "0644", + "services.test.files.file1.name": "/tmp/file1", + "services.test.files.file1.owner": "root", + "services.test.files.file1.source": "file1", + "services.test.files.file1.activate": true, + "services.test.files.file2.engine": "creole", + "services.test.files.file2.group": "root", + "services.test.files.file2.included": "no", + "services.test.files.file2.mode": "0644", + "services.test.files.file2.name": "/tmp/file2", + "services.test.files.file2.owner": "root", + "services.test.files.file2.source": "file2", + "services.test.files.file2.activate": true, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/11disabled_if_in_filelist_multi/makedict/before.json b/tests/dictionaries/11disabled_if_in_filelist_multi/makedict/before.json new file mode 100644 index 00000000..5c33f2a1 --- /dev/null +++ b/tests/dictionaries/11disabled_if_in_filelist_multi/makedict/before.json @@ -0,0 +1,86 @@ +{ + "rougail.general.condition": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif2": { + "owner": "default", + "value": "non" + }, + "services.test.files.file1.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.file1.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.file1.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.file1.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.file1.name": { + "owner": "default", + "value": "/tmp/file1" + }, + "services.test.files.file1.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.file1.source": { + "owner": "default", + "value": "file1" + }, + "services.test.files.file1.activate": { + "owner": "default", + "value": true + }, + "services.test.files.file2.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.file2.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.file2.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.file2.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.file2.name": { + "owner": "default", + "value": "/tmp/file2" + }, + "services.test.files.file2.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.file2.source": { + "owner": "default", + "value": "file2" + }, + "services.test.files.file2.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/11disabled_if_in_filelist_multi/tiramisu/base.py b/tests/dictionaries/11disabled_if_in_filelist_multi/tiramisu/base.py index ab07f4da..4bd9cc16 100644 --- a/tests/dictionaries/11disabled_if_in_filelist_multi/tiramisu/base.py +++ b/tests/dictionaries/11disabled_if_in_filelist_multi/tiramisu/base.py @@ -1,36 +1,42 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='condition', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal', Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_5 = ChoiceOption(properties=frozenset({'mandatory', 'normal', Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))}), name='mode_conteneur_actif2', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_10 = StrOption(name='group', doc='group', multi=False, default='root') -option_11 = StrOption(name='mode', doc='mode', multi=False, default='0644') -option_12 = StrOption(name='name', doc='name', multi=False, default='/tmp/file1') -option_13 = StrOption(name='owner', doc='owner', multi=False, default='root') -option_14 = StrOption(name='source', doc='source', multi=False, default='file1') -option_15 = BoolOption(name='templating', doc='templating', multi=False, default=True) -option_16 = BoolOption(properties=frozenset({Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))}), name='activate', doc='activate', multi=False, default=True) -option_9 = OptionDescription(name='file1', doc='file1', children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16]) -option_18 = StrOption(name='group', doc='group', multi=False, default='root') -option_19 = StrOption(name='mode', doc='mode', multi=False, default='0644') -option_20 = StrOption(name='name', doc='name', multi=False, default='/tmp/file2') -option_21 = StrOption(name='owner', doc='owner', multi=False, default='root') -option_22 = StrOption(name='source', doc='source', multi=False, default='file2') -option_23 = BoolOption(name='templating', doc='templating', multi=False, default=True) -option_24 = BoolOption(properties=frozenset({Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))}), name='activate', doc='activate', multi=False, default=True) -option_17 = OptionDescription(name='file2', doc='file2', children=[option_18, option_19, option_20, option_21, option_22, option_23, option_24]) -option_8 = OptionDescription(name='files', doc='files', children=[option_9, option_17]) -option_7 = OptionDescription(name='test', doc='test', children=[option_8]) -option_7.impl_set_information("manage", True) -option_6 = OptionDescription(name='services', doc='services', properties=frozenset({'hidden'}), children=[option_7]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1, option_6]) +option_3 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")}))})) +option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")}))})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_10 = StrOption(name="engine", doc="engine", default="creole") +option_11 = StrOption(name="group", doc="group", default="root") +option_12 = StrOption(name="included", doc="included", default="no") +option_13 = StrOption(name="mode", doc="mode", default="0644") +option_14 = FilenameOption(name="name", doc="name", default="/tmp/file1") +option_15 = StrOption(name="owner", doc="owner", default="root") +option_16 = StrOption(name="source", doc="source", default="file1") +option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=True), 'expected_0': ParamValue("oui")}))) +option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17]) +option_19 = StrOption(name="engine", doc="engine", default="creole") +option_20 = StrOption(name="group", doc="group", default="root") +option_21 = StrOption(name="included", doc="included", default="no") +option_22 = StrOption(name="mode", doc="mode", default="0644") +option_23 = FilenameOption(name="name", doc="name", default="/tmp/file2") +option_24 = StrOption(name="owner", doc="owner", default="root") +option_25 = StrOption(name="source", doc="source", default="file2") +option_26 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=True), 'expected_0': ParamValue("oui")}))) +option_18 = OptionDescription(name="file2", doc="file2", children=[option_19, option_20, option_21, option_22, option_23, option_24, option_25, option_26]) +option_8 = OptionDescription(name="files", doc="files", children=[option_9, option_18]) +option_27 = BoolOption(name="activate", doc="activate", default=True) +option_28 = BoolOption(name="manage", doc="manage", default=True) +option_7 = OptionDescription(name="test", doc="test", children=[option_8, option_27, option_28]) +option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6]) diff --git a/tests/dictionaries/11disabledifin_filelist_notexist/00-base.xml b/tests/dictionaries/11disabledifin_filelist_notexist/00-base.xml index 0c84e95b..ccc7fa12 100644 --- a/tests/dictionaries/11disabledifin_filelist_notexist/00-base.xml +++ b/tests/dictionaries/11disabledifin_filelist_notexist/00-base.xml @@ -1,25 +1,24 @@ - + - + /tmp/file - + non - - @@ -28,9 +27,6 @@ afilllist - - - diff --git a/tests/dictionaries/11disabledifin_filelist_notexist/makedict/after.json b/tests/dictionaries/11disabledifin_filelist_notexist/makedict/after.json new file mode 100644 index 00000000..f350e51c --- /dev/null +++ b/tests/dictionaries/11disabledifin_filelist_notexist/makedict/after.json @@ -0,0 +1,54 @@ +{ + "rougail.general.condition": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif2": { + "owner": "default", + "value": "non" + }, + "services.test.files.file.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.file.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.file.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.file.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.file.name": { + "owner": "default", + "value": "/tmp/file" + }, + "services.test.files.file.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.file.source": { + "owner": "default", + "value": "file" + }, + "services.test.files.file.activate": { + "owner": "default", + "value": false + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/11disabledifin_filelist_notexist/makedict/base.json b/tests/dictionaries/11disabledifin_filelist_notexist/makedict/base.json index 1a2b116f..cf42ee84 100644 --- a/tests/dictionaries/11disabledifin_filelist_notexist/makedict/base.json +++ b/tests/dictionaries/11disabledifin_filelist_notexist/makedict/base.json @@ -1 +1,15 @@ -{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non", "services.test.files.file.group": "root", "services.test.files.file.mode": "0644", "services.test.files.file.name": "/tmp/file", "services.test.files.file.owner": "root", "services.test.files.file.source": "file", "services.test.files.file.templating": true} +{ + "rougail.general.condition": "non", + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif2": "non", + "services.test.files.file.engine": "creole", + "services.test.files.file.group": "root", + "services.test.files.file.included": "no", + "services.test.files.file.mode": "0644", + "services.test.files.file.name": "/tmp/file", + "services.test.files.file.owner": "root", + "services.test.files.file.source": "file", + "services.test.files.file.activate": false, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/11disabledifin_filelist_notexist/makedict/before.json b/tests/dictionaries/11disabledifin_filelist_notexist/makedict/before.json new file mode 100644 index 00000000..f350e51c --- /dev/null +++ b/tests/dictionaries/11disabledifin_filelist_notexist/makedict/before.json @@ -0,0 +1,54 @@ +{ + "rougail.general.condition": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif2": { + "owner": "default", + "value": "non" + }, + "services.test.files.file.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.file.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.file.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.file.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.file.name": { + "owner": "default", + "value": "/tmp/file" + }, + "services.test.files.file.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.file.source": { + "owner": "default", + "value": "file" + }, + "services.test.files.file.activate": { + "owner": "default", + "value": false + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/11disabledifin_filelist_notexist/tiramisu/base.py b/tests/dictionaries/11disabledifin_filelist_notexist/tiramisu/base.py index 64792051..158e1708 100644 --- a/tests/dictionaries/11disabledifin_filelist_notexist/tiramisu/base.py +++ b/tests/dictionaries/11disabledifin_filelist_notexist/tiramisu/base.py @@ -1,28 +1,33 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='condition', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_4 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_5 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif2', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_10 = StrOption(name='group', doc='group', multi=False, default='root') -option_11 = StrOption(name='mode', doc='mode', multi=False, default='0644') -option_12 = StrOption(name='name', doc='name', multi=False, default='/tmp/file') -option_13 = StrOption(name='owner', doc='owner', multi=False, default='root') -option_14 = StrOption(name='source', doc='source', multi=False, default='file') -option_15 = BoolOption(name='templating', doc='templating', multi=False, default=True) -option_16 = BoolOption(properties=frozenset({'disabled'}), name='activate', doc='activate', multi=False, default=True) -option_9 = OptionDescription(name='file', doc='file', children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16]) -option_8 = OptionDescription(name='files', doc='files', children=[option_9]) -option_7 = OptionDescription(name='test', doc='test', children=[option_8]) -option_7.impl_set_information("manage", True) -option_6 = OptionDescription(name='services', doc='services', properties=frozenset({'hidden'}), children=[option_7]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1, option_6]) +option_3 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_10 = StrOption(name="engine", doc="engine", default="creole") +option_11 = StrOption(name="group", doc="group", default="root") +option_12 = StrOption(name="included", doc="included", default="no") +option_13 = StrOption(name="mode", doc="mode", default="0644") +option_14 = FilenameOption(name="name", doc="name", default="/tmp/file") +option_15 = StrOption(name="owner", doc="owner", default="root") +option_16 = StrOption(name="source", doc="source", default="file") +option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=True), 'expected_0': ParamValue("unpossible"), 'reverse_condition_0': ParamValue(True)}))) +option_9 = OptionDescription(name="file", doc="file", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17]) +option_8 = OptionDescription(name="files", doc="files", children=[option_9]) +option_18 = BoolOption(name="activate", doc="activate", default=True) +option_19 = BoolOption(name="manage", doc="manage", default=True) +option_7 = OptionDescription(name="test", doc="test", children=[option_8, option_18, option_19]) +option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6]) diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist/00-base.xml b/tests/dictionaries/11disabledifnotin_filelist_notexist/00-base.xml index e85efc4c..ce128737 100644 --- a/tests/dictionaries/11disabledifnotin_filelist_notexist/00-base.xml +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist/00-base.xml @@ -1,26 +1,23 @@ - + - + /tmp/file - - - + non - - @@ -29,9 +26,6 @@ afilllist - - - diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist/makedict/after.json b/tests/dictionaries/11disabledifnotin_filelist_notexist/makedict/after.json new file mode 100644 index 00000000..f350e51c --- /dev/null +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist/makedict/after.json @@ -0,0 +1,54 @@ +{ + "rougail.general.condition": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif2": { + "owner": "default", + "value": "non" + }, + "services.test.files.file.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.file.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.file.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.file.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.file.name": { + "owner": "default", + "value": "/tmp/file" + }, + "services.test.files.file.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.file.source": { + "owner": "default", + "value": "file" + }, + "services.test.files.file.activate": { + "owner": "default", + "value": false + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist/makedict/base.json b/tests/dictionaries/11disabledifnotin_filelist_notexist/makedict/base.json index 1a2b116f..cf42ee84 100644 --- a/tests/dictionaries/11disabledifnotin_filelist_notexist/makedict/base.json +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist/makedict/base.json @@ -1 +1,15 @@ -{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non", "services.test.files.file.group": "root", "services.test.files.file.mode": "0644", "services.test.files.file.name": "/tmp/file", "services.test.files.file.owner": "root", "services.test.files.file.source": "file", "services.test.files.file.templating": true} +{ + "rougail.general.condition": "non", + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif2": "non", + "services.test.files.file.engine": "creole", + "services.test.files.file.group": "root", + "services.test.files.file.included": "no", + "services.test.files.file.mode": "0644", + "services.test.files.file.name": "/tmp/file", + "services.test.files.file.owner": "root", + "services.test.files.file.source": "file", + "services.test.files.file.activate": false, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist/makedict/before.json b/tests/dictionaries/11disabledifnotin_filelist_notexist/makedict/before.json new file mode 100644 index 00000000..f350e51c --- /dev/null +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist/makedict/before.json @@ -0,0 +1,54 @@ +{ + "rougail.general.condition": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif2": { + "owner": "default", + "value": "non" + }, + "services.test.files.file.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.file.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.file.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.file.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.file.name": { + "owner": "default", + "value": "/tmp/file" + }, + "services.test.files.file.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.file.source": { + "owner": "default", + "value": "file" + }, + "services.test.files.file.activate": { + "owner": "default", + "value": false + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist/tiramisu/base.py b/tests/dictionaries/11disabledifnotin_filelist_notexist/tiramisu/base.py index 64792051..158e1708 100644 --- a/tests/dictionaries/11disabledifnotin_filelist_notexist/tiramisu/base.py +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist/tiramisu/base.py @@ -1,28 +1,33 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='condition', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_4 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_5 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif2', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_10 = StrOption(name='group', doc='group', multi=False, default='root') -option_11 = StrOption(name='mode', doc='mode', multi=False, default='0644') -option_12 = StrOption(name='name', doc='name', multi=False, default='/tmp/file') -option_13 = StrOption(name='owner', doc='owner', multi=False, default='root') -option_14 = StrOption(name='source', doc='source', multi=False, default='file') -option_15 = BoolOption(name='templating', doc='templating', multi=False, default=True) -option_16 = BoolOption(properties=frozenset({'disabled'}), name='activate', doc='activate', multi=False, default=True) -option_9 = OptionDescription(name='file', doc='file', children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16]) -option_8 = OptionDescription(name='files', doc='files', children=[option_9]) -option_7 = OptionDescription(name='test', doc='test', children=[option_8]) -option_7.impl_set_information("manage", True) -option_6 = OptionDescription(name='services', doc='services', properties=frozenset({'hidden'}), children=[option_7]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1, option_6]) +option_3 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_10 = StrOption(name="engine", doc="engine", default="creole") +option_11 = StrOption(name="group", doc="group", default="root") +option_12 = StrOption(name="included", doc="included", default="no") +option_13 = StrOption(name="mode", doc="mode", default="0644") +option_14 = FilenameOption(name="name", doc="name", default="/tmp/file") +option_15 = StrOption(name="owner", doc="owner", default="root") +option_16 = StrOption(name="source", doc="source", default="file") +option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=True), 'expected_0': ParamValue("unpossible"), 'reverse_condition_0': ParamValue(True)}))) +option_9 = OptionDescription(name="file", doc="file", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17]) +option_8 = OptionDescription(name="files", doc="files", children=[option_9]) +option_18 = BoolOption(name="activate", doc="activate", default=True) +option_19 = BoolOption(name="manage", doc="manage", default=True) +option_7 = OptionDescription(name="test", doc="test", children=[option_8, option_18, option_19]) +option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6]) diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/00-base.xml b/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/00-base.xml index d97574cc..fe5b9ef6 100644 --- a/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/00-base.xml +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/00-base.xml @@ -1,25 +1,24 @@ - + - + /tmp/file - + non - - @@ -32,9 +31,6 @@ afilllist - - - diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/makedict/after.json b/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/makedict/after.json new file mode 100644 index 00000000..f350e51c --- /dev/null +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/makedict/after.json @@ -0,0 +1,54 @@ +{ + "rougail.general.condition": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif2": { + "owner": "default", + "value": "non" + }, + "services.test.files.file.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.file.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.file.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.file.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.file.name": { + "owner": "default", + "value": "/tmp/file" + }, + "services.test.files.file.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.file.source": { + "owner": "default", + "value": "file" + }, + "services.test.files.file.activate": { + "owner": "default", + "value": false + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/makedict/base.json b/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/makedict/base.json index 1a2b116f..cf42ee84 100644 --- a/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/makedict/base.json +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/makedict/base.json @@ -1 +1,15 @@ -{"rougail.general.condition": "non", "rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif2": "non", "services.test.files.file.group": "root", "services.test.files.file.mode": "0644", "services.test.files.file.name": "/tmp/file", "services.test.files.file.owner": "root", "services.test.files.file.source": "file", "services.test.files.file.templating": true} +{ + "rougail.general.condition": "non", + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif2": "non", + "services.test.files.file.engine": "creole", + "services.test.files.file.group": "root", + "services.test.files.file.included": "no", + "services.test.files.file.mode": "0644", + "services.test.files.file.name": "/tmp/file", + "services.test.files.file.owner": "root", + "services.test.files.file.source": "file", + "services.test.files.file.activate": false, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/makedict/before.json b/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/makedict/before.json new file mode 100644 index 00000000..f350e51c --- /dev/null +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/makedict/before.json @@ -0,0 +1,54 @@ +{ + "rougail.general.condition": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif2": { + "owner": "default", + "value": "non" + }, + "services.test.files.file.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.file.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.file.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.file.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.file.name": { + "owner": "default", + "value": "/tmp/file" + }, + "services.test.files.file.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.file.source": { + "owner": "default", + "value": "file" + }, + "services.test.files.file.activate": { + "owner": "default", + "value": false + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/tiramisu/base.py b/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/tiramisu/base.py index 64792051..db0d3b12 100644 --- a/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/tiramisu/base.py +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist_multi/tiramisu/base.py @@ -1,28 +1,33 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='condition', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_4 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_5 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif2', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_10 = StrOption(name='group', doc='group', multi=False, default='root') -option_11 = StrOption(name='mode', doc='mode', multi=False, default='0644') -option_12 = StrOption(name='name', doc='name', multi=False, default='/tmp/file') -option_13 = StrOption(name='owner', doc='owner', multi=False, default='root') -option_14 = StrOption(name='source', doc='source', multi=False, default='file') -option_15 = BoolOption(name='templating', doc='templating', multi=False, default=True) -option_16 = BoolOption(properties=frozenset({'disabled'}), name='activate', doc='activate', multi=False, default=True) -option_9 = OptionDescription(name='file', doc='file', children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16]) -option_8 = OptionDescription(name='files', doc='files', children=[option_9]) -option_7 = OptionDescription(name='test', doc='test', children=[option_8]) -option_7.impl_set_information("manage", True) -option_6 = OptionDescription(name='services', doc='services', properties=frozenset({'hidden'}), children=[option_7]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1, option_6]) +option_3 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_10 = StrOption(name="engine", doc="engine", default="creole") +option_11 = StrOption(name="group", doc="group", default="root") +option_12 = StrOption(name="included", doc="included", default="no") +option_13 = StrOption(name="mode", doc="mode", default="0644") +option_14 = FilenameOption(name="name", doc="name", default="/tmp/file") +option_15 = StrOption(name="owner", doc="owner", default="root") +option_16 = StrOption(name="source", doc="source", default="file") +option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=True), 'expected_0': ParamValue("unpossible"), 'reverse_condition_0': ParamValue(True), 'condition_1': ParamOption(option_5, notraisepropertyerror=True), 'expected_1': ParamValue("oui"), 'reverse_condition_1': ParamValue(True), 'condition_operator': ParamValue("OR")}))) +option_9 = OptionDescription(name="file", doc="file", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17]) +option_8 = OptionDescription(name="files", doc="files", children=[option_9]) +option_18 = BoolOption(name="activate", doc="activate", default=True) +option_19 = BoolOption(name="manage", doc="manage", default=True) +option_7 = OptionDescription(name="test", doc="test", children=[option_8, option_18, option_19]) +option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6]) diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/00-base.xml b/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/00-base.xml new file mode 100644 index 00000000..0f614bfa --- /dev/null +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/00-base.xml @@ -0,0 +1,35 @@ + + + + + + /tmp/file + + + + + + + non + + + + + + + + + non + statique + condition + + + statique + afilllist + + + diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/makedict/after.json b/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/makedict/after.json new file mode 100644 index 00000000..f350e51c --- /dev/null +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/makedict/after.json @@ -0,0 +1,54 @@ +{ + "rougail.general.condition": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif2": { + "owner": "default", + "value": "non" + }, + "services.test.files.file.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.file.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.file.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.file.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.file.name": { + "owner": "default", + "value": "/tmp/file" + }, + "services.test.files.file.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.file.source": { + "owner": "default", + "value": "file" + }, + "services.test.files.file.activate": { + "owner": "default", + "value": false + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/makedict/base.json b/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/makedict/base.json new file mode 100644 index 00000000..cf42ee84 --- /dev/null +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/makedict/base.json @@ -0,0 +1,15 @@ +{ + "rougail.general.condition": "non", + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif2": "non", + "services.test.files.file.engine": "creole", + "services.test.files.file.group": "root", + "services.test.files.file.included": "no", + "services.test.files.file.mode": "0644", + "services.test.files.file.name": "/tmp/file", + "services.test.files.file.owner": "root", + "services.test.files.file.source": "file", + "services.test.files.file.activate": false, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/makedict/before.json b/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/makedict/before.json new file mode 100644 index 00000000..f350e51c --- /dev/null +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/makedict/before.json @@ -0,0 +1,54 @@ +{ + "rougail.general.condition": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif2": { + "owner": "default", + "value": "non" + }, + "services.test.files.file.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.file.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.file.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.file.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.file.name": { + "owner": "default", + "value": "/tmp/file" + }, + "services.test.files.file.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.file.source": { + "owner": "default", + "value": "file" + }, + "services.test.files.file.activate": { + "owner": "default", + "value": false + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/tiramisu/base.py b/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/tiramisu/base.py index adf637ed..9bdaaa29 100644 --- a/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/tiramisu/base.py +++ b/tests/dictionaries/11disabledifnotin_filelist_notexist_validenum/tiramisu/base.py @@ -1,11 +1,33 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[]) +option_3 = ChoiceOption(name="condition", doc="No change", values=('non', 'statique'), default="non", properties=frozenset({"mandatory", "normal"})) +option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_10 = StrOption(name="engine", doc="engine", default="creole") +option_11 = StrOption(name="group", doc="group", default="root") +option_12 = StrOption(name="included", doc="included", default="no") +option_13 = StrOption(name="mode", doc="mode", default="0644") +option_14 = FilenameOption(name="name", doc="name", default="/tmp/file") +option_15 = StrOption(name="owner", doc="owner", default="root") +option_16 = StrOption(name="source", doc="source", default="file") +option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=True), 'expected_0': ParamValue("statique"), 'reverse_condition_0': ParamValue(True)}))) +option_9 = OptionDescription(name="file", doc="file", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17]) +option_8 = OptionDescription(name="files", doc="files", children=[option_9]) +option_18 = BoolOption(name="activate", doc="activate", default=True) +option_19 = BoolOption(name="manage", doc="manage", default=True) +option_7 = OptionDescription(name="test", doc="test", children=[option_8, option_18, option_19]) +option_6 = OptionDescription(name="services", doc="services", children=[option_7], properties=frozenset({"hidden"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6]) diff --git a/tests/dictionaries/11multi_disabled_if_in_filelist/00-base.xml b/tests/dictionaries/11multi_disabled_if_in_filelist/00-base.xml index a091d1a7..71af616d 100644 --- a/tests/dictionaries/11multi_disabled_if_in_filelist/00-base.xml +++ b/tests/dictionaries/11multi_disabled_if_in_filelist/00-base.xml @@ -1,26 +1,25 @@ - + - + /tmp/file1 - - - + non afilllist @@ -29,9 +28,6 @@ afilllist - - - diff --git a/tests/dictionaries/11multi_disabled_if_in_filelist/makedict/after.json b/tests/dictionaries/11multi_disabled_if_in_filelist/makedict/after.json new file mode 100644 index 00000000..48c91619 --- /dev/null +++ b/tests/dictionaries/11multi_disabled_if_in_filelist/makedict/after.json @@ -0,0 +1,50 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.condition": { + "owner": "default", + "value": "non" + }, + "services.test.files.file1.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.file1.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.file1.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.file1.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.file1.name": { + "owner": "default", + "value": "/tmp/file1" + }, + "services.test.files.file1.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.file1.source": { + "owner": "default", + "value": "file1" + }, + "services.test.files.file1.activate": { + "owner": "default", + "value": false + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/11multi_disabled_if_in_filelist/makedict/base.json b/tests/dictionaries/11multi_disabled_if_in_filelist/makedict/base.json index 5f07cf3d..1e05ae49 100644 --- a/tests/dictionaries/11multi_disabled_if_in_filelist/makedict/base.json +++ b/tests/dictionaries/11multi_disabled_if_in_filelist/makedict/base.json @@ -1 +1,14 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.condition": "non", "services.test.files.file1.group": "root", "services.test.files.file1.mode": "0644", "services.test.files.file1.name": "/tmp/file1", "services.test.files.file1.owner": "root", "services.test.files.file1.source": "file1", "services.test.files.file1.templating": true} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.condition": "non", + "services.test.files.file1.engine": "creole", + "services.test.files.file1.group": "root", + "services.test.files.file1.included": "no", + "services.test.files.file1.mode": "0644", + "services.test.files.file1.name": "/tmp/file1", + "services.test.files.file1.owner": "root", + "services.test.files.file1.source": "file1", + "services.test.files.file1.activate": false, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/11multi_disabled_if_in_filelist/makedict/before.json b/tests/dictionaries/11multi_disabled_if_in_filelist/makedict/before.json new file mode 100644 index 00000000..48c91619 --- /dev/null +++ b/tests/dictionaries/11multi_disabled_if_in_filelist/makedict/before.json @@ -0,0 +1,50 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.condition": { + "owner": "default", + "value": "non" + }, + "services.test.files.file1.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.file1.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.file1.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.file1.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.file1.name": { + "owner": "default", + "value": "/tmp/file1" + }, + "services.test.files.file1.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.file1.source": { + "owner": "default", + "value": "file1" + }, + "services.test.files.file1.activate": { + "owner": "default", + "value": false + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/11multi_disabled_if_in_filelist/tiramisu/base.py b/tests/dictionaries/11multi_disabled_if_in_filelist/tiramisu/base.py index 32ff2abd..4e1e374d 100644 --- a/tests/dictionaries/11multi_disabled_if_in_filelist/tiramisu/base.py +++ b/tests/dictionaries/11multi_disabled_if_in_filelist/tiramisu/base.py @@ -1,27 +1,32 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='condition', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_9 = StrOption(name='group', doc='group', multi=False, default='root') -option_10 = StrOption(name='mode', doc='mode', multi=False, default='0644') -option_11 = StrOption(name='name', doc='name', multi=False, default='/tmp/file1') -option_12 = StrOption(name='owner', doc='owner', multi=False, default='root') -option_13 = StrOption(name='source', doc='source', multi=False, default='file1') -option_14 = BoolOption(name='templating', doc='templating', multi=False, default=True) -option_15 = BoolOption(properties=frozenset({'disabled'}), name='activate', doc='activate', multi=False, default=True) -option_8 = OptionDescription(name='file1', doc='file1', children=[option_9, option_10, option_11, option_12, option_13, option_14, option_15]) -option_7 = OptionDescription(name='files', doc='files', children=[option_8]) -option_6 = OptionDescription(name='test', doc='test', children=[option_7]) -option_6.impl_set_information("manage", True) -option_5 = OptionDescription(name='services', doc='services', properties=frozenset({'hidden'}), children=[option_6]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1, option_5]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_4 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_9 = StrOption(name="engine", doc="engine", default="creole") +option_10 = StrOption(name="group", doc="group", default="root") +option_11 = StrOption(name="included", doc="included", default="no") +option_12 = StrOption(name="mode", doc="mode", default="0644") +option_13 = FilenameOption(name="name", doc="name", default="/tmp/file1") +option_14 = StrOption(name="owner", doc="owner", default="root") +option_15 = StrOption(name="source", doc="source", default="file1") +option_16 = BoolOption(name="activate", doc="activate", default=False) +option_8 = OptionDescription(name="file1", doc="file1", children=[option_9, option_10, option_11, option_12, option_13, option_14, option_15, option_16]) +option_7 = OptionDescription(name="files", doc="files", children=[option_8]) +option_17 = BoolOption(name="activate", doc="activate", default=True) +option_18 = BoolOption(name="manage", doc="manage", default=True) +option_6 = OptionDescription(name="test", doc="test", children=[option_7, option_17, option_18]) +option_5 = OptionDescription(name="services", doc="services", children=[option_6], properties=frozenset({"hidden"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_5]) diff --git a/tests/dictionaries/11valid_enum_function/00-base.xml b/tests/dictionaries/11valid_enum_function/00-base.xml new file mode 100644 index 00000000..81bbe2fa --- /dev/null +++ b/tests/dictionaries/11valid_enum_function/00-base.xml @@ -0,0 +1,20 @@ + + + + + + 9 + + + + + + trange + 0 + 10 + var + + + + diff --git a/tests/dictionaries/10load_disabled_if_not_in_fallback/tiramisu/__init__.py b/tests/dictionaries/11valid_enum_function/__init__.py similarity index 100% rename from tests/dictionaries/10load_disabled_if_not_in_fallback/tiramisu/__init__.py rename to tests/dictionaries/11valid_enum_function/__init__.py diff --git a/tests/dictionaries/11valid_enum_function/makedict/after.json b/tests/dictionaries/11valid_enum_function/makedict/after.json new file mode 100644 index 00000000..49800b2a --- /dev/null +++ b/tests/dictionaries/11valid_enum_function/makedict/after.json @@ -0,0 +1,6 @@ +{ + "rougail.general.var": { + "owner": "default", + "value": 9 + } +} diff --git a/tests/dictionaries/11valid_enum_function/makedict/base.json b/tests/dictionaries/11valid_enum_function/makedict/base.json new file mode 100644 index 00000000..6eeb5601 --- /dev/null +++ b/tests/dictionaries/11valid_enum_function/makedict/base.json @@ -0,0 +1,3 @@ +{ + "rougail.general.var": 9 +} diff --git a/tests/dictionaries/11valid_enum_function/makedict/before.json b/tests/dictionaries/11valid_enum_function/makedict/before.json new file mode 100644 index 00000000..49800b2a --- /dev/null +++ b/tests/dictionaries/11valid_enum_function/makedict/before.json @@ -0,0 +1,6 @@ +{ + "rougail.general.var": { + "owner": "default", + "value": 9 + } +} diff --git a/tests/dictionaries/11valid_enum_function/tiramisu/base.py b/tests/dictionaries/11valid_enum_function/tiramisu/base.py new file mode 100644 index 00000000..c4f1545e --- /dev/null +++ b/tests/dictionaries/11valid_enum_function/tiramisu/base.py @@ -0,0 +1,17 @@ +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +option_3 = ChoiceOption(name="var", doc="New variable", values=Calculation(func.trange, Params((ParamValue(0), ParamValue(10)))), default=9, properties=frozenset({"mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/11valid_enum_variable/00-base.xml b/tests/dictionaries/11valid_enum_variable/00-base.xml new file mode 100644 index 00000000..046adf76 --- /dev/null +++ b/tests/dictionaries/11valid_enum_variable/00-base.xml @@ -0,0 +1,23 @@ + + + + + + a + + + a + b + c + + + + + + var + mode_conteneur_actif + + + + diff --git a/tests/dictionaries/10load_disabled_if_not_in_fallback_force/tiramisu/__init__.py b/tests/dictionaries/11valid_enum_variable/__init__.py similarity index 100% rename from tests/dictionaries/10load_disabled_if_not_in_fallback_force/tiramisu/__init__.py rename to tests/dictionaries/11valid_enum_variable/__init__.py diff --git a/tests/dictionaries/11valid_enum_variable/makedict/after.json b/tests/dictionaries/11valid_enum_variable/makedict/after.json new file mode 100644 index 00000000..da7c1973 --- /dev/null +++ b/tests/dictionaries/11valid_enum_variable/makedict/after.json @@ -0,0 +1,14 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "a" + }, + "rougail.general.var": { + "owner": "default", + "value": [ + "a", + "b", + "c" + ] + } +} diff --git a/tests/dictionaries/11valid_enum_variable/makedict/base.json b/tests/dictionaries/11valid_enum_variable/makedict/base.json new file mode 100644 index 00000000..0d2bcba8 --- /dev/null +++ b/tests/dictionaries/11valid_enum_variable/makedict/base.json @@ -0,0 +1,8 @@ +{ + "rougail.general.mode_conteneur_actif": "a", + "rougail.general.var": [ + "a", + "b", + "c" + ] +} diff --git a/tests/dictionaries/11valid_enum_variable/makedict/before.json b/tests/dictionaries/11valid_enum_variable/makedict/before.json new file mode 100644 index 00000000..da7c1973 --- /dev/null +++ b/tests/dictionaries/11valid_enum_variable/makedict/before.json @@ -0,0 +1,14 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "a" + }, + "rougail.general.var": { + "owner": "default", + "value": [ + "a", + "b", + "c" + ] + } +} diff --git a/tests/dictionaries/11valid_enum_variable/tiramisu/base.py b/tests/dictionaries/11valid_enum_variable/tiramisu/base.py new file mode 100644 index 00000000..e4907cf9 --- /dev/null +++ b/tests/dictionaries/11valid_enum_variable/tiramisu/base.py @@ -0,0 +1,18 @@ +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +option_4 = StrOption(name="var", doc="New variable", multi=True, default=['a', 'b', 'c'], default_multi="a", properties=frozenset({"mandatory", "normal"})) +option_3 = ChoiceOption(name="mode_conteneur_actif", doc="No change", values=Calculation(func.calc_value, Params((ParamOption(option_4)))), default="a", properties=frozenset({"mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/20family_append/00-base.xml b/tests/dictionaries/20family_append/00-base.xml index 9941bac4..0e6d4337 100644 --- a/tests/dictionaries/20family_append/00-base.xml +++ b/tests/dictionaries/20family_append/00-base.xml @@ -1,22 +1,12 @@ - - - - + - - - - - - - - diff --git a/tests/dictionaries/20family_append/01-base.xml b/tests/dictionaries/20family_append/01-base.xml index 9ffc7dac..ce4a2ad3 100644 --- a/tests/dictionaries/20family_append/01-base.xml +++ b/tests/dictionaries/20family_append/01-base.xml @@ -1,20 +1,10 @@ - - - - + - - - - - - - - diff --git a/tests/dictionaries/20family_append/makedict/after.json b/tests/dictionaries/20family_append/makedict/after.json new file mode 100644 index 00000000..6ebfbbe9 --- /dev/null +++ b/tests/dictionaries/20family_append/makedict/after.json @@ -0,0 +1,10 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif1": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/20family_append/makedict/base.json b/tests/dictionaries/20family_append/makedict/base.json index b58d6e7c..3f1a7b00 100644 --- a/tests/dictionaries/20family_append/makedict/base.json +++ b/tests/dictionaries/20family_append/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif1": "non"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif1": "non" +} diff --git a/tests/dictionaries/20family_append/makedict/before.json b/tests/dictionaries/20family_append/makedict/before.json new file mode 100644 index 00000000..6ebfbbe9 --- /dev/null +++ b/tests/dictionaries/20family_append/makedict/before.json @@ -0,0 +1,10 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif1": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/20family_append/tiramisu/base.py b/tests/dictionaries/20family_append/tiramisu/base.py index 5cbf2a29..9ad04363 100644 --- a/tests/dictionaries/20family_append/tiramisu/base.py +++ b/tests/dictionaries/20family_append/tiramisu/base.py @@ -1,15 +1,18 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_4 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif1', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_4 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/20family_appendaccent/00-base.xml b/tests/dictionaries/20family_appendaccent/00-base.xml deleted file mode 100644 index 7057c75f..00000000 --- a/tests/dictionaries/20family_appendaccent/00-base.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - non - - - - - - - - - - - non - mode_conteneur_actif - - - - - - - diff --git a/tests/dictionaries/20family_appendaccent/01-base.xml b/tests/dictionaries/20family_appendaccent/01-base.xml deleted file mode 100644 index 4b835daa..00000000 --- a/tests/dictionaries/20family_appendaccent/01-base.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/tests/dictionaries/20family_appendaccent/02-base.xml b/tests/dictionaries/20family_appendaccent/02-base.xml deleted file mode 100644 index ddcecbf0..00000000 --- a/tests/dictionaries/20family_appendaccent/02-base.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/tests/dictionaries/20family_appendaccent/makedict/base.json b/tests/dictionaries/20family_appendaccent/makedict/base.json deleted file mode 100644 index abc90084..00000000 --- a/tests/dictionaries/20family_appendaccent/makedict/base.json +++ /dev/null @@ -1 +0,0 @@ -{"rougail.general.mode_conteneur_actif1": "non", "rougail.general.mode_conteneur_actif2": "non", "rougail.other.mode_conteneur_actif3": "non"} diff --git a/tests/dictionaries/20family_appendaccent/tiramisu/base.py b/tests/dictionaries/20family_appendaccent/tiramisu/base.py deleted file mode 100644 index 4fa47c1c..00000000 --- a/tests/dictionaries/20family_appendaccent/tiramisu/base.py +++ /dev/null @@ -1,18 +0,0 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') -for key, value in dict(locals()).items(): - if key != ['imp', 'func']: - setattr(func, key, value) -try: - from tiramisu3 import * -except: - from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_7 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif3', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal', Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_7, todict=True), 'expected': ParamValue('non')}))}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_4 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif1', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_5 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif2', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='Général', properties=frozenset({'normal'}), children=[option_3, option_4, option_5]) -option_6 = OptionDescription(name='other', doc='Other', properties=frozenset({'normal'}), children=[option_7]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2, option_6]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) diff --git a/tests/dictionaries/20family_dynamic/00-base.xml b/tests/dictionaries/20family_dynamic/00-base.xml index db0e2fdc..243f828a 100644 --- a/tests/dictionaries/20family_dynamic/00-base.xml +++ b/tests/dictionaries/20family_dynamic/00-base.xml @@ -1,6 +1,6 @@ - + diff --git a/tests/dictionaries/20family_dynamic/makedict/after.json b/tests/dictionaries/20family_dynamic/makedict/after.json new file mode 100644 index 00000000..4201ce97 --- /dev/null +++ b/tests/dictionaries/20family_dynamic/makedict/after.json @@ -0,0 +1,17 @@ +{ + "rougail.general.varname": { + "owner": "default", + "value": [ + "val1", + "val2" + ] + }, + "rougail.dynval1.vardynval1": { + "owner": "default", + "value": null + }, + "rougail.dynval2.vardynval2": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/20family_dynamic/makedict/base.json b/tests/dictionaries/20family_dynamic/makedict/base.json index 64024485..f3dfb591 100644 --- a/tests/dictionaries/20family_dynamic/makedict/base.json +++ b/tests/dictionaries/20family_dynamic/makedict/base.json @@ -1 +1,8 @@ -{"rougail.general.varname": ["val1", "val2"], "rougail.dynval1.vardynval1": null, "rougail.dynval2.vardynval2": null} +{ + "rougail.general.varname": [ + "val1", + "val2" + ], + "rougail.dynval1.vardynval1": null, + "rougail.dynval2.vardynval2": null +} diff --git a/tests/dictionaries/20family_dynamic/makedict/before.json b/tests/dictionaries/20family_dynamic/makedict/before.json new file mode 100644 index 00000000..4201ce97 --- /dev/null +++ b/tests/dictionaries/20family_dynamic/makedict/before.json @@ -0,0 +1,17 @@ +{ + "rougail.general.varname": { + "owner": "default", + "value": [ + "val1", + "val2" + ] + }, + "rougail.dynval1.vardynval1": { + "owner": "default", + "value": null + }, + "rougail.dynval2.vardynval2": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/20family_dynamic/tiramisu/base.py b/tests/dictionaries/20family_dynamic/tiramisu/base.py index 645fa11c..732b3599 100644 --- a/tests/dictionaries/20family_dynamic/tiramisu/base.py +++ b/tests/dictionaries/20family_dynamic/tiramisu/base.py @@ -1,16 +1,20 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * from rougail.tiramisu import ConvertDynOptionDescription -option_3 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='varname', doc='No change', multi=True, default=['val1', 'val2'], default_multi='val2') -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3]) -option_5 = StrOption(properties=frozenset({'normal'}), name='vardyn', doc='No change', multi=False) -option_4 = ConvertDynOptionDescription(name='dyn', doc='dyn', suffixes=Calculation(func.calc_value, Params((ParamOption(option_3)))), properties=frozenset({'normal'}), children=[option_5]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2, option_4]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="varname", doc="No change", multi=True, default=['val1', 'val2'], default_multi="val1", properties=frozenset({"mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) +option_5 = StrOption(name="vardyn", doc="No change", properties=frozenset({"normal"})) +option_4 = ConvertDynOptionDescription(name="dyn", doc="dyn", suffixes=Calculation(func.calc_value, Params((ParamOption(option_3, notraisepropertyerror=True)))), children=[option_5], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/20family_dynamic_calc/00-base.xml b/tests/dictionaries/20family_dynamic_calc/00-base.xml new file mode 100644 index 00000000..74053acb --- /dev/null +++ b/tests/dictionaries/20family_dynamic_calc/00-base.xml @@ -0,0 +1,26 @@ + + + + + + + val1 + val2 + + + + + val + + + + + + + + + vardynval1 + newvar + + + diff --git a/tests/dictionaries/20family_dynamic_calc/makedict/after.json b/tests/dictionaries/20family_dynamic_calc/makedict/after.json new file mode 100644 index 00000000..6bc6e807 --- /dev/null +++ b/tests/dictionaries/20family_dynamic_calc/makedict/after.json @@ -0,0 +1,21 @@ +{ + "rougail.general.varname": { + "owner": "default", + "value": [ + "val1", + "val2" + ] + }, + "rougail.dynval1.vardynval1": { + "owner": "default", + "value": "val" + }, + "rougail.dynval2.vardynval2": { + "owner": "default", + "value": "val" + }, + "rougail.new.newvar": { + "owner": "default", + "value": "val" + } +} diff --git a/tests/dictionaries/20family_dynamic_calc/makedict/base.json b/tests/dictionaries/20family_dynamic_calc/makedict/base.json new file mode 100644 index 00000000..9b99cc84 --- /dev/null +++ b/tests/dictionaries/20family_dynamic_calc/makedict/base.json @@ -0,0 +1,9 @@ +{ + "rougail.general.varname": [ + "val1", + "val2" + ], + "rougail.dynval1.vardynval1": "val", + "rougail.dynval2.vardynval2": "val", + "rougail.new.newvar": "val" +} diff --git a/tests/dictionaries/20family_dynamic_calc/makedict/before.json b/tests/dictionaries/20family_dynamic_calc/makedict/before.json new file mode 100644 index 00000000..6bc6e807 --- /dev/null +++ b/tests/dictionaries/20family_dynamic_calc/makedict/before.json @@ -0,0 +1,21 @@ +{ + "rougail.general.varname": { + "owner": "default", + "value": [ + "val1", + "val2" + ] + }, + "rougail.dynval1.vardynval1": { + "owner": "default", + "value": "val" + }, + "rougail.dynval2.vardynval2": { + "owner": "default", + "value": "val" + }, + "rougail.new.newvar": { + "owner": "default", + "value": "val" + } +} diff --git a/tests/dictionaries/20family_dynamic_calc/tiramisu/base.py b/tests/dictionaries/20family_dynamic_calc/tiramisu/base.py index adf637ed..f95a1bb2 100644 --- a/tests/dictionaries/20family_dynamic_calc/tiramisu/base.py +++ b/tests/dictionaries/20family_dynamic_calc/tiramisu/base.py @@ -1,11 +1,22 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * from rougail.tiramisu import ConvertDynOptionDescription -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[]) +option_3 = StrOption(name="varname", doc="No change", multi=True, default=['val1', 'val2'], default_multi="val1", properties=frozenset({"mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) +option_5 = StrOption(name="vardyn", doc="No change", default="val", properties=frozenset({"mandatory", "normal"})) +option_4 = ConvertDynOptionDescription(name="dyn", doc="dyn", suffixes=Calculation(func.calc_value, Params((ParamOption(option_3, notraisepropertyerror=True)))), children=[option_5], properties=frozenset({"normal"})) +option_7 = StrOption(name="newvar", doc="No change", default=Calculation(func.calc_val, Params((ParamDynOption(option_5, 'val1', option_4)))), properties=frozenset({"normal"})) +option_6 = OptionDescription(name="new", doc="new", children=[option_7], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4, option_6]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/20family_dynamic_calc2/00-base.xml b/tests/dictionaries/20family_dynamic_calc2/00-base.xml new file mode 100644 index 00000000..e12821b2 --- /dev/null +++ b/tests/dictionaries/20family_dynamic_calc2/00-base.xml @@ -0,0 +1,26 @@ + + + + + + + val1 + val2 + + + + + val + + + + + + + + + non + dyn + + + diff --git a/tests/dictionaries/10load_disabledifin_fallback/tiramisu/__init__.py b/tests/dictionaries/20family_dynamic_calc2/__init__.py similarity index 100% rename from tests/dictionaries/10load_disabledifin_fallback/tiramisu/__init__.py rename to tests/dictionaries/20family_dynamic_calc2/__init__.py diff --git a/tests/dictionaries/20family_dynamic_calc2/makedict/after.json b/tests/dictionaries/20family_dynamic_calc2/makedict/after.json new file mode 100644 index 00000000..58f9d6dd --- /dev/null +++ b/tests/dictionaries/20family_dynamic_calc2/makedict/after.json @@ -0,0 +1,21 @@ +{ + "rougail.general.varname": { + "owner": "default", + "value": [ + "val1", + "val2" + ] + }, + "rougail.dynval1.vardynval1": { + "owner": "default", + "value": "val" + }, + "rougail.dynval2.vardynval2": { + "owner": "default", + "value": "val" + }, + "rougail.new.newvar": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/20family_dynamic_calc2/makedict/base.json b/tests/dictionaries/20family_dynamic_calc2/makedict/base.json new file mode 100644 index 00000000..856ad009 --- /dev/null +++ b/tests/dictionaries/20family_dynamic_calc2/makedict/base.json @@ -0,0 +1,9 @@ +{ + "rougail.general.varname": [ + "val1", + "val2" + ], + "rougail.dynval1.vardynval1": "val", + "rougail.dynval2.vardynval2": "val", + "rougail.new.newvar": null +} diff --git a/tests/dictionaries/20family_dynamic_calc2/makedict/before.json b/tests/dictionaries/20family_dynamic_calc2/makedict/before.json new file mode 100644 index 00000000..58f9d6dd --- /dev/null +++ b/tests/dictionaries/20family_dynamic_calc2/makedict/before.json @@ -0,0 +1,21 @@ +{ + "rougail.general.varname": { + "owner": "default", + "value": [ + "val1", + "val2" + ] + }, + "rougail.dynval1.vardynval1": { + "owner": "default", + "value": "val" + }, + "rougail.dynval2.vardynval2": { + "owner": "default", + "value": "val" + }, + "rougail.new.newvar": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/20family_dynamic_calc2/tiramisu/base.py b/tests/dictionaries/20family_dynamic_calc2/tiramisu/base.py new file mode 100644 index 00000000..d665934b --- /dev/null +++ b/tests/dictionaries/20family_dynamic_calc2/tiramisu/base.py @@ -0,0 +1,22 @@ +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +from rougail.tiramisu import ConvertDynOptionDescription +option_3 = StrOption(name="varname", doc="No change", multi=True, default=['val1', 'val2'], default_multi="val1", properties=frozenset({"mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) +option_7 = StrOption(name="newvar", doc="No change", properties=frozenset({"normal"})) +option_5 = StrOption(name="vardyn", doc="No change", default="val", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_7, todict=True, notraisepropertyerror=True), 'expected': ParamValue("non")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_7, todict=True, notraisepropertyerror=True), 'expected': ParamValue("non")}))})) +option_4 = ConvertDynOptionDescription(name="dyn", doc="dyn", suffixes=Calculation(func.calc_value, Params((ParamOption(option_3, notraisepropertyerror=True)))), children=[option_5], properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_7, todict=True, notraisepropertyerror=True), 'expected': ParamValue("non")}))})) +option_6 = OptionDescription(name="new", doc="new", children=[option_7], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4, option_6]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/20family_dynamic_calc_suffix/00-base.xml b/tests/dictionaries/20family_dynamic_calc_suffix/00-base.xml new file mode 100644 index 00000000..123a6ed5 --- /dev/null +++ b/tests/dictionaries/20family_dynamic_calc_suffix/00-base.xml @@ -0,0 +1,26 @@ + + + + + + + val1 + val2 + + + + + val + + + + + + + + + + vardyn + + + diff --git a/tests/dictionaries/10load_disabledifin_fallback_force/tiramisu/__init__.py b/tests/dictionaries/20family_dynamic_calc_suffix/__init__.py similarity index 100% rename from tests/dictionaries/10load_disabledifin_fallback_force/tiramisu/__init__.py rename to tests/dictionaries/20family_dynamic_calc_suffix/__init__.py diff --git a/tests/dictionaries/20family_dynamic_calc_suffix/makedict/after.json b/tests/dictionaries/20family_dynamic_calc_suffix/makedict/after.json new file mode 100644 index 00000000..66fde813 --- /dev/null +++ b/tests/dictionaries/20family_dynamic_calc_suffix/makedict/after.json @@ -0,0 +1,21 @@ +{ + "rougail.general.varname": { + "owner": "default", + "value": [ + "val1", + "val2" + ] + }, + "rougail.dynval1.vardynval1": { + "owner": "default", + "value": "val1" + }, + "rougail.dynval2.vardynval2": { + "owner": "default", + "value": "val2" + }, + "rougail.new.newvar": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/20family_dynamic_calc_suffix/makedict/base.json b/tests/dictionaries/20family_dynamic_calc_suffix/makedict/base.json new file mode 100644 index 00000000..c1f25445 --- /dev/null +++ b/tests/dictionaries/20family_dynamic_calc_suffix/makedict/base.json @@ -0,0 +1,9 @@ +{ + "rougail.general.varname": [ + "val1", + "val2" + ], + "rougail.dynval1.vardynval1": "val1", + "rougail.dynval2.vardynval2": "val2", + "rougail.new.newvar": null +} diff --git a/tests/dictionaries/20family_dynamic_calc_suffix/makedict/before.json b/tests/dictionaries/20family_dynamic_calc_suffix/makedict/before.json new file mode 100644 index 00000000..66fde813 --- /dev/null +++ b/tests/dictionaries/20family_dynamic_calc_suffix/makedict/before.json @@ -0,0 +1,21 @@ +{ + "rougail.general.varname": { + "owner": "default", + "value": [ + "val1", + "val2" + ] + }, + "rougail.dynval1.vardynval1": { + "owner": "default", + "value": "val1" + }, + "rougail.dynval2.vardynval2": { + "owner": "default", + "value": "val2" + }, + "rougail.new.newvar": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/20family_dynamic_calc_suffix/tiramisu/base.py b/tests/dictionaries/20family_dynamic_calc_suffix/tiramisu/base.py new file mode 100644 index 00000000..3bceab1b --- /dev/null +++ b/tests/dictionaries/20family_dynamic_calc_suffix/tiramisu/base.py @@ -0,0 +1,22 @@ +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +from rougail.tiramisu import ConvertDynOptionDescription +option_3 = StrOption(name="varname", doc="No change", multi=True, default=['val1', 'val2'], default_multi="val1", properties=frozenset({"mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) +option_5 = StrOption(name="vardyn", doc="No change", default=Calculation(func.calc_val, Params((ParamSuffix()))), properties=frozenset({"normal"})) +option_4 = ConvertDynOptionDescription(name="dyn", doc="dyn", suffixes=Calculation(func.calc_value, Params((ParamOption(option_3, notraisepropertyerror=True)))), children=[option_5], properties=frozenset({"normal"})) +option_7 = StrOption(name="newvar", doc="No change", properties=frozenset({"normal"})) +option_6 = OptionDescription(name="new", doc="new", children=[option_7], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4, option_6]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/20family_dynamic_description/00-base.xml b/tests/dictionaries/20family_dynamic_description/00-base.xml new file mode 100644 index 00000000..a342a028 --- /dev/null +++ b/tests/dictionaries/20family_dynamic_description/00-base.xml @@ -0,0 +1,15 @@ + + + + + + + val1 + val2 + + + + + + + diff --git a/tests/dictionaries/10load_disabledifin_whithouttype/tiramisu/__init__.py b/tests/dictionaries/20family_dynamic_description/__init__.py similarity index 100% rename from tests/dictionaries/10load_disabledifin_whithouttype/tiramisu/__init__.py rename to tests/dictionaries/20family_dynamic_description/__init__.py diff --git a/tests/dictionaries/20family_dynamic_description/makedict/after.json b/tests/dictionaries/20family_dynamic_description/makedict/after.json new file mode 100644 index 00000000..4201ce97 --- /dev/null +++ b/tests/dictionaries/20family_dynamic_description/makedict/after.json @@ -0,0 +1,17 @@ +{ + "rougail.general.varname": { + "owner": "default", + "value": [ + "val1", + "val2" + ] + }, + "rougail.dynval1.vardynval1": { + "owner": "default", + "value": null + }, + "rougail.dynval2.vardynval2": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/20family_dynamic_description/makedict/base.json b/tests/dictionaries/20family_dynamic_description/makedict/base.json new file mode 100644 index 00000000..f3dfb591 --- /dev/null +++ b/tests/dictionaries/20family_dynamic_description/makedict/base.json @@ -0,0 +1,8 @@ +{ + "rougail.general.varname": [ + "val1", + "val2" + ], + "rougail.dynval1.vardynval1": null, + "rougail.dynval2.vardynval2": null +} diff --git a/tests/dictionaries/20family_dynamic_description/makedict/before.json b/tests/dictionaries/20family_dynamic_description/makedict/before.json new file mode 100644 index 00000000..4201ce97 --- /dev/null +++ b/tests/dictionaries/20family_dynamic_description/makedict/before.json @@ -0,0 +1,17 @@ +{ + "rougail.general.varname": { + "owner": "default", + "value": [ + "val1", + "val2" + ] + }, + "rougail.dynval1.vardynval1": { + "owner": "default", + "value": null + }, + "rougail.dynval2.vardynval2": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/20family_dynamic_description/tiramisu/base.py b/tests/dictionaries/20family_dynamic_description/tiramisu/base.py new file mode 100644 index 00000000..43a78559 --- /dev/null +++ b/tests/dictionaries/20family_dynamic_description/tiramisu/base.py @@ -0,0 +1,20 @@ +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +from rougail.tiramisu import ConvertDynOptionDescription +option_3 = StrOption(name="varname", doc="No change", multi=True, default=['val1', 'val2'], default_multi="val1", properties=frozenset({"mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) +option_5 = StrOption(name="vardyn", doc="No change", properties=frozenset({"normal"})) +option_4 = ConvertDynOptionDescription(name="dyn", doc="Dyn ", suffixes=Calculation(func.calc_value, Params((ParamOption(option_3, notraisepropertyerror=True)))), children=[option_5], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/20family_dynamic_number/00-base.xml b/tests/dictionaries/20family_dynamic_number/00-base.xml index b085ce9c..d13b3552 100644 --- a/tests/dictionaries/20family_dynamic_number/00-base.xml +++ b/tests/dictionaries/20family_dynamic_number/00-base.xml @@ -1,6 +1,6 @@ - + @@ -18,8 +18,9 @@ - + vardyn1 + newvar diff --git a/tests/dictionaries/20family_dynamic_number/makedict/after.json b/tests/dictionaries/20family_dynamic_number/makedict/after.json new file mode 100644 index 00000000..b180d807 --- /dev/null +++ b/tests/dictionaries/20family_dynamic_number/makedict/after.json @@ -0,0 +1,21 @@ +{ + "rougail.general.varname": { + "owner": "default", + "value": [ + 1, + 2 + ] + }, + "rougail.dyn1.vardyn1": { + "owner": "default", + "value": "val" + }, + "rougail.dyn2.vardyn2": { + "owner": "default", + "value": "val" + }, + "rougail.new.newvar": { + "owner": "default", + "value": "val" + } +} diff --git a/tests/dictionaries/20family_dynamic_number/makedict/base.json b/tests/dictionaries/20family_dynamic_number/makedict/base.json index ceae633c..3ba060bb 100644 --- a/tests/dictionaries/20family_dynamic_number/makedict/base.json +++ b/tests/dictionaries/20family_dynamic_number/makedict/base.json @@ -1 +1,9 @@ -{"rougail.general.varname": [1, 2], "rougail.dyn1.vardyn1": "val", "rougail.dyn2.vardyn2": "val", "rougail.new.newvar": "val"} +{ + "rougail.general.varname": [ + 1, + 2 + ], + "rougail.dyn1.vardyn1": "val", + "rougail.dyn2.vardyn2": "val", + "rougail.new.newvar": "val" +} diff --git a/tests/dictionaries/20family_dynamic_number/makedict/before.json b/tests/dictionaries/20family_dynamic_number/makedict/before.json new file mode 100644 index 00000000..b180d807 --- /dev/null +++ b/tests/dictionaries/20family_dynamic_number/makedict/before.json @@ -0,0 +1,21 @@ +{ + "rougail.general.varname": { + "owner": "default", + "value": [ + 1, + 2 + ] + }, + "rougail.dyn1.vardyn1": { + "owner": "default", + "value": "val" + }, + "rougail.dyn2.vardyn2": { + "owner": "default", + "value": "val" + }, + "rougail.new.newvar": { + "owner": "default", + "value": "val" + } +} diff --git a/tests/dictionaries/20family_dynamic_number/tiramisu/base.py b/tests/dictionaries/20family_dynamic_number/tiramisu/base.py index 720caec3..6f1ba49e 100644 --- a/tests/dictionaries/20family_dynamic_number/tiramisu/base.py +++ b/tests/dictionaries/20family_dynamic_number/tiramisu/base.py @@ -1,18 +1,22 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * from rougail.tiramisu import ConvertDynOptionDescription -option_3 = IntOption(properties=frozenset({'mandatory', 'normal'}), name='varname', doc='No change', multi=True, default=[1, 2], default_multi=2) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3]) -option_5 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='vardyn', doc='No change', multi=False, default='val') -option_4 = ConvertDynOptionDescription(name='dyn', doc='dyn', suffixes=Calculation(func.calc_value, Params((ParamOption(option_3)))), properties=frozenset({'normal'}), children=[option_5]) -option_7 = StrOption(properties=frozenset({'normal'}), name='newvar', doc='No change', multi=False, default=Calculation(func.calc_val, Params((ParamDynOption(option_5, '1', option_4, notraisepropertyerror=False, todict=False)), kwargs={}))) -option_6 = OptionDescription(name='new', doc='new', properties=frozenset({'normal'}), children=[option_7]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2, option_4, option_6]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = IntOption(name="varname", doc="No change", multi=True, default=[1, 2], default_multi=1, properties=frozenset({"mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) +option_5 = StrOption(name="vardyn", doc="No change", default="val", properties=frozenset({"mandatory", "normal"})) +option_4 = ConvertDynOptionDescription(name="dyn", doc="dyn", suffixes=Calculation(func.calc_value, Params((ParamOption(option_3, notraisepropertyerror=True)))), children=[option_5], properties=frozenset({"normal"})) +option_7 = StrOption(name="newvar", doc="No change", default=Calculation(func.calc_val, Params((ParamDynOption(option_5, '1', option_4)))), properties=frozenset({"normal"})) +option_6 = OptionDescription(name="new", doc="new", children=[option_7], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4, option_6]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/20family_empty/00-base.xml b/tests/dictionaries/20family_empty/00-base.xml index 5d9d7073..ee74f399 100644 --- a/tests/dictionaries/20family_empty/00-base.xml +++ b/tests/dictionaries/20family_empty/00-base.xml @@ -1,25 +1,13 @@ - - - - + - + non - - + - - - - - - family - - diff --git a/tests/dictionaries/20family_empty/makedict/after.json b/tests/dictionaries/20family_empty/makedict/after.json new file mode 100644 index 00000000..2e6c541d --- /dev/null +++ b/tests/dictionaries/20family_empty/makedict/after.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/20family_empty/makedict/base.json b/tests/dictionaries/20family_empty/makedict/base.json index 797595b0..25056378 100644 --- a/tests/dictionaries/20family_empty/makedict/base.json +++ b/tests/dictionaries/20family_empty/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "non"} +{ + "rougail.general.mode_conteneur_actif": "non" +} diff --git a/tests/dictionaries/20family_empty/makedict/before.json b/tests/dictionaries/20family_empty/makedict/before.json new file mode 100644 index 00000000..2e6c541d --- /dev/null +++ b/tests/dictionaries/20family_empty/makedict/before.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/20family_empty/tiramisu/base.py b/tests/dictionaries/20family_empty/tiramisu/base.py index f630040e..bcff5670 100644 --- a/tests/dictionaries/20family_empty/tiramisu/base.py +++ b/tests/dictionaries/20family_empty/tiramisu/base.py @@ -1,14 +1,17 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'basic', 'mandatory'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'basic'}), children=[option_3]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"basic", "mandatory"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"basic"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/20family_hidden/00-base.xml b/tests/dictionaries/20family_hidden/00-base.xml index 9941bac4..0e6d4337 100644 --- a/tests/dictionaries/20family_hidden/00-base.xml +++ b/tests/dictionaries/20family_hidden/00-base.xml @@ -1,22 +1,12 @@ - - - - + - - - - - - - - diff --git a/tests/dictionaries/20family_hidden/01-base.xml b/tests/dictionaries/20family_hidden/01-base.xml index 53f82a9e..f8ae611f 100644 --- a/tests/dictionaries/20family_hidden/01-base.xml +++ b/tests/dictionaries/20family_hidden/01-base.xml @@ -1,16 +1,6 @@ - - - - + - - - - - - diff --git a/tests/dictionaries/20family_hidden/makedict/after.json b/tests/dictionaries/20family_hidden/makedict/after.json new file mode 100644 index 00000000..2e6c541d --- /dev/null +++ b/tests/dictionaries/20family_hidden/makedict/after.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/20family_hidden/makedict/base.json b/tests/dictionaries/20family_hidden/makedict/base.json index 797595b0..25056378 100644 --- a/tests/dictionaries/20family_hidden/makedict/base.json +++ b/tests/dictionaries/20family_hidden/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "non"} +{ + "rougail.general.mode_conteneur_actif": "non" +} diff --git a/tests/dictionaries/20family_hidden/makedict/before.json b/tests/dictionaries/20family_hidden/makedict/before.json new file mode 100644 index 00000000..2e6c541d --- /dev/null +++ b/tests/dictionaries/20family_hidden/makedict/before.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/20family_hidden/tiramisu/base.py b/tests/dictionaries/20family_hidden/tiramisu/base.py index 28d0cf25..3660de89 100644 --- a/tests/dictionaries/20family_hidden/tiramisu/base.py +++ b/tests/dictionaries/20family_hidden/tiramisu/base.py @@ -1,14 +1,17 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'hidden', 'normal'}), children=[option_3]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"hidden", "normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/20family_mode/00-base.xml b/tests/dictionaries/20family_mode/00-base.xml index 74c33e51..20053c69 100644 --- a/tests/dictionaries/20family_mode/00-base.xml +++ b/tests/dictionaries/20family_mode/00-base.xml @@ -1,22 +1,12 @@ - - - - + - + non - - - - - - - diff --git a/tests/dictionaries/20family_mode/makedict/after.json b/tests/dictionaries/20family_mode/makedict/after.json new file mode 100644 index 00000000..2e6c541d --- /dev/null +++ b/tests/dictionaries/20family_mode/makedict/after.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/20family_mode/makedict/base.json b/tests/dictionaries/20family_mode/makedict/base.json index 797595b0..25056378 100644 --- a/tests/dictionaries/20family_mode/makedict/base.json +++ b/tests/dictionaries/20family_mode/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "non"} +{ + "rougail.general.mode_conteneur_actif": "non" +} diff --git a/tests/dictionaries/20family_mode/makedict/before.json b/tests/dictionaries/20family_mode/makedict/before.json new file mode 100644 index 00000000..2e6c541d --- /dev/null +++ b/tests/dictionaries/20family_mode/makedict/before.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/20family_mode/tiramisu/base.py b/tests/dictionaries/20family_mode/tiramisu/base.py index f630040e..bcff5670 100644 --- a/tests/dictionaries/20family_mode/tiramisu/base.py +++ b/tests/dictionaries/20family_mode/tiramisu/base.py @@ -1,14 +1,17 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'basic', 'mandatory'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'basic'}), children=[option_3]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"basic", "mandatory"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"basic"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/20family_modeleadership/00-base.xml b/tests/dictionaries/20family_modeleadership/00-base.xml index a52b1256..890996b4 100644 --- a/tests/dictionaries/20family_modeleadership/00-base.xml +++ b/tests/dictionaries/20family_modeleadership/00-base.xml @@ -1,18 +1,14 @@ - - - - + - + non - @@ -21,9 +17,6 @@ follower2 - - - diff --git a/tests/dictionaries/20family_modeleadership/makedict/after.json b/tests/dictionaries/20family_modeleadership/makedict/after.json new file mode 100644 index 00000000..dd62b980 --- /dev/null +++ b/tests/dictionaries/20family_modeleadership/makedict/after.json @@ -0,0 +1,18 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.leader.leader": { + "owner": "default", + "value": [] + }, + "rougail.general.leader.follower1": { + "owner": [], + "value": [] + }, + "rougail.general.leader.follower2": { + "owner": [], + "value": [] + } +} diff --git a/tests/dictionaries/20family_modeleadership/makedict/base.json b/tests/dictionaries/20family_modeleadership/makedict/base.json index 3ff8a0ae..9031a92a 100644 --- a/tests/dictionaries/20family_modeleadership/makedict/base.json +++ b/tests/dictionaries/20family_modeleadership/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.leader.leader": [], "rougail.general.leader.follower1": [], "rougail.general.leader.follower2": []} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.leader.leader": [] +} diff --git a/tests/dictionaries/20family_modeleadership/makedict/before.json b/tests/dictionaries/20family_modeleadership/makedict/before.json new file mode 100644 index 00000000..dd62b980 --- /dev/null +++ b/tests/dictionaries/20family_modeleadership/makedict/before.json @@ -0,0 +1,18 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.leader.leader": { + "owner": "default", + "value": [] + }, + "rougail.general.leader.follower1": { + "owner": [], + "value": [] + }, + "rougail.general.leader.follower2": { + "owner": [], + "value": [] + } +} diff --git a/tests/dictionaries/20family_modeleadership/tiramisu/base.py b/tests/dictionaries/20family_modeleadership/tiramisu/base.py index 5ee6c9fc..28e3a12f 100644 --- a/tests/dictionaries/20family_modeleadership/tiramisu/base.py +++ b/tests/dictionaries/20family_modeleadership/tiramisu/base.py @@ -1,18 +1,21 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_5 = StrOption(name='leader', doc='leader', multi=True) -option_6 = StrOption(properties=frozenset({'normal'}), name='follower1', doc='follower1', multi=True) -option_7 = StrOption(properties=frozenset({'normal'}), name='follower2', doc='follower2', multi=True) -option_4 = Leadership(name='leader', doc='leader', properties=frozenset({'normal'}), children=[option_5, option_6, option_7]) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_5 = StrOption(name="leader", doc="leader", multi=True) +option_6 = StrOption(name="follower1", doc="follower1", multi=True, properties=frozenset({"normal"})) +option_7 = StrOption(name="follower2", doc="follower2", multi=True, properties=frozenset({"basic"})) +option_4 = Leadership(name="leader", doc="leader", children=[option_5, option_6, option_7], properties=frozenset({"basic"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"basic"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/20notemplating/00-base.xml b/tests/dictionaries/20notemplating/00-base.xml index e77aea14..67637a50 100644 --- a/tests/dictionaries/20notemplating/00-base.xml +++ b/tests/dictionaries/20notemplating/00-base.xml @@ -1,19 +1,18 @@ - + - + /etc/file - + non - diff --git a/tests/dictionaries/10load_frozenifin/tiramisu/__init__.py b/tests/dictionaries/20override_no_templating/__init__.py similarity index 100% rename from tests/dictionaries/10load_frozenifin/tiramisu/__init__.py rename to tests/dictionaries/20override_no_templating/__init__.py diff --git a/tests/dictionaries/20override_no_templating/makedict/after.json b/tests/dictionaries/20override_no_templating/makedict/after.json new file mode 100644 index 00000000..07d00ab9 --- /dev/null +++ b/tests/dictionaries/20override_no_templating/makedict/after.json @@ -0,0 +1,30 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "services.test.overrides.test_service.engine": { + "owner": "default", + "value": "none" + }, + "services.test.overrides.test_service.name": { + "owner": "default", + "value": "test" + }, + "services.test.overrides.test_service.source": { + "owner": "default", + "value": "test.service" + }, + "services.test.overrides.test_service.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/20override_no_templating/makedict/base.json b/tests/dictionaries/20override_no_templating/makedict/base.json new file mode 100644 index 00000000..82581028 --- /dev/null +++ b/tests/dictionaries/20override_no_templating/makedict/base.json @@ -0,0 +1,9 @@ +{ + "rougail.general.mode_conteneur_actif": "non", + "services.test.overrides.test_service.engine": "none", + "services.test.overrides.test_service.name": "test", + "services.test.overrides.test_service.source": "test.service", + "services.test.overrides.test_service.activate": true, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/20override_no_templating/makedict/before.json b/tests/dictionaries/20override_no_templating/makedict/before.json new file mode 100644 index 00000000..07d00ab9 --- /dev/null +++ b/tests/dictionaries/20override_no_templating/makedict/before.json @@ -0,0 +1,30 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "services.test.overrides.test_service.engine": { + "owner": "default", + "value": "none" + }, + "services.test.overrides.test_service.name": { + "owner": "default", + "value": "test" + }, + "services.test.overrides.test_service.source": { + "owner": "default", + "value": "test.service" + }, + "services.test.overrides.test_service.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/20override_no_templating/result/systemd/system/test.service.d/rougail.conf b/tests/dictionaries/20override_no_templating/result/systemd/system/test.service.d/rougail.conf new file mode 100644 index 00000000..a29cfeaf --- /dev/null +++ b/tests/dictionaries/20override_no_templating/result/systemd/system/test.service.d/rougail.conf @@ -0,0 +1 @@ +%%mode_conteneur_actif diff --git a/tests/dictionaries/10load_frozenifin_auto/tiramisu/__init__.py b/tests/dictionaries/20override_no_templating/result/tmpfiles.d/rougail.conf similarity index 100% rename from tests/dictionaries/10load_frozenifin_auto/tiramisu/__init__.py rename to tests/dictionaries/20override_no_templating/result/tmpfiles.d/rougail.conf diff --git a/tests/dictionaries/20override_no_templating/tiramisu/base.py b/tests/dictionaries/20override_no_templating/tiramisu/base.py new file mode 100644 index 00000000..3de45df9 --- /dev/null +++ b/tests/dictionaries/20override_no_templating/tiramisu/base.py @@ -0,0 +1,27 @@ +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_8 = StrOption(name="engine", doc="engine", default="none") +option_9 = StrOption(name="name", doc="name", default="test") +option_10 = StrOption(name="source", doc="source", default="test.service") +option_11 = BoolOption(name="activate", doc="activate", default=True) +option_7 = OptionDescription(name="test_service", doc="test.service", children=[option_8, option_9, option_10, option_11]) +option_6 = OptionDescription(name="overrides", doc="overrides", children=[option_7]) +option_12 = BoolOption(name="activate", doc="activate", default=True) +option_13 = BoolOption(name="manage", doc="manage", default=True) +option_5 = OptionDescription(name="test", doc="test", children=[option_6, option_12, option_13]) +option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/20override_no_templating/tmpl/test.service b/tests/dictionaries/20override_no_templating/tmpl/test.service new file mode 100644 index 00000000..a29cfeaf --- /dev/null +++ b/tests/dictionaries/20override_no_templating/tmpl/test.service @@ -0,0 +1 @@ +%%mode_conteneur_actif diff --git a/tests/dictionaries/20override_source/00-base.xml b/tests/dictionaries/20override_source/00-base.xml new file mode 100644 index 00000000..50ada9d0 --- /dev/null +++ b/tests/dictionaries/20override_source/00-base.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + non + + + + + diff --git a/tests/dictionaries/10load_frozenifin_multiparam/tiramisu/__init__.py b/tests/dictionaries/20override_source/__init__.py similarity index 100% rename from tests/dictionaries/10load_frozenifin_multiparam/tiramisu/__init__.py rename to tests/dictionaries/20override_source/__init__.py diff --git a/tests/dictionaries/20override_source/makedict/after.json b/tests/dictionaries/20override_source/makedict/after.json new file mode 100644 index 00000000..dbc42c12 --- /dev/null +++ b/tests/dictionaries/20override_source/makedict/after.json @@ -0,0 +1,30 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "services.test.overrides.test2_service.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.overrides.test2_service.name": { + "owner": "default", + "value": "test" + }, + "services.test.overrides.test2_service.source": { + "owner": "default", + "value": "test2.service" + }, + "services.test.overrides.test2_service.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/20override_source/makedict/base.json b/tests/dictionaries/20override_source/makedict/base.json new file mode 100644 index 00000000..0856e35c --- /dev/null +++ b/tests/dictionaries/20override_source/makedict/base.json @@ -0,0 +1,9 @@ +{ + "rougail.general.mode_conteneur_actif": "non", + "services.test.overrides.test2_service.engine": "creole", + "services.test.overrides.test2_service.name": "test", + "services.test.overrides.test2_service.source": "test2.service", + "services.test.overrides.test2_service.activate": true, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/20override_source/makedict/before.json b/tests/dictionaries/20override_source/makedict/before.json new file mode 100644 index 00000000..dbc42c12 --- /dev/null +++ b/tests/dictionaries/20override_source/makedict/before.json @@ -0,0 +1,30 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "services.test.overrides.test2_service.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.overrides.test2_service.name": { + "owner": "default", + "value": "test" + }, + "services.test.overrides.test2_service.source": { + "owner": "default", + "value": "test2.service" + }, + "services.test.overrides.test2_service.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/20override_source/result/systemd/system/test.service.d/rougail.conf b/tests/dictionaries/20override_source/result/systemd/system/test.service.d/rougail.conf new file mode 100644 index 00000000..d907505b --- /dev/null +++ b/tests/dictionaries/20override_source/result/systemd/system/test.service.d/rougail.conf @@ -0,0 +1 @@ +non diff --git a/tests/dictionaries/10load_frozenifin_noexist/tiramisu/__init__.py b/tests/dictionaries/20override_source/result/tmpfiles.d/rougail.conf similarity index 100% rename from tests/dictionaries/10load_frozenifin_noexist/tiramisu/__init__.py rename to tests/dictionaries/20override_source/result/tmpfiles.d/rougail.conf diff --git a/tests/dictionaries/20override_source/tiramisu/base.py b/tests/dictionaries/20override_source/tiramisu/base.py new file mode 100644 index 00000000..4e7dcc66 --- /dev/null +++ b/tests/dictionaries/20override_source/tiramisu/base.py @@ -0,0 +1,27 @@ +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_8 = StrOption(name="engine", doc="engine", default="creole") +option_9 = StrOption(name="name", doc="name", default="test") +option_10 = StrOption(name="source", doc="source", default="test2.service") +option_11 = BoolOption(name="activate", doc="activate", default=True) +option_7 = OptionDescription(name="test2_service", doc="test2.service", children=[option_8, option_9, option_10, option_11]) +option_6 = OptionDescription(name="overrides", doc="overrides", children=[option_7]) +option_12 = BoolOption(name="activate", doc="activate", default=True) +option_13 = BoolOption(name="manage", doc="manage", default=True) +option_5 = OptionDescription(name="test", doc="test", children=[option_6, option_12, option_13]) +option_4 = OptionDescription(name="services", doc="services", children=[option_5], properties=frozenset({"hidden"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/20override_source/tmpl/test2.service b/tests/dictionaries/20override_source/tmpl/test2.service new file mode 100644 index 00000000..a29cfeaf --- /dev/null +++ b/tests/dictionaries/20override_source/tmpl/test2.service @@ -0,0 +1 @@ +%%mode_conteneur_actif diff --git a/tests/dictionaries/21family_change/00-base.xml b/tests/dictionaries/21family_change/00-base.xml deleted file mode 100644 index 8ac2b7b2..00000000 --- a/tests/dictionaries/21family_change/00-base.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/tests/dictionaries/21family_change/01-base.xml b/tests/dictionaries/21family_change/01-base.xml deleted file mode 100644 index 10433943..00000000 --- a/tests/dictionaries/21family_change/01-base.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - non - - - - - - - - - - - diff --git a/tests/dictionaries/21family_change/makedict/base.json b/tests/dictionaries/21family_change/makedict/base.json deleted file mode 100644 index 40871a66..00000000 --- a/tests/dictionaries/21family_change/makedict/base.json +++ /dev/null @@ -1 +0,0 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.other.mode_conteneur_actif1": "non"} diff --git a/tests/dictionaries/21family_change/tiramisu/base.py b/tests/dictionaries/21family_change/tiramisu/base.py deleted file mode 100644 index 15f9ae1c..00000000 --- a/tests/dictionaries/21family_change/tiramisu/base.py +++ /dev/null @@ -1,16 +0,0 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') -for key, value in dict(locals()).items(): - if key != ['imp', 'func']: - setattr(func, key, value) -try: - from tiramisu3 import * -except: - from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3]) -option_5 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif1', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_4 = OptionDescription(name='other', doc='other', properties=frozenset({'normal'}), children=[option_5]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2, option_4]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) diff --git a/tests/dictionaries/21family_changeaccent/00-base.xml b/tests/dictionaries/21family_changeaccent/00-base.xml deleted file mode 100644 index 9c3c9676..00000000 --- a/tests/dictionaries/21family_changeaccent/00-base.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/tests/dictionaries/21family_changeaccent/01-base.xml b/tests/dictionaries/21family_changeaccent/01-base.xml deleted file mode 100644 index 5ba9b1f6..00000000 --- a/tests/dictionaries/21family_changeaccent/01-base.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - non - - - - - - - - - - - diff --git a/tests/dictionaries/21family_changeaccent/makedict/base.json b/tests/dictionaries/21family_changeaccent/makedict/base.json deleted file mode 100644 index ef4e8007..00000000 --- a/tests/dictionaries/21family_changeaccent/makedict/base.json +++ /dev/null @@ -1 +0,0 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.otherwithe.mode_conteneur_actif1": "non"} diff --git a/tests/dictionaries/21family_changeaccent/tiramisu/base.py b/tests/dictionaries/21family_changeaccent/tiramisu/base.py deleted file mode 100644 index da65accc..00000000 --- a/tests/dictionaries/21family_changeaccent/tiramisu/base.py +++ /dev/null @@ -1,16 +0,0 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') -for key, value in dict(locals()).items(): - if key != ['imp', 'func']: - setattr(func, key, value) -try: - from tiramisu3 import * -except: - from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='Général', properties=frozenset({'normal'}), children=[option_3]) -option_5 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif1', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_4 = OptionDescription(name='otherwithe', doc='Otherwithé', properties=frozenset({'normal'}), children=[option_5]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2, option_4]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) diff --git a/tests/dictionaries/21family_empty/00-base.xml b/tests/dictionaries/21family_empty/00-base.xml index 39654c7d..64d577b0 100644 --- a/tests/dictionaries/21family_empty/00-base.xml +++ b/tests/dictionaries/21family_empty/00-base.xml @@ -1,24 +1,14 @@ - - - - + - + non - - - - - - - diff --git a/tests/dictionaries/21family_empty/makedict/after.json b/tests/dictionaries/21family_empty/makedict/after.json new file mode 100644 index 00000000..2e6c541d --- /dev/null +++ b/tests/dictionaries/21family_empty/makedict/after.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/21family_empty/makedict/base.json b/tests/dictionaries/21family_empty/makedict/base.json index 797595b0..25056378 100644 --- a/tests/dictionaries/21family_empty/makedict/base.json +++ b/tests/dictionaries/21family_empty/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "non"} +{ + "rougail.general.mode_conteneur_actif": "non" +} diff --git a/tests/dictionaries/21family_empty/makedict/before.json b/tests/dictionaries/21family_empty/makedict/before.json new file mode 100644 index 00000000..2e6c541d --- /dev/null +++ b/tests/dictionaries/21family_empty/makedict/before.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/21family_empty/tiramisu/base.py b/tests/dictionaries/21family_empty/tiramisu/base.py index f8ee0799..9bdad808 100644 --- a/tests/dictionaries/21family_empty/tiramisu/base.py +++ b/tests/dictionaries/21family_empty/tiramisu/base.py @@ -1,14 +1,17 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/30mandatory_withoutvalue/00-base.xml b/tests/dictionaries/30mandatory_withoutvalue/00-base.xml index b4231102..301f4e9f 100644 --- a/tests/dictionaries/30mandatory_withoutvalue/00-base.xml +++ b/tests/dictionaries/30mandatory_withoutvalue/00-base.xml @@ -1,20 +1,10 @@ - - - - + - - - - - - - diff --git a/tests/dictionaries/30mandatory_withoutvalue/makedict/after.json b/tests/dictionaries/30mandatory_withoutvalue/makedict/after.json new file mode 100644 index 00000000..da5b8acc --- /dev/null +++ b/tests/dictionaries/30mandatory_withoutvalue/makedict/after.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/30mandatory_withoutvalue/makedict/base.json b/tests/dictionaries/30mandatory_withoutvalue/makedict/base.json index dc0cf526..ab81a62f 100644 --- a/tests/dictionaries/30mandatory_withoutvalue/makedict/base.json +++ b/tests/dictionaries/30mandatory_withoutvalue/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": null} +{ + "rougail.general.mode_conteneur_actif": null +} diff --git a/tests/dictionaries/30mandatory_withoutvalue/makedict/before.json b/tests/dictionaries/30mandatory_withoutvalue/makedict/before.json new file mode 100644 index 00000000..da5b8acc --- /dev/null +++ b/tests/dictionaries/30mandatory_withoutvalue/makedict/before.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/30mandatory_withoutvalue/tiramisu/base.py b/tests/dictionaries/30mandatory_withoutvalue/tiramisu/base.py index ccd638ed..8e5568f1 100644 --- a/tests/dictionaries/30mandatory_withoutvalue/tiramisu/base.py +++ b/tests/dictionaries/30mandatory_withoutvalue/tiramisu/base.py @@ -1,14 +1,17 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = StrOption(properties=frozenset({'basic', 'mandatory'}), name='mode_conteneur_actif', doc='No change', multi=False) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'basic'}), children=[option_3]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", properties=frozenset({"basic", "mandatory"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"basic"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/30mandatory_withoutvaluecalc/00-base.xml b/tests/dictionaries/30mandatory_withoutvaluecalc/00-base.xml new file mode 100644 index 00000000..cff37ba5 --- /dev/null +++ b/tests/dictionaries/30mandatory_withoutvaluecalc/00-base.xml @@ -0,0 +1,16 @@ + + + + + + + + + value + mode_conteneur_actif + + + + diff --git a/tests/dictionaries/30mandatory_withoutvaluecalc/makedict/after.json b/tests/dictionaries/30mandatory_withoutvaluecalc/makedict/after.json new file mode 100644 index 00000000..6f4a21e7 --- /dev/null +++ b/tests/dictionaries/30mandatory_withoutvaluecalc/makedict/after.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "value" + } +} diff --git a/tests/dictionaries/30mandatory_withoutvaluecalc/makedict/base.json b/tests/dictionaries/30mandatory_withoutvaluecalc/makedict/base.json new file mode 100644 index 00000000..904ffb4e --- /dev/null +++ b/tests/dictionaries/30mandatory_withoutvaluecalc/makedict/base.json @@ -0,0 +1,3 @@ +{ + "rougail.general.mode_conteneur_actif": "value" +} diff --git a/tests/dictionaries/30mandatory_withoutvaluecalc/makedict/before.json b/tests/dictionaries/30mandatory_withoutvaluecalc/makedict/before.json new file mode 100644 index 00000000..6f4a21e7 --- /dev/null +++ b/tests/dictionaries/30mandatory_withoutvaluecalc/makedict/before.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "value" + } +} diff --git a/tests/dictionaries/30mandatory_withoutvaluecalc/tiramisu/base.py b/tests/dictionaries/30mandatory_withoutvaluecalc/tiramisu/base.py index adf637ed..71762e7c 100644 --- a/tests/dictionaries/30mandatory_withoutvaluecalc/tiramisu/base.py +++ b/tests/dictionaries/30mandatory_withoutvaluecalc/tiramisu/base.py @@ -1,11 +1,17 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamValue("value")))), properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/30mandatory_withvalue/00-base.xml b/tests/dictionaries/30mandatory_withvalue/00-base.xml index fcc28536..8cb1d841 100644 --- a/tests/dictionaries/30mandatory_withvalue/00-base.xml +++ b/tests/dictionaries/30mandatory_withvalue/00-base.xml @@ -1,20 +1,10 @@ - - - - + value - - - - - - - diff --git a/tests/dictionaries/30mandatory_withvalue/makedict/after.json b/tests/dictionaries/30mandatory_withvalue/makedict/after.json new file mode 100644 index 00000000..6f4a21e7 --- /dev/null +++ b/tests/dictionaries/30mandatory_withvalue/makedict/after.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "value" + } +} diff --git a/tests/dictionaries/30mandatory_withvalue/makedict/base.json b/tests/dictionaries/30mandatory_withvalue/makedict/base.json index 5f62f349..904ffb4e 100644 --- a/tests/dictionaries/30mandatory_withvalue/makedict/base.json +++ b/tests/dictionaries/30mandatory_withvalue/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "value"} +{ + "rougail.general.mode_conteneur_actif": "value" +} diff --git a/tests/dictionaries/30mandatory_withvalue/makedict/before.json b/tests/dictionaries/30mandatory_withvalue/makedict/before.json new file mode 100644 index 00000000..6f4a21e7 --- /dev/null +++ b/tests/dictionaries/30mandatory_withvalue/makedict/before.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "value" + } +} diff --git a/tests/dictionaries/30mandatory_withvalue/tiramisu/base.py b/tests/dictionaries/30mandatory_withvalue/tiramisu/base.py index 332169bc..abe968b4 100644 --- a/tests/dictionaries/30mandatory_withvalue/tiramisu/base.py +++ b/tests/dictionaries/30mandatory_withvalue/tiramisu/base.py @@ -1,14 +1,17 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='value') -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="value", properties=frozenset({"mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/30mandatory_withvaluecalc/00-base.xml b/tests/dictionaries/30mandatory_withvaluecalc/00-base.xml new file mode 100644 index 00000000..49605379 --- /dev/null +++ b/tests/dictionaries/30mandatory_withvaluecalc/00-base.xml @@ -0,0 +1,14 @@ + + + + + + + + + + value + mode_conteneur_actif + + + diff --git a/tests/dictionaries/30mandatory_withvaluecalc/makedict/after.json b/tests/dictionaries/30mandatory_withvaluecalc/makedict/after.json new file mode 100644 index 00000000..6f4a21e7 --- /dev/null +++ b/tests/dictionaries/30mandatory_withvaluecalc/makedict/after.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "value" + } +} diff --git a/tests/dictionaries/30mandatory_withvaluecalc/makedict/base.json b/tests/dictionaries/30mandatory_withvaluecalc/makedict/base.json index 0967ef42..904ffb4e 100644 --- a/tests/dictionaries/30mandatory_withvaluecalc/makedict/base.json +++ b/tests/dictionaries/30mandatory_withvaluecalc/makedict/base.json @@ -1 +1,3 @@ -{} +{ + "rougail.general.mode_conteneur_actif": "value" +} diff --git a/tests/dictionaries/30mandatory_withvaluecalc/makedict/before.json b/tests/dictionaries/30mandatory_withvaluecalc/makedict/before.json new file mode 100644 index 00000000..6f4a21e7 --- /dev/null +++ b/tests/dictionaries/30mandatory_withvaluecalc/makedict/before.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "value" + } +} diff --git a/tests/dictionaries/30mandatory_withvaluecalc/tiramisu/base.py b/tests/dictionaries/30mandatory_withvaluecalc/tiramisu/base.py index adf637ed..746f4317 100644 --- a/tests/dictionaries/30mandatory_withvaluecalc/tiramisu/base.py +++ b/tests/dictionaries/30mandatory_withvaluecalc/tiramisu/base.py @@ -1,11 +1,17 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.calc_val, Params((ParamValue("value")))), properties=frozenset({"normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/40condition_base/00-base.xml b/tests/dictionaries/40condition_base/00-base.xml index fe19e698..3136dfdb 100644 --- a/tests/dictionaries/40condition_base/00-base.xml +++ b/tests/dictionaries/40condition_base/00-base.xml @@ -1,36 +1,29 @@ - - - - + - + non - + non - + non - + non - - + oui mode_conteneur_actif1 mode_conteneur_actif2 - - - diff --git a/tests/dictionaries/40condition_base/makedict/after.json b/tests/dictionaries/40condition_base/makedict/after.json new file mode 100644 index 00000000..c1303c5d --- /dev/null +++ b/tests/dictionaries/40condition_base/makedict/after.json @@ -0,0 +1,18 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.condition": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif1": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif2": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/40condition_base/makedict/base.json b/tests/dictionaries/40condition_base/makedict/base.json index ee42ef2d..e21c64e6 100644 --- a/tests/dictionaries/40condition_base/makedict/base.json +++ b/tests/dictionaries/40condition_base/makedict/base.json @@ -1 +1,6 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.condition": "non", "rougail.general.mode_conteneur_actif1": "non", "rougail.general.mode_conteneur_actif2": "non"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.condition": "non", + "rougail.general.mode_conteneur_actif1": "non", + "rougail.general.mode_conteneur_actif2": "non" +} diff --git a/tests/dictionaries/40condition_base/makedict/before.json b/tests/dictionaries/40condition_base/makedict/before.json new file mode 100644 index 00000000..c1303c5d --- /dev/null +++ b/tests/dictionaries/40condition_base/makedict/before.json @@ -0,0 +1,18 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.condition": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif1": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif2": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/40condition_base/tiramisu/base.py b/tests/dictionaries/40condition_base/tiramisu/base.py index a625bf05..5db66c79 100644 --- a/tests/dictionaries/40condition_base/tiramisu/base.py +++ b/tests/dictionaries/40condition_base/tiramisu/base.py @@ -1,17 +1,20 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='condition', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_5 = ChoiceOption(properties=frozenset({'mandatory', 'normal', Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue('oui')}))}), name='mode_conteneur_actif1', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_6 = ChoiceOption(properties=frozenset({'mandatory', 'normal', Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue('oui')}))}), name='mode_conteneur_actif2', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5, option_6]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_4 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_5 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")}))})) +option_6 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")}))})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5, option_6], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/40condition_base_add/00-base.xml b/tests/dictionaries/40condition_base_add/00-base.xml new file mode 100644 index 00000000..3136dfdb --- /dev/null +++ b/tests/dictionaries/40condition_base_add/00-base.xml @@ -0,0 +1,29 @@ + + + + + + non + + + non + + + non + + + non + + + + + + + oui + mode_conteneur_actif1 + mode_conteneur_actif2 + + + + diff --git a/tests/dictionaries/40condition_base_add/01-base.xml b/tests/dictionaries/40condition_base_add/01-base.xml new file mode 100644 index 00000000..3218d12b --- /dev/null +++ b/tests/dictionaries/40condition_base_add/01-base.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + oui + mode_conteneur_actif1 + mode_conteneur_actif2 + + + + + diff --git a/tests/dictionaries/10load_hidden_if_family/tiramisu/__init__.py b/tests/dictionaries/40condition_base_add/__init__.py similarity index 100% rename from tests/dictionaries/10load_hidden_if_family/tiramisu/__init__.py rename to tests/dictionaries/40condition_base_add/__init__.py diff --git a/tests/dictionaries/40condition_base_add/makedict/after.json b/tests/dictionaries/40condition_base_add/makedict/after.json new file mode 100644 index 00000000..c1303c5d --- /dev/null +++ b/tests/dictionaries/40condition_base_add/makedict/after.json @@ -0,0 +1,18 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.condition": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif1": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif2": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/40condition_base_add/makedict/base.json b/tests/dictionaries/40condition_base_add/makedict/base.json new file mode 100644 index 00000000..e21c64e6 --- /dev/null +++ b/tests/dictionaries/40condition_base_add/makedict/base.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.condition": "non", + "rougail.general.mode_conteneur_actif1": "non", + "rougail.general.mode_conteneur_actif2": "non" +} diff --git a/tests/dictionaries/40condition_base_add/makedict/before.json b/tests/dictionaries/40condition_base_add/makedict/before.json new file mode 100644 index 00000000..c1303c5d --- /dev/null +++ b/tests/dictionaries/40condition_base_add/makedict/before.json @@ -0,0 +1,18 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.condition": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif1": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif2": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/40condition_base_add/tiramisu/base.py b/tests/dictionaries/40condition_base_add/tiramisu/base.py new file mode 100644 index 00000000..5db66c79 --- /dev/null +++ b/tests/dictionaries/40condition_base_add/tiramisu/base.py @@ -0,0 +1,20 @@ +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_4 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_5 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")}))})) +option_6 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")}))})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5, option_6], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/40condition_fallback/00-base.xml b/tests/dictionaries/40condition_fallback/00-base.xml index f2f042ac..8c7ae0ba 100644 --- a/tests/dictionaries/40condition_fallback/00-base.xml +++ b/tests/dictionaries/40condition_fallback/00-base.xml @@ -1,39 +1,32 @@ - - - - + - + non - + non - + non - + non - - + oui mode_conteneur_actif1 mode_conteneur_actif2 disabled_family - - - diff --git a/tests/dictionaries/40condition_fallback/makedict/after.json b/tests/dictionaries/40condition_fallback/makedict/after.json new file mode 100644 index 00000000..2e6c541d --- /dev/null +++ b/tests/dictionaries/40condition_fallback/makedict/after.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/40condition_fallback/makedict/base.json b/tests/dictionaries/40condition_fallback/makedict/base.json index 797595b0..25056378 100644 --- a/tests/dictionaries/40condition_fallback/makedict/base.json +++ b/tests/dictionaries/40condition_fallback/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "non"} +{ + "rougail.general.mode_conteneur_actif": "non" +} diff --git a/tests/dictionaries/40condition_fallback/makedict/before.json b/tests/dictionaries/40condition_fallback/makedict/before.json new file mode 100644 index 00000000..2e6c541d --- /dev/null +++ b/tests/dictionaries/40condition_fallback/makedict/before.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/40condition_fallback/tiramisu/base.py b/tests/dictionaries/40condition_fallback/tiramisu/base.py index 97dc84ea..5f0ec474 100644 --- a/tests/dictionaries/40condition_fallback/tiramisu/base.py +++ b/tests/dictionaries/40condition_fallback/tiramisu/base.py @@ -1,18 +1,21 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_4 = ChoiceOption(properties=frozenset({'disabled', 'mandatory', 'normal'}), name='mode_conteneur_actif1', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_5 = ChoiceOption(properties=frozenset({'disabled', 'mandatory', 'normal'}), name='mode_conteneur_actif2', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5]) -option_7 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif3', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_6 = OptionDescription(name='disabled_family', doc='disabled_family', properties=frozenset({'disabled', 'normal'}), children=[option_7]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2, option_6]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_4 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"disabled", "mandatory", "normal"})) +option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"disabled", "mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) +option_7 = StrOption(name="mode_conteneur_actif3", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_6 = OptionDescription(name="disabled_family", doc="disabled_family", children=[option_7], properties=frozenset({"disabled", "normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_6]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/40condition_optional/00-base.xml b/tests/dictionaries/40condition_optional/00-base.xml index 2db75e7b..99522be3 100644 --- a/tests/dictionaries/40condition_optional/00-base.xml +++ b/tests/dictionaries/40condition_optional/00-base.xml @@ -1,33 +1,26 @@ - - - - + - + non - + non - + non - - + oui mode_conteneur_actif1 mode_conteneur_actif2 - - - diff --git a/tests/dictionaries/40condition_optional/makedict/after.json b/tests/dictionaries/40condition_optional/makedict/after.json new file mode 100644 index 00000000..e29e8d8e --- /dev/null +++ b/tests/dictionaries/40condition_optional/makedict/after.json @@ -0,0 +1,14 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.condition": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif1": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/40condition_optional/makedict/base.json b/tests/dictionaries/40condition_optional/makedict/base.json index 6008a9ce..0858ba1b 100644 --- a/tests/dictionaries/40condition_optional/makedict/base.json +++ b/tests/dictionaries/40condition_optional/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.condition": "non", "rougail.general.mode_conteneur_actif1": "non"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.condition": "non", + "rougail.general.mode_conteneur_actif1": "non" +} diff --git a/tests/dictionaries/40condition_optional/makedict/before.json b/tests/dictionaries/40condition_optional/makedict/before.json new file mode 100644 index 00000000..e29e8d8e --- /dev/null +++ b/tests/dictionaries/40condition_optional/makedict/before.json @@ -0,0 +1,14 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.condition": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif1": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/40condition_optional/tiramisu/base.py b/tests/dictionaries/40condition_optional/tiramisu/base.py index a3e9bbd6..e3fb7b1d 100644 --- a/tests/dictionaries/40condition_optional/tiramisu/base.py +++ b/tests/dictionaries/40condition_optional/tiramisu/base.py @@ -1,16 +1,19 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='condition', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_5 = ChoiceOption(properties=frozenset({'mandatory', 'normal', Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue('oui')}))}), name='mode_conteneur_actif1', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_4 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_5 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")}))})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/40condition_optional_empty/00-base.xml b/tests/dictionaries/40condition_optional_empty/00-base.xml new file mode 100644 index 00000000..da22f00b --- /dev/null +++ b/tests/dictionaries/40condition_optional_empty/00-base.xml @@ -0,0 +1,25 @@ + + + + + + non + + + non + + + non + + + + + + + oui + mode_conteneur_actif2 + + + + diff --git a/tests/dictionaries/10load_leadership/tiramisu/__init__.py b/tests/dictionaries/40condition_optional_empty/__init__.py similarity index 100% rename from tests/dictionaries/10load_leadership/tiramisu/__init__.py rename to tests/dictionaries/40condition_optional_empty/__init__.py diff --git a/tests/dictionaries/40condition_optional_empty/makedict/after.json b/tests/dictionaries/40condition_optional_empty/makedict/after.json new file mode 100644 index 00000000..e29e8d8e --- /dev/null +++ b/tests/dictionaries/40condition_optional_empty/makedict/after.json @@ -0,0 +1,14 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.condition": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif1": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/40condition_optional_empty/makedict/base.json b/tests/dictionaries/40condition_optional_empty/makedict/base.json new file mode 100644 index 00000000..0858ba1b --- /dev/null +++ b/tests/dictionaries/40condition_optional_empty/makedict/base.json @@ -0,0 +1,5 @@ +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.condition": "non", + "rougail.general.mode_conteneur_actif1": "non" +} diff --git a/tests/dictionaries/40condition_optional_empty/makedict/before.json b/tests/dictionaries/40condition_optional_empty/makedict/before.json new file mode 100644 index 00000000..e29e8d8e --- /dev/null +++ b/tests/dictionaries/40condition_optional_empty/makedict/before.json @@ -0,0 +1,14 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.condition": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif1": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/40condition_optional_empty/tiramisu/base.py b/tests/dictionaries/40condition_optional_empty/tiramisu/base.py new file mode 100644 index 00000000..0232a4ac --- /dev/null +++ b/tests/dictionaries/40condition_optional_empty/tiramisu/base.py @@ -0,0 +1,19 @@ +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_4 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_5 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/40condition_optional_family/00-base.xml b/tests/dictionaries/40condition_optional_family/00-base.xml new file mode 100644 index 00000000..880841b0 --- /dev/null +++ b/tests/dictionaries/40condition_optional_family/00-base.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + True + general + general2 + + + + diff --git a/tests/dictionaries/10load_leadership_default_multi/tiramisu/__init__.py b/tests/dictionaries/40condition_optional_family/__init__.py similarity index 100% rename from tests/dictionaries/10load_leadership_default_multi/tiramisu/__init__.py rename to tests/dictionaries/40condition_optional_family/__init__.py diff --git a/tests/dictionaries/40condition_optional_family/makedict/after.json b/tests/dictionaries/40condition_optional_family/makedict/after.json new file mode 100644 index 00000000..5995efe9 --- /dev/null +++ b/tests/dictionaries/40condition_optional_family/makedict/after.json @@ -0,0 +1,6 @@ +{ + "rougail.condition": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/40condition_optional_family/makedict/base.json b/tests/dictionaries/40condition_optional_family/makedict/base.json new file mode 100644 index 00000000..18b52fac --- /dev/null +++ b/tests/dictionaries/40condition_optional_family/makedict/base.json @@ -0,0 +1,3 @@ +{ + "rougail.condition": true +} diff --git a/tests/dictionaries/40condition_optional_family/makedict/before.json b/tests/dictionaries/40condition_optional_family/makedict/before.json new file mode 100644 index 00000000..5995efe9 --- /dev/null +++ b/tests/dictionaries/40condition_optional_family/makedict/before.json @@ -0,0 +1,6 @@ +{ + "rougail.condition": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/40condition_optional_family/tiramisu/base.py b/tests/dictionaries/40condition_optional_family/tiramisu/base.py new file mode 100644 index 00000000..7b6cc832 --- /dev/null +++ b/tests/dictionaries/40condition_optional_family/tiramisu/base.py @@ -0,0 +1,18 @@ +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +option_2 = BoolOption(name="condition", doc="condition", default=True, properties=frozenset({"mandatory", "normal"})) +option_4 = StrOption(name="my_variable", doc="my_variable", properties=frozenset({"normal"})) +option_3 = OptionDescription(name="general", doc="general", children=[option_4], properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_2, todict=True, notraisepropertyerror=True), 'expected': ParamValue(True)}))})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/40empty_param/00_base.xml b/tests/dictionaries/40empty_param/00_base.xml index 00a7a201..155081f5 100644 --- a/tests/dictionaries/40empty_param/00_base.xml +++ b/tests/dictionaries/40empty_param/00_base.xml @@ -1,9 +1,9 @@ - + - + @@ -13,8 +13,9 @@ - - + + + toto1 diff --git a/tests/dictionaries/40empty_param/makedict/after.json b/tests/dictionaries/40empty_param/makedict/after.json new file mode 100644 index 00000000..b88ddc47 --- /dev/null +++ b/tests/dictionaries/40empty_param/makedict/after.json @@ -0,0 +1,10 @@ +{ + "rougail.proxy_authentifie.toto1": { + "owner": "default", + "value": null + }, + "rougail.proxy_authentifie.toto2": { + "owner": "default", + "value": "3127" + } +} diff --git a/tests/dictionaries/40empty_param/makedict/base.json b/tests/dictionaries/40empty_param/makedict/base.json index 0dd31190..36d66f3d 100644 --- a/tests/dictionaries/40empty_param/makedict/base.json +++ b/tests/dictionaries/40empty_param/makedict/base.json @@ -1 +1,4 @@ -{"rougail.proxy_authentifie.toto1": null, "rougail.proxy_authentifie.toto2": "3127"} +{ + "rougail.proxy_authentifie.toto1": null, + "rougail.proxy_authentifie.toto2": "3127" +} diff --git a/tests/dictionaries/40empty_param/makedict/before.json b/tests/dictionaries/40empty_param/makedict/before.json new file mode 100644 index 00000000..b88ddc47 --- /dev/null +++ b/tests/dictionaries/40empty_param/makedict/before.json @@ -0,0 +1,10 @@ +{ + "rougail.proxy_authentifie.toto1": { + "owner": "default", + "value": null + }, + "rougail.proxy_authentifie.toto2": { + "owner": "default", + "value": "3127" + } +} diff --git a/tests/dictionaries/40empty_param/tiramisu/base.py b/tests/dictionaries/40empty_param/tiramisu/base.py index 551c89af..1aaecb16 100644 --- a/tests/dictionaries/40empty_param/tiramisu/base.py +++ b/tests/dictionaries/40empty_param/tiramisu/base.py @@ -1,15 +1,18 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = PortOption(allow_private=True, properties=frozenset({'expert'}), name='toto1', doc='Port d\'écoute du proxy', multi=False, default=Calculation(func.calc_multi_condition, Params((ParamValue("None")), kwargs={}))) -option_4 = PortOption(allow_private=True, properties=frozenset({'expert', 'mandatory'}), name='toto2', doc='Port d\'écoute du proxy NTLM', multi=False, default='3127') -option_2 = OptionDescription(name='proxy_authentifie', doc='proxy authentifié', properties=frozenset({'expert'}), children=[option_3, option_4]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = PortOption(name="toto1", doc="Port d'écoute du proxy", default=Calculation(func.calc_multi_condition, Params((ParamValue(None)))), allow_private=True, properties=frozenset({"expert"})) +option_4 = PortOption(name="toto2", doc="Port d'écoute du proxy NTLM", default="3127", allow_private=True, properties=frozenset({"expert", "mandatory"})) +option_2 = OptionDescription(name="proxy_authentifie", doc="proxy authentifié", children=[option_3, option_4], properties=frozenset({"expert"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/40empty_param2/00_base.xml b/tests/dictionaries/40empty_param2/00_base.xml index 9c0fa4f0..dd301fda 100644 --- a/tests/dictionaries/40empty_param2/00_base.xml +++ b/tests/dictionaries/40empty_param2/00_base.xml @@ -1,9 +1,9 @@ - + - + @@ -13,8 +13,9 @@ - - + + + toto1 diff --git a/tests/dictionaries/40empty_param2/makedict/after.json b/tests/dictionaries/40empty_param2/makedict/after.json new file mode 100644 index 00000000..b88ddc47 --- /dev/null +++ b/tests/dictionaries/40empty_param2/makedict/after.json @@ -0,0 +1,10 @@ +{ + "rougail.proxy_authentifie.toto1": { + "owner": "default", + "value": null + }, + "rougail.proxy_authentifie.toto2": { + "owner": "default", + "value": "3127" + } +} diff --git a/tests/dictionaries/40empty_param2/makedict/base.json b/tests/dictionaries/40empty_param2/makedict/base.json index 0dd31190..36d66f3d 100644 --- a/tests/dictionaries/40empty_param2/makedict/base.json +++ b/tests/dictionaries/40empty_param2/makedict/base.json @@ -1 +1,4 @@ -{"rougail.proxy_authentifie.toto1": null, "rougail.proxy_authentifie.toto2": "3127"} +{ + "rougail.proxy_authentifie.toto1": null, + "rougail.proxy_authentifie.toto2": "3127" +} diff --git a/tests/dictionaries/40empty_param2/makedict/before.json b/tests/dictionaries/40empty_param2/makedict/before.json new file mode 100644 index 00000000..b88ddc47 --- /dev/null +++ b/tests/dictionaries/40empty_param2/makedict/before.json @@ -0,0 +1,10 @@ +{ + "rougail.proxy_authentifie.toto1": { + "owner": "default", + "value": null + }, + "rougail.proxy_authentifie.toto2": { + "owner": "default", + "value": "3127" + } +} diff --git a/tests/dictionaries/40empty_param2/tiramisu/base.py b/tests/dictionaries/40empty_param2/tiramisu/base.py index a5ee9ef3..212d7262 100644 --- a/tests/dictionaries/40empty_param2/tiramisu/base.py +++ b/tests/dictionaries/40empty_param2/tiramisu/base.py @@ -1,15 +1,18 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = PortOption(allow_private=True, properties=frozenset({'expert'}), name='toto1', doc='Port d\'écoute du proxy', multi=False, default=Calculation(func.calc_multi_condition, Params((), kwargs={'value': ParamValue("None")}))) -option_4 = PortOption(allow_private=True, properties=frozenset({'expert', 'mandatory'}), name='toto2', doc='Port d\'écoute du proxy NTLM', multi=False, default='3127') -option_2 = OptionDescription(name='proxy_authentifie', doc='proxy authentifié', properties=frozenset({'expert'}), children=[option_3, option_4]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = PortOption(name="toto1", doc="Port d'écoute du proxy", default=Calculation(func.calc_multi_condition, Params((), kwargs={'value': ParamValue(None)})), allow_private=True, properties=frozenset({"expert"})) +option_4 = PortOption(name="toto2", doc="Port d'écoute du proxy NTLM", default="3127", allow_private=True, properties=frozenset({"expert", "mandatory"})) +option_2 = OptionDescription(name="proxy_authentifie", doc="proxy authentifié", children=[option_3, option_4], properties=frozenset({"expert"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/40hidden_if_in_group_fallback/00-base.xml b/tests/dictionaries/40hidden_if_in_group_fallback/00-base.xml index d814f125..8fad142b 100644 --- a/tests/dictionaries/40hidden_if_in_group_fallback/00-base.xml +++ b/tests/dictionaries/40hidden_if_in_group_fallback/00-base.xml @@ -1,25 +1,21 @@ - - - - + - + non - + non - + non - - + oui mode_conteneur_actif1 @@ -27,9 +23,6 @@ mode_conteneur_actif2 - - - diff --git a/tests/dictionaries/40hidden_if_in_group_fallback/makedict/after.json b/tests/dictionaries/40hidden_if_in_group_fallback/makedict/after.json new file mode 100644 index 00000000..71106a22 --- /dev/null +++ b/tests/dictionaries/40hidden_if_in_group_fallback/makedict/after.json @@ -0,0 +1,20 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif1.mode_conteneur_actif1": { + "owner": "default", + "value": [ + "non" + ] + }, + "rougail.general.mode_conteneur_actif1.mode_conteneur_actif2": { + "owner": [ + "default" + ], + "value": [ + "non" + ] + } +} diff --git a/tests/dictionaries/40hidden_if_in_group_fallback/makedict/base.json b/tests/dictionaries/40hidden_if_in_group_fallback/makedict/base.json index 8e8eadbe..608b4c52 100644 --- a/tests/dictionaries/40hidden_if_in_group_fallback/makedict/base.json +++ b/tests/dictionaries/40hidden_if_in_group_fallback/makedict/base.json @@ -1 +1,9 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif1.mode_conteneur_actif1": ["non"], "rougail.general.mode_conteneur_actif1.mode_conteneur_actif2": ["non"]} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif1.mode_conteneur_actif1": [ + { + "rougail.general.mode_conteneur_actif1.mode_conteneur_actif1": "non", + "rougail.general.mode_conteneur_actif1.mode_conteneur_actif2": "non" + } + ] +} diff --git a/tests/dictionaries/40hidden_if_in_group_fallback/makedict/before.json b/tests/dictionaries/40hidden_if_in_group_fallback/makedict/before.json new file mode 100644 index 00000000..71106a22 --- /dev/null +++ b/tests/dictionaries/40hidden_if_in_group_fallback/makedict/before.json @@ -0,0 +1,20 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif1.mode_conteneur_actif1": { + "owner": "default", + "value": [ + "non" + ] + }, + "rougail.general.mode_conteneur_actif1.mode_conteneur_actif2": { + "owner": [ + "default" + ], + "value": [ + "non" + ] + } +} diff --git a/tests/dictionaries/40hidden_if_in_group_fallback/tiramisu/base.py b/tests/dictionaries/40hidden_if_in_group_fallback/tiramisu/base.py index 03c70bbe..f2fba470 100644 --- a/tests/dictionaries/40hidden_if_in_group_fallback/tiramisu/base.py +++ b/tests/dictionaries/40hidden_if_in_group_fallback/tiramisu/base.py @@ -1,17 +1,20 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_5 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'mandatory'}), name='mode_conteneur_actif1', doc='No change', multi=True, default=['non'], values=('oui', 'non')) -option_6 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'mandatory', 'normal'}), name='mode_conteneur_actif2', doc='No change', multi=True, default_multi='non', values=('oui', 'non')) -option_4 = Leadership(name='mode_conteneur_actif1', doc='No change', properties=frozenset({'hidden', 'normal'}), children=[option_5, option_6]) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_5 = StrOption(name="mode_conteneur_actif1", doc="No change", multi=True, default=['non'], properties=frozenset({"force_default_on_freeze", "frozen", "mandatory"})) +option_6 = StrOption(name="mode_conteneur_actif2", doc="No change", multi=True, default_multi="non", properties=frozenset({"force_default_on_freeze", "frozen", "mandatory", "normal"})) +option_4 = Leadership(name="mode_conteneur_actif1", doc="No change", children=[option_5, option_6], properties=frozenset({"hidden", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/40ifin_leadership/00-base.xml b/tests/dictionaries/40ifin_leadership/00-base.xml index 9eb54040..f2c75550 100644 --- a/tests/dictionaries/40ifin_leadership/00-base.xml +++ b/tests/dictionaries/40ifin_leadership/00-base.xml @@ -1,14 +1,13 @@ - - - - + - + non - + + oui + @@ -25,7 +24,4 @@ follower1 - - - diff --git a/tests/dictionaries/40ifin_leadership/makedict/after.json b/tests/dictionaries/40ifin_leadership/makedict/after.json new file mode 100644 index 00000000..1578e3fb --- /dev/null +++ b/tests/dictionaries/40ifin_leadership/makedict/after.json @@ -0,0 +1,18 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.condition": { + "owner": "default", + "value": "oui" + }, + "rougail.general.leader.leader": { + "owner": "default", + "value": [] + }, + "rougail.general.leader.follower2": { + "owner": [], + "value": [] + } +} diff --git a/tests/dictionaries/40ifin_leadership/makedict/base.json b/tests/dictionaries/40ifin_leadership/makedict/base.json index ef2026a8..2d556dde 100644 --- a/tests/dictionaries/40ifin_leadership/makedict/base.json +++ b/tests/dictionaries/40ifin_leadership/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.condition": "oui", "rougail.general.leader.leader": [], "rougail.general.leader.follower2": []} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.condition": "oui", + "rougail.general.leader.leader": [] +} diff --git a/tests/dictionaries/40ifin_leadership/makedict/before.json b/tests/dictionaries/40ifin_leadership/makedict/before.json new file mode 100644 index 00000000..1578e3fb --- /dev/null +++ b/tests/dictionaries/40ifin_leadership/makedict/before.json @@ -0,0 +1,18 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.condition": { + "owner": "default", + "value": "oui" + }, + "rougail.general.leader.leader": { + "owner": "default", + "value": [] + }, + "rougail.general.leader.follower2": { + "owner": [], + "value": [] + } +} diff --git a/tests/dictionaries/40ifin_leadership/tiramisu/base.py b/tests/dictionaries/40ifin_leadership/tiramisu/base.py index b0f6181e..6def79cd 100644 --- a/tests/dictionaries/40ifin_leadership/tiramisu/base.py +++ b/tests/dictionaries/40ifin_leadership/tiramisu/base.py @@ -1,19 +1,22 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='condition', doc='condition', multi=False, default='oui', values=('oui', 'non')) -option_6 = StrOption(name='leader', doc='leader', multi=True) -option_7 = StrOption(properties=frozenset({'normal', Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue('oui')}))}), name='follower1', doc='follower1', multi=True) -option_8 = StrOption(properties=frozenset({'normal'}), name='follower2', doc='follower2', multi=True) -option_5 = Leadership(name='leader', doc='leader', properties=frozenset({'normal'}), children=[option_6, option_7, option_8]) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_4 = StrOption(name="condition", doc="condition", default="oui", properties=frozenset({"mandatory", "normal"})) +option_6 = StrOption(name="leader", doc="leader", multi=True) +option_7 = StrOption(name="follower1", doc="follower1", multi=True, properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")}))})) +option_8 = StrOption(name="follower2", doc="follower2", multi=True, properties=frozenset({"normal"})) +option_5 = Leadership(name="leader", doc="leader", children=[option_6, option_7, option_8], properties=frozenset({"normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/40ifin_leadershipauto/00-base.xml b/tests/dictionaries/40ifin_leadershipauto/00-base.xml index 0d14016f..326da930 100644 --- a/tests/dictionaries/40ifin_leadershipauto/00-base.xml +++ b/tests/dictionaries/40ifin_leadershipauto/00-base.xml @@ -1,34 +1,37 @@ - - - - + + + + /etc/mailname + + - + non - - + + oui + + + a + - follower1 follower2 - + valfill + follower1 oui follower1 - - - diff --git a/tests/dictionaries/40ifin_leadershipauto/makedict/after.json b/tests/dictionaries/40ifin_leadershipauto/makedict/after.json new file mode 100644 index 00000000..06fbbb59 --- /dev/null +++ b/tests/dictionaries/40ifin_leadershipauto/makedict/after.json @@ -0,0 +1,64 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.condition": { + "owner": "default", + "value": "oui" + }, + "rougail.general.leader.leader": { + "owner": "default", + "value": [ + "a" + ] + }, + "rougail.general.leader.follower2": { + "owner": [ + "default" + ], + "value": [ + null + ] + }, + "services.test.files.mailname.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.mailname.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.mailname.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.mailname.name": { + "owner": "default", + "value": "/etc/mailname" + }, + "services.test.files.mailname.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.source": { + "owner": "default", + "value": "mailname" + }, + "services.test.files.mailname.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/40ifin_leadershipauto/makedict/base.json b/tests/dictionaries/40ifin_leadershipauto/makedict/base.json index ef2026a8..abb03d5a 100644 --- a/tests/dictionaries/40ifin_leadershipauto/makedict/base.json +++ b/tests/dictionaries/40ifin_leadershipauto/makedict/base.json @@ -1 +1,20 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.condition": "oui", "rougail.general.leader.leader": [], "rougail.general.leader.follower2": []} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.condition": "oui", + "rougail.general.leader.leader": [ + { + "rougail.general.leader.leader": "a", + "rougail.general.leader.follower2": null + } + ], + "services.test.files.mailname.engine": "creole", + "services.test.files.mailname.group": "root", + "services.test.files.mailname.included": "no", + "services.test.files.mailname.mode": "0644", + "services.test.files.mailname.name": "/etc/mailname", + "services.test.files.mailname.owner": "root", + "services.test.files.mailname.source": "mailname", + "services.test.files.mailname.activate": true, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/40ifin_leadershipauto/makedict/before.json b/tests/dictionaries/40ifin_leadershipauto/makedict/before.json new file mode 100644 index 00000000..06fbbb59 --- /dev/null +++ b/tests/dictionaries/40ifin_leadershipauto/makedict/before.json @@ -0,0 +1,64 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.condition": { + "owner": "default", + "value": "oui" + }, + "rougail.general.leader.leader": { + "owner": "default", + "value": [ + "a" + ] + }, + "rougail.general.leader.follower2": { + "owner": [ + "default" + ], + "value": [ + null + ] + }, + "services.test.files.mailname.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.mailname.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.mailname.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.mailname.name": { + "owner": "default", + "value": "/etc/mailname" + }, + "services.test.files.mailname.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.source": { + "owner": "default", + "value": "mailname" + }, + "services.test.files.mailname.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/40ifin_leadershipauto/result/etc/mailname b/tests/dictionaries/40ifin_leadershipauto/result/etc/mailname new file mode 100644 index 00000000..155aa30c --- /dev/null +++ b/tests/dictionaries/40ifin_leadershipauto/result/etc/mailname @@ -0,0 +1,2 @@ +leader: a +follower2: diff --git a/tests/dictionaries/40ifin_leadershipauto/result/tmpfiles.d/rougail.conf b/tests/dictionaries/40ifin_leadershipauto/result/tmpfiles.d/rougail.conf new file mode 100644 index 00000000..46697e03 --- /dev/null +++ b/tests/dictionaries/40ifin_leadershipauto/result/tmpfiles.d/rougail.conf @@ -0,0 +1,2 @@ +C /etc/mailname 0644 root root - /usr/local/lib/etc/mailname +z /etc/mailname - - - - - diff --git a/tests/dictionaries/40ifin_leadershipauto/tiramisu/base.py b/tests/dictionaries/40ifin_leadershipauto/tiramisu/base.py index 8fbfc4aa..7dd16c28 100644 --- a/tests/dictionaries/40ifin_leadershipauto/tiramisu/base.py +++ b/tests/dictionaries/40ifin_leadershipauto/tiramisu/base.py @@ -1,19 +1,36 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='condition', doc='condition', multi=False, default='oui', values=('oui', 'non')) -option_6 = StrOption(name='leader', doc='leader', multi=True) -option_7 = StrOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'normal', Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue('oui')}))}), name='follower1', doc='follower1', multi=True, default=Calculation(func.calc_val, Params((), kwargs={'valeur': ParamValue("valfill")}))) -option_8 = StrOption(properties=frozenset({'normal'}), name='follower2', doc='follower2', multi=True) -option_5 = Leadership(name='leader', doc='leader', properties=frozenset({'normal'}), children=[option_6, option_7, option_8]) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_4 = StrOption(name="condition", doc="condition", default="oui", properties=frozenset({"mandatory", "normal"})) +option_6 = StrOption(name="leader", doc="leader", multi=True, default=['a'], properties=frozenset({"mandatory"})) +option_7 = StrOption(name="follower1", doc="follower1", multi=True, default=Calculation(func.calc_val, Params((), kwargs={'valeur': ParamValue("valfill")})), properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")}))})) +option_8 = StrOption(name="follower2", doc="follower2", multi=True, properties=frozenset({"normal"})) +option_5 = Leadership(name="leader", doc="leader", children=[option_6, option_7, option_8], properties=frozenset({"normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_13 = StrOption(name="engine", doc="engine", default="creole") +option_14 = StrOption(name="group", doc="group", default="root") +option_15 = StrOption(name="included", doc="included", default="no") +option_16 = StrOption(name="mode", doc="mode", default="0644") +option_17 = FilenameOption(name="name", doc="name", default="/etc/mailname") +option_18 = StrOption(name="owner", doc="owner", default="root") +option_19 = StrOption(name="source", doc="source", default="mailname") +option_20 = BoolOption(name="activate", doc="activate", default=True) +option_12 = OptionDescription(name="mailname", doc="mailname", children=[option_13, option_14, option_15, option_16, option_17, option_18, option_19, option_20]) +option_11 = OptionDescription(name="files", doc="files", children=[option_12]) +option_21 = BoolOption(name="activate", doc="activate", default=True) +option_22 = BoolOption(name="manage", doc="manage", default=True) +option_10 = OptionDescription(name="test", doc="test", children=[option_11, option_21, option_22]) +option_9 = OptionDescription(name="services", doc="services", children=[option_10], properties=frozenset({"hidden"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_9]) diff --git a/tests/dictionaries/40ifin_leadershipauto/tmpl/mailname b/tests/dictionaries/40ifin_leadershipauto/tmpl/mailname new file mode 100644 index 00000000..43dbe7d1 --- /dev/null +++ b/tests/dictionaries/40ifin_leadershipauto/tmpl/mailname @@ -0,0 +1,9 @@ +%for %%lead in %%leader +leader: %%lead +%if %%hasattr(%%lead, 'follower1') +follower1: %%lead.follower1 +%end if +%if %%hasattr(%%lead, 'follower2') +follower2: %%lead.follower2 +%end if +%end for diff --git a/tests/dictionaries/40ifin_leadershipauto_follower/00-base.xml b/tests/dictionaries/40ifin_leadershipauto_follower/00-base.xml new file mode 100644 index 00000000..b7db4590 --- /dev/null +++ b/tests/dictionaries/40ifin_leadershipauto_follower/00-base.xml @@ -0,0 +1,39 @@ + + + + + /etc/mailname + /etc/mailname2 + + + + + + non + + + oui + + + a + b + + + + + + + + follower1 + follower2 + + + valfill + follower1 + + + a + follower1 + + + diff --git a/tests/dictionaries/10load_leadership_default_submulti/tiramisu/__init__.py b/tests/dictionaries/40ifin_leadershipauto_follower/__init__.py similarity index 100% rename from tests/dictionaries/10load_leadership_default_submulti/tiramisu/__init__.py rename to tests/dictionaries/40ifin_leadershipauto_follower/__init__.py diff --git a/tests/dictionaries/40ifin_leadershipauto_follower/makedict/after.json b/tests/dictionaries/40ifin_leadershipauto_follower/makedict/after.json new file mode 100644 index 00000000..d2092a9a --- /dev/null +++ b/tests/dictionaries/40ifin_leadershipauto_follower/makedict/after.json @@ -0,0 +1,109 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.condition": { + "owner": "default", + "value": "oui" + }, + "rougail.general.leader.leader": { + "owner": "default", + "value": [ + "a", + "b" + ] + }, + "rougail.general.leader.follower1": { + "owner": [ + "error", + "default" + ], + "value": [ + "cannot access to option \"follower1\" because has property \"disabled\"", + null + ] + }, + "rougail.general.leader.follower2": { + "owner": [ + "default", + "default" + ], + "value": [ + null, + null + ] + }, + "services.test.files.mailname.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.mailname.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.mailname.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.mailname.name": { + "owner": "default", + "value": "/etc/mailname" + }, + "services.test.files.mailname.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.source": { + "owner": "default", + "value": "mailname" + }, + "services.test.files.mailname.activate": { + "owner": "default", + "value": true + }, + "services.test.files.mailname2.engine": { + "owner": "default", + "value": "jinja2" + }, + "services.test.files.mailname2.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname2.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.mailname2.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.mailname2.name": { + "owner": "default", + "value": "/etc/mailname2" + }, + "services.test.files.mailname2.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname2.source": { + "owner": "default", + "value": "mailname2" + }, + "services.test.files.mailname2.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/40ifin_leadershipauto_follower/makedict/base.json b/tests/dictionaries/40ifin_leadershipauto_follower/makedict/base.json new file mode 100644 index 00000000..df5efe3b --- /dev/null +++ b/tests/dictionaries/40ifin_leadershipauto_follower/makedict/base.json @@ -0,0 +1,33 @@ +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.condition": "oui", + "rougail.general.leader.leader": [ + { + "rougail.general.leader.leader": "a", + "rougail.general.leader.follower2": null + }, + { + "rougail.general.leader.leader": "b", + "rougail.general.leader.follower1": null, + "rougail.general.leader.follower2": null + } + ], + "services.test.files.mailname.engine": "creole", + "services.test.files.mailname.group": "root", + "services.test.files.mailname.included": "no", + "services.test.files.mailname.mode": "0644", + "services.test.files.mailname.name": "/etc/mailname", + "services.test.files.mailname.owner": "root", + "services.test.files.mailname.source": "mailname", + "services.test.files.mailname.activate": true, + "services.test.files.mailname2.engine": "jinja2", + "services.test.files.mailname2.group": "root", + "services.test.files.mailname2.included": "no", + "services.test.files.mailname2.mode": "0644", + "services.test.files.mailname2.name": "/etc/mailname2", + "services.test.files.mailname2.owner": "root", + "services.test.files.mailname2.source": "mailname2", + "services.test.files.mailname2.activate": true, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/40ifin_leadershipauto_follower/makedict/before.json b/tests/dictionaries/40ifin_leadershipauto_follower/makedict/before.json new file mode 100644 index 00000000..d2092a9a --- /dev/null +++ b/tests/dictionaries/40ifin_leadershipauto_follower/makedict/before.json @@ -0,0 +1,109 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.condition": { + "owner": "default", + "value": "oui" + }, + "rougail.general.leader.leader": { + "owner": "default", + "value": [ + "a", + "b" + ] + }, + "rougail.general.leader.follower1": { + "owner": [ + "error", + "default" + ], + "value": [ + "cannot access to option \"follower1\" because has property \"disabled\"", + null + ] + }, + "rougail.general.leader.follower2": { + "owner": [ + "default", + "default" + ], + "value": [ + null, + null + ] + }, + "services.test.files.mailname.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.mailname.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.mailname.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.mailname.name": { + "owner": "default", + "value": "/etc/mailname" + }, + "services.test.files.mailname.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.source": { + "owner": "default", + "value": "mailname" + }, + "services.test.files.mailname.activate": { + "owner": "default", + "value": true + }, + "services.test.files.mailname2.engine": { + "owner": "default", + "value": "jinja2" + }, + "services.test.files.mailname2.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname2.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.mailname2.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.mailname2.name": { + "owner": "default", + "value": "/etc/mailname2" + }, + "services.test.files.mailname2.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname2.source": { + "owner": "default", + "value": "mailname2" + }, + "services.test.files.mailname2.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/40ifin_leadershipauto_follower/result/etc/mailname b/tests/dictionaries/40ifin_leadershipauto_follower/result/etc/mailname new file mode 100644 index 00000000..b7cbd32c --- /dev/null +++ b/tests/dictionaries/40ifin_leadershipauto_follower/result/etc/mailname @@ -0,0 +1,5 @@ +leader: a +follower2: +leader: b +follower1: +follower2: diff --git a/tests/dictionaries/40ifin_leadershipauto_follower/result/etc/mailname2 b/tests/dictionaries/40ifin_leadershipauto_follower/result/etc/mailname2 new file mode 100644 index 00000000..b7cbd32c --- /dev/null +++ b/tests/dictionaries/40ifin_leadershipauto_follower/result/etc/mailname2 @@ -0,0 +1,5 @@ +leader: a +follower2: +leader: b +follower1: +follower2: diff --git a/tests/dictionaries/40ifin_leadershipauto_follower/result/tmpfiles.d/rougail.conf b/tests/dictionaries/40ifin_leadershipauto_follower/result/tmpfiles.d/rougail.conf new file mode 100644 index 00000000..7a8d00f4 --- /dev/null +++ b/tests/dictionaries/40ifin_leadershipauto_follower/result/tmpfiles.d/rougail.conf @@ -0,0 +1,4 @@ +C /etc/mailname 0644 root root - /usr/local/lib/etc/mailname +z /etc/mailname - - - - - +C /etc/mailname2 0644 root root - /usr/local/lib/etc/mailname2 +z /etc/mailname2 - - - - - diff --git a/tests/dictionaries/40ifin_leadershipauto_follower/tiramisu/base.py b/tests/dictionaries/40ifin_leadershipauto_follower/tiramisu/base.py new file mode 100644 index 00000000..a9db138d --- /dev/null +++ b/tests/dictionaries/40ifin_leadershipauto_follower/tiramisu/base.py @@ -0,0 +1,45 @@ +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_4 = StrOption(name="condition", doc="condition", default="oui", properties=frozenset({"mandatory", "normal"})) +option_6 = StrOption(name="leader", doc="leader", multi=True, default=['a', 'b'], properties=frozenset({"mandatory"})) +option_7 = StrOption(name="follower1", doc="follower1", multi=True, default=Calculation(func.calc_val, Params((), kwargs={'valeur': ParamValue("valfill")})), properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_6, todict=True, notraisepropertyerror=True), 'expected': ParamValue("a")}))})) +option_8 = StrOption(name="follower2", doc="follower2", multi=True, properties=frozenset({"normal"})) +option_5 = Leadership(name="leader", doc="leader", children=[option_6, option_7, option_8], properties=frozenset({"normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_13 = StrOption(name="engine", doc="engine", default="creole") +option_14 = StrOption(name="group", doc="group", default="root") +option_15 = StrOption(name="included", doc="included", default="no") +option_16 = StrOption(name="mode", doc="mode", default="0644") +option_17 = FilenameOption(name="name", doc="name", default="/etc/mailname") +option_18 = StrOption(name="owner", doc="owner", default="root") +option_19 = StrOption(name="source", doc="source", default="mailname") +option_20 = BoolOption(name="activate", doc="activate", default=True) +option_12 = OptionDescription(name="mailname", doc="mailname", children=[option_13, option_14, option_15, option_16, option_17, option_18, option_19, option_20]) +option_22 = StrOption(name="engine", doc="engine", default="jinja2") +option_23 = StrOption(name="group", doc="group", default="root") +option_24 = StrOption(name="included", doc="included", default="no") +option_25 = StrOption(name="mode", doc="mode", default="0644") +option_26 = FilenameOption(name="name", doc="name", default="/etc/mailname2") +option_27 = StrOption(name="owner", doc="owner", default="root") +option_28 = StrOption(name="source", doc="source", default="mailname2") +option_29 = BoolOption(name="activate", doc="activate", default=True) +option_21 = OptionDescription(name="mailname2", doc="mailname2", children=[option_22, option_23, option_24, option_25, option_26, option_27, option_28, option_29]) +option_11 = OptionDescription(name="files", doc="files", children=[option_12, option_21]) +option_30 = BoolOption(name="activate", doc="activate", default=True) +option_31 = BoolOption(name="manage", doc="manage", default=True) +option_10 = OptionDescription(name="test", doc="test", children=[option_11, option_30, option_31]) +option_9 = OptionDescription(name="services", doc="services", children=[option_10], properties=frozenset({"hidden"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_9]) diff --git a/tests/dictionaries/40ifin_leadershipauto_follower/tmpl/mailname b/tests/dictionaries/40ifin_leadershipauto_follower/tmpl/mailname new file mode 100644 index 00000000..43dbe7d1 --- /dev/null +++ b/tests/dictionaries/40ifin_leadershipauto_follower/tmpl/mailname @@ -0,0 +1,9 @@ +%for %%lead in %%leader +leader: %%lead +%if %%hasattr(%%lead, 'follower1') +follower1: %%lead.follower1 +%end if +%if %%hasattr(%%lead, 'follower2') +follower2: %%lead.follower2 +%end if +%end for diff --git a/tests/dictionaries/40ifin_leadershipauto_follower/tmpl/mailname2 b/tests/dictionaries/40ifin_leadershipauto_follower/tmpl/mailname2 new file mode 100644 index 00000000..021f00bb --- /dev/null +++ b/tests/dictionaries/40ifin_leadershipauto_follower/tmpl/mailname2 @@ -0,0 +1,9 @@ +{% for lead in leader -%} +leader: {{ lead }} +{% if lead.follower1 is defined -%} +follower1: {{ lead.follower1 if lead.follower1 }} +{% endif -%} +{% if lead.follower2 is defined -%} +follower2: {{ lead.follower2 if lead.follower2 }} +{% endif -%} +{% endfor -%} diff --git a/tests/dictionaries/40ifin_multi/00-base.xml b/tests/dictionaries/40ifin_multi/00-base.xml index abb35cfd..a4a6d391 100644 --- a/tests/dictionaries/40ifin_multi/00-base.xml +++ b/tests/dictionaries/40ifin_multi/00-base.xml @@ -1,23 +1,19 @@ - - - - + - - @@ -30,9 +26,6 @@ mode_conteneur_actif3 - - - diff --git a/tests/dictionaries/40ifin_multi/makedict/after.json b/tests/dictionaries/40ifin_multi/makedict/after.json new file mode 100644 index 00000000..a4edb494 --- /dev/null +++ b/tests/dictionaries/40ifin_multi/makedict/after.json @@ -0,0 +1,14 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general2.mode_conteneur_actif2": { + "owner": "default", + "value": "non" + }, + "rougail.general2.mode_conteneur_actif3": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/40ifin_multi/makedict/base.json b/tests/dictionaries/40ifin_multi/makedict/base.json index 4c3844b8..79c29948 100644 --- a/tests/dictionaries/40ifin_multi/makedict/base.json +++ b/tests/dictionaries/40ifin_multi/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general2.mode_conteneur_actif2": "non", "rougail.general2.mode_conteneur_actif3": "non"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general2.mode_conteneur_actif2": "non", + "rougail.general2.mode_conteneur_actif3": "non" +} diff --git a/tests/dictionaries/40ifin_multi/makedict/before.json b/tests/dictionaries/40ifin_multi/makedict/before.json new file mode 100644 index 00000000..a4edb494 --- /dev/null +++ b/tests/dictionaries/40ifin_multi/makedict/before.json @@ -0,0 +1,14 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general2.mode_conteneur_actif2": { + "owner": "default", + "value": "non" + }, + "rougail.general2.mode_conteneur_actif3": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/40ifin_multi/tiramisu/base.py b/tests/dictionaries/40ifin_multi/tiramisu/base.py index 5698bf29..e9fc2084 100644 --- a/tests/dictionaries/40ifin_multi/tiramisu/base.py +++ b/tests/dictionaries/40ifin_multi/tiramisu/base.py @@ -1,17 +1,20 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3]) -option_5 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif2', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_6 = ChoiceOption(properties=frozenset({'mandatory', 'normal', Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_5, todict=True), 'expected': ParamValue('oui')}))}), name='mode_conteneur_actif3', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_4 = OptionDescription(name='general2', doc='general2', properties=frozenset({'hidden', 'normal'}), children=[option_5, option_6]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2, option_4]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) +option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_6 = StrOption(name="mode_conteneur_actif3", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_5, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")}))})) +option_4 = OptionDescription(name="general2", doc="general2", children=[option_5, option_6], properties=frozenset({"hidden", "normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/40ifin_multi2/00-base.xml b/tests/dictionaries/40ifin_multi2/00-base.xml new file mode 100644 index 00000000..498b2c08 --- /dev/null +++ b/tests/dictionaries/40ifin_multi2/00-base.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + oui + mode_conteneur_actif3 + + + oui + mode_conteneur_actif3 + + + + diff --git a/tests/dictionaries/10load_leadership_defaultmulti_leader/tiramisu/__init__.py b/tests/dictionaries/40ifin_multi2/__init__.py similarity index 100% rename from tests/dictionaries/10load_leadership_defaultmulti_leader/tiramisu/__init__.py rename to tests/dictionaries/40ifin_multi2/__init__.py diff --git a/tests/dictionaries/40ifin_multi2/makedict/after.json b/tests/dictionaries/40ifin_multi2/makedict/after.json new file mode 100644 index 00000000..4efa6e2f --- /dev/null +++ b/tests/dictionaries/40ifin_multi2/makedict/after.json @@ -0,0 +1,10 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general2.mode_conteneur_actif2": { + "owner": "default", + "value": "oui" + } +} diff --git a/tests/dictionaries/40ifin_multi2/makedict/base.json b/tests/dictionaries/40ifin_multi2/makedict/base.json new file mode 100644 index 00000000..ec1b5d8c --- /dev/null +++ b/tests/dictionaries/40ifin_multi2/makedict/base.json @@ -0,0 +1,4 @@ +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general2.mode_conteneur_actif2": "oui" +} diff --git a/tests/dictionaries/40ifin_multi2/makedict/before.json b/tests/dictionaries/40ifin_multi2/makedict/before.json new file mode 100644 index 00000000..4efa6e2f --- /dev/null +++ b/tests/dictionaries/40ifin_multi2/makedict/before.json @@ -0,0 +1,10 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general2.mode_conteneur_actif2": { + "owner": "default", + "value": "oui" + } +} diff --git a/tests/dictionaries/40ifin_multi2/tiramisu/base.py b/tests/dictionaries/40ifin_multi2/tiramisu/base.py new file mode 100644 index 00000000..1047e2c1 --- /dev/null +++ b/tests/dictionaries/40ifin_multi2/tiramisu/base.py @@ -0,0 +1,20 @@ +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) +option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="oui", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_6 = StrOption(name="mode_conteneur_actif3", doc="No change", default="non", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_5, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")}))})) +option_4 = OptionDescription(name="general2", doc="general2", children=[option_5, option_6], properties=frozenset({"hidden", "normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/40ifin_validenum/00-base.xml b/tests/dictionaries/40ifin_validenum/00-base.xml new file mode 100644 index 00000000..5311ee9d --- /dev/null +++ b/tests/dictionaries/40ifin_validenum/00-base.xml @@ -0,0 +1,34 @@ + + + + + + non + + + + + + + a + b + c + mode_conteneur_actif3 + + + d + mode_conteneur_actif + + + d + mode_conteneur_actif2 + + + + diff --git a/tests/dictionaries/40ifin_validenum/makedict/after.json b/tests/dictionaries/40ifin_validenum/makedict/after.json new file mode 100644 index 00000000..d06f9406 --- /dev/null +++ b/tests/dictionaries/40ifin_validenum/makedict/after.json @@ -0,0 +1,10 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general2.mode_conteneur_actif3": { + "owner": "default", + "value": "a" + } +} diff --git a/tests/dictionaries/40ifin_validenum/makedict/base.json b/tests/dictionaries/40ifin_validenum/makedict/base.json new file mode 100644 index 00000000..16d3139d --- /dev/null +++ b/tests/dictionaries/40ifin_validenum/makedict/base.json @@ -0,0 +1,4 @@ +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general2.mode_conteneur_actif3": "a" +} diff --git a/tests/dictionaries/40ifin_validenum/makedict/before.json b/tests/dictionaries/40ifin_validenum/makedict/before.json new file mode 100644 index 00000000..d06f9406 --- /dev/null +++ b/tests/dictionaries/40ifin_validenum/makedict/before.json @@ -0,0 +1,10 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general2.mode_conteneur_actif3": { + "owner": "default", + "value": "a" + } +} diff --git a/tests/dictionaries/40ifin_validenum/tiramisu/base.py b/tests/dictionaries/40ifin_validenum/tiramisu/base.py index adf637ed..dcc8ddd9 100644 --- a/tests/dictionaries/40ifin_validenum/tiramisu/base.py +++ b/tests/dictionaries/40ifin_validenum/tiramisu/base.py @@ -1,11 +1,20 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) +option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"disabled", "mandatory", "normal"})) +option_6 = ChoiceOption(name="mode_conteneur_actif3", doc="No change", values=('a', 'b', 'c'), default="a", properties=frozenset({"mandatory", "normal"})) +option_4 = OptionDescription(name="general2", doc="general2", children=[option_5, option_6], properties=frozenset({"hidden", "normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/45extra_without_family/00-base.xml b/tests/dictionaries/45extra_without_family/00-base.xml new file mode 100644 index 00000000..5a64ea26 --- /dev/null +++ b/tests/dictionaries/45extra_without_family/00-base.xml @@ -0,0 +1,15 @@ + + + + + /etc/file + + + + + rougail + + + + diff --git a/tests/dictionaries/10load_leadership_description/tiramisu/__init__.py b/tests/dictionaries/45extra_without_family/__init__.py similarity index 100% rename from tests/dictionaries/10load_leadership_description/tiramisu/__init__.py rename to tests/dictionaries/45extra_without_family/__init__.py diff --git a/tests/dictionaries/45extra_without_family/extra_dirs/extra/00-base.xml b/tests/dictionaries/45extra_without_family/extra_dirs/extra/00-base.xml new file mode 100644 index 00000000..120d11a2 --- /dev/null +++ b/tests/dictionaries/45extra_without_family/extra_dirs/extra/00-base.xml @@ -0,0 +1,13 @@ + + + + + + + + + non + extra.my_var + + + diff --git a/tests/dictionaries/45extra_without_family/makedict/after.json b/tests/dictionaries/45extra_without_family/makedict/after.json new file mode 100644 index 00000000..6bfe0036 --- /dev/null +++ b/tests/dictionaries/45extra_without_family/makedict/after.json @@ -0,0 +1,50 @@ +{ + "rougail.my_var": { + "owner": "default", + "value": "rougail" + }, + "extra.my_var": { + "owner": "default", + "value": null + }, + "services.test.files.file.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.file.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.file.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.file.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.file.name": { + "owner": "default", + "value": "/etc/file" + }, + "services.test.files.file.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.file.source": { + "owner": "default", + "value": "file" + }, + "services.test.files.file.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/45extra_without_family/makedict/base.json b/tests/dictionaries/45extra_without_family/makedict/base.json new file mode 100644 index 00000000..632cddc9 --- /dev/null +++ b/tests/dictionaries/45extra_without_family/makedict/base.json @@ -0,0 +1,14 @@ +{ + "rougail.my_var": "rougail", + "extra.my_var": null, + "services.test.files.file.engine": "creole", + "services.test.files.file.group": "root", + "services.test.files.file.included": "no", + "services.test.files.file.mode": "0644", + "services.test.files.file.name": "/etc/file", + "services.test.files.file.owner": "root", + "services.test.files.file.source": "file", + "services.test.files.file.activate": true, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/45extra_without_family/makedict/before.json b/tests/dictionaries/45extra_without_family/makedict/before.json new file mode 100644 index 00000000..6bfe0036 --- /dev/null +++ b/tests/dictionaries/45extra_without_family/makedict/before.json @@ -0,0 +1,50 @@ +{ + "rougail.my_var": { + "owner": "default", + "value": "rougail" + }, + "extra.my_var": { + "owner": "default", + "value": null + }, + "services.test.files.file.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.file.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.file.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.file.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.file.name": { + "owner": "default", + "value": "/etc/file" + }, + "services.test.files.file.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.file.source": { + "owner": "default", + "value": "file" + }, + "services.test.files.file.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/45extra_without_family/result/etc/file b/tests/dictionaries/45extra_without_family/result/etc/file new file mode 100644 index 00000000..7ef82175 --- /dev/null +++ b/tests/dictionaries/45extra_without_family/result/etc/file @@ -0,0 +1,2 @@ +rougail + diff --git a/tests/dictionaries/45extra_without_family/result/tmpfiles.d/rougail.conf b/tests/dictionaries/45extra_without_family/result/tmpfiles.d/rougail.conf new file mode 100644 index 00000000..574c7b82 --- /dev/null +++ b/tests/dictionaries/45extra_without_family/result/tmpfiles.d/rougail.conf @@ -0,0 +1,2 @@ +C /etc/file 0644 root root - /usr/local/lib/etc/file +z /etc/file - - - - - diff --git a/tests/dictionaries/45extra_without_family/tiramisu/base.py b/tests/dictionaries/45extra_without_family/tiramisu/base.py new file mode 100644 index 00000000..92eaec88 --- /dev/null +++ b/tests/dictionaries/45extra_without_family/tiramisu/base.py @@ -0,0 +1,32 @@ +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +option_2 = StrOption(name="my_var", doc="my_var", default="rougail", properties=frozenset({"mandatory", "normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_4 = StrOption(name="my_var", doc="my_var", default=Calculation(func.calc_multi_condition, Params((ParamValue("non")))), properties=frozenset({"normal"})) +option_3 = OptionDescription(name="extra", doc="extra", children=[option_4]) +option_9 = StrOption(name="engine", doc="engine", default="creole") +option_10 = StrOption(name="group", doc="group", default="root") +option_11 = StrOption(name="included", doc="included", default="no") +option_12 = StrOption(name="mode", doc="mode", default="0644") +option_13 = FilenameOption(name="name", doc="name", default="/etc/file") +option_14 = StrOption(name="owner", doc="owner", default="root") +option_15 = StrOption(name="source", doc="source", default="file") +option_16 = BoolOption(name="activate", doc="activate", default=True) +option_8 = OptionDescription(name="file", doc="file", children=[option_9, option_10, option_11, option_12, option_13, option_14, option_15, option_16]) +option_7 = OptionDescription(name="files", doc="files", children=[option_8]) +option_17 = BoolOption(name="activate", doc="activate", default=True) +option_18 = BoolOption(name="manage", doc="manage", default=True) +option_6 = OptionDescription(name="test", doc="test", children=[option_7, option_17, option_18]) +option_5 = OptionDescription(name="services", doc="services", children=[option_6], properties=frozenset({"hidden"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_3, option_5]) diff --git a/tests/dictionaries/45extra_without_family/tmpl/file b/tests/dictionaries/45extra_without_family/tmpl/file new file mode 100644 index 00000000..2277a384 --- /dev/null +++ b/tests/dictionaries/45extra_without_family/tmpl/file @@ -0,0 +1,2 @@ +%%my_var +%%extra.my_var diff --git a/tests/dictionaries/45multi_family/00-base.xml b/tests/dictionaries/45multi_family/00-base.xml new file mode 100644 index 00000000..dfe14720 --- /dev/null +++ b/tests/dictionaries/45multi_family/00-base.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + diff --git a/tests/dictionaries/10load_leadership_name/tiramisu/__init__.py b/tests/dictionaries/45multi_family/__init__.py similarity index 100% rename from tests/dictionaries/10load_leadership_name/tiramisu/__init__.py rename to tests/dictionaries/45multi_family/__init__.py diff --git a/tests/dictionaries/45multi_family/makedict/after.json b/tests/dictionaries/45multi_family/makedict/after.json new file mode 100644 index 00000000..eb04e8af --- /dev/null +++ b/tests/dictionaries/45multi_family/makedict/after.json @@ -0,0 +1,6 @@ +{ + "rougail.base.subfamily.variable": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/45multi_family/makedict/base.json b/tests/dictionaries/45multi_family/makedict/base.json new file mode 100644 index 00000000..75283a63 --- /dev/null +++ b/tests/dictionaries/45multi_family/makedict/base.json @@ -0,0 +1,3 @@ +{ + "rougail.base.subfamily.variable": null +} diff --git a/tests/dictionaries/45multi_family/makedict/before.json b/tests/dictionaries/45multi_family/makedict/before.json new file mode 100644 index 00000000..eb04e8af --- /dev/null +++ b/tests/dictionaries/45multi_family/makedict/before.json @@ -0,0 +1,6 @@ +{ + "rougail.base.subfamily.variable": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/45multi_family/tiramisu/base.py b/tests/dictionaries/45multi_family/tiramisu/base.py new file mode 100644 index 00000000..7e556a1c --- /dev/null +++ b/tests/dictionaries/45multi_family/tiramisu/base.py @@ -0,0 +1,18 @@ +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +option_4 = StrOption(name="variable", doc="variable", properties=frozenset({"normal"})) +option_3 = OptionDescription(name="subfamily", doc="subfamily", children=[option_4], properties=frozenset({"normal"})) +option_2 = OptionDescription(name="base", doc="base", children=[option_3], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/45multi_family_basic/00-base.xml b/tests/dictionaries/45multi_family_basic/00-base.xml new file mode 100644 index 00000000..8b009a15 --- /dev/null +++ b/tests/dictionaries/45multi_family_basic/00-base.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + diff --git a/tests/dictionaries/10load_leadership_normalize_family/__init__.py b/tests/dictionaries/45multi_family_basic/__init__.py similarity index 100% rename from tests/dictionaries/10load_leadership_normalize_family/__init__.py rename to tests/dictionaries/45multi_family_basic/__init__.py diff --git a/tests/dictionaries/45multi_family_basic/makedict/after.json b/tests/dictionaries/45multi_family_basic/makedict/after.json new file mode 100644 index 00000000..eb04e8af --- /dev/null +++ b/tests/dictionaries/45multi_family_basic/makedict/after.json @@ -0,0 +1,6 @@ +{ + "rougail.base.subfamily.variable": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/45multi_family_basic/makedict/base.json b/tests/dictionaries/45multi_family_basic/makedict/base.json new file mode 100644 index 00000000..75283a63 --- /dev/null +++ b/tests/dictionaries/45multi_family_basic/makedict/base.json @@ -0,0 +1,3 @@ +{ + "rougail.base.subfamily.variable": null +} diff --git a/tests/dictionaries/45multi_family_basic/makedict/before.json b/tests/dictionaries/45multi_family_basic/makedict/before.json new file mode 100644 index 00000000..eb04e8af --- /dev/null +++ b/tests/dictionaries/45multi_family_basic/makedict/before.json @@ -0,0 +1,6 @@ +{ + "rougail.base.subfamily.variable": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/45multi_family_basic/tiramisu/base.py b/tests/dictionaries/45multi_family_basic/tiramisu/base.py new file mode 100644 index 00000000..3f1787a3 --- /dev/null +++ b/tests/dictionaries/45multi_family_basic/tiramisu/base.py @@ -0,0 +1,18 @@ +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +option_4 = StrOption(name="variable", doc="variable", properties=frozenset({"basic"})) +option_3 = OptionDescription(name="subfamily", doc="subfamily", children=[option_4], properties=frozenset({"basic"})) +option_2 = OptionDescription(name="base", doc="base", children=[option_3], properties=frozenset({"basic"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/45multi_family_expert/00-base.xml b/tests/dictionaries/45multi_family_expert/00-base.xml new file mode 100644 index 00000000..72c06f5e --- /dev/null +++ b/tests/dictionaries/45multi_family_expert/00-base.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + diff --git a/tests/dictionaries/10load_leadership_normalize_family/tiramisu/__init__.py b/tests/dictionaries/45multi_family_expert/__init__.py similarity index 100% rename from tests/dictionaries/10load_leadership_normalize_family/tiramisu/__init__.py rename to tests/dictionaries/45multi_family_expert/__init__.py diff --git a/tests/dictionaries/45multi_family_expert/makedict/after.json b/tests/dictionaries/45multi_family_expert/makedict/after.json new file mode 100644 index 00000000..eb04e8af --- /dev/null +++ b/tests/dictionaries/45multi_family_expert/makedict/after.json @@ -0,0 +1,6 @@ +{ + "rougail.base.subfamily.variable": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/45multi_family_expert/makedict/base.json b/tests/dictionaries/45multi_family_expert/makedict/base.json new file mode 100644 index 00000000..75283a63 --- /dev/null +++ b/tests/dictionaries/45multi_family_expert/makedict/base.json @@ -0,0 +1,3 @@ +{ + "rougail.base.subfamily.variable": null +} diff --git a/tests/dictionaries/45multi_family_expert/makedict/before.json b/tests/dictionaries/45multi_family_expert/makedict/before.json new file mode 100644 index 00000000..eb04e8af --- /dev/null +++ b/tests/dictionaries/45multi_family_expert/makedict/before.json @@ -0,0 +1,6 @@ +{ + "rougail.base.subfamily.variable": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/45multi_family_expert/tiramisu/base.py b/tests/dictionaries/45multi_family_expert/tiramisu/base.py new file mode 100644 index 00000000..94d393d7 --- /dev/null +++ b/tests/dictionaries/45multi_family_expert/tiramisu/base.py @@ -0,0 +1,18 @@ +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +option_4 = StrOption(name="variable", doc="variable", properties=frozenset({"expert"})) +option_3 = OptionDescription(name="subfamily", doc="subfamily", children=[option_4], properties=frozenset({"expert"})) +option_2 = OptionDescription(name="base", doc="base", children=[option_3], properties=frozenset({"expert"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/45multi_family_order/00-base.xml b/tests/dictionaries/45multi_family_order/00-base.xml new file mode 100644 index 00000000..cd0c86e4 --- /dev/null +++ b/tests/dictionaries/45multi_family_order/00-base.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + diff --git a/tests/dictionaries/10load_leadership_submulti/tiramisu/__init__.py b/tests/dictionaries/45multi_family_order/__init__.py similarity index 100% rename from tests/dictionaries/10load_leadership_submulti/tiramisu/__init__.py rename to tests/dictionaries/45multi_family_order/__init__.py diff --git a/tests/dictionaries/45multi_family_order/makedict/after.json b/tests/dictionaries/45multi_family_order/makedict/after.json new file mode 100644 index 00000000..d5cab640 --- /dev/null +++ b/tests/dictionaries/45multi_family_order/makedict/after.json @@ -0,0 +1,18 @@ +{ + "rougail.variable1": { + "owner": "default", + "value": null + }, + "rougail.base.variable2": { + "owner": "default", + "value": null + }, + "rougail.base.subfamily.variable3": { + "owner": "default", + "value": null + }, + "rougail.base.variable4": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/45multi_family_order/makedict/base.json b/tests/dictionaries/45multi_family_order/makedict/base.json new file mode 100644 index 00000000..617399c0 --- /dev/null +++ b/tests/dictionaries/45multi_family_order/makedict/base.json @@ -0,0 +1,6 @@ +{ + "rougail.variable1": null, + "rougail.base.variable2": null, + "rougail.base.subfamily.variable3": null, + "rougail.base.variable4": null +} diff --git a/tests/dictionaries/45multi_family_order/makedict/before.json b/tests/dictionaries/45multi_family_order/makedict/before.json new file mode 100644 index 00000000..d5cab640 --- /dev/null +++ b/tests/dictionaries/45multi_family_order/makedict/before.json @@ -0,0 +1,18 @@ +{ + "rougail.variable1": { + "owner": "default", + "value": null + }, + "rougail.base.variable2": { + "owner": "default", + "value": null + }, + "rougail.base.subfamily.variable3": { + "owner": "default", + "value": null + }, + "rougail.base.variable4": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/45multi_family_order/tiramisu/base.py b/tests/dictionaries/45multi_family_order/tiramisu/base.py new file mode 100644 index 00000000..a5c092cd --- /dev/null +++ b/tests/dictionaries/45multi_family_order/tiramisu/base.py @@ -0,0 +1,21 @@ +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +option_2 = StrOption(name="variable1", doc="variable1", properties=frozenset({"normal"})) +option_4 = StrOption(name="variable2", doc="variable2", properties=frozenset({"normal"})) +option_6 = StrOption(name="variable3", doc="variable3", properties=frozenset({"normal"})) +option_5 = OptionDescription(name="subfamily", doc="subfamily", children=[option_6], properties=frozenset({"normal"})) +option_7 = StrOption(name="variable4", doc="variable4", properties=frozenset({"normal"})) +option_3 = OptionDescription(name="base", doc="base", children=[option_4, option_5, option_7], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/45without_family/00-base.xml b/tests/dictionaries/45without_family/00-base.xml new file mode 100644 index 00000000..f35c3861 --- /dev/null +++ b/tests/dictionaries/45without_family/00-base.xml @@ -0,0 +1,8 @@ + + + + + + + diff --git a/tests/dictionaries/10load_mandatoryifin/tiramisu/__init__.py b/tests/dictionaries/45without_family/__init__.py similarity index 100% rename from tests/dictionaries/10load_mandatoryifin/tiramisu/__init__.py rename to tests/dictionaries/45without_family/__init__.py diff --git a/tests/dictionaries/45without_family/makedict/after.json b/tests/dictionaries/45without_family/makedict/after.json new file mode 100644 index 00000000..f9e63891 --- /dev/null +++ b/tests/dictionaries/45without_family/makedict/after.json @@ -0,0 +1,6 @@ +{ + "rougail.variable": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/45without_family/makedict/base.json b/tests/dictionaries/45without_family/makedict/base.json new file mode 100644 index 00000000..774ccc4b --- /dev/null +++ b/tests/dictionaries/45without_family/makedict/base.json @@ -0,0 +1,3 @@ +{ + "rougail.variable": null +} diff --git a/tests/dictionaries/45without_family/makedict/before.json b/tests/dictionaries/45without_family/makedict/before.json new file mode 100644 index 00000000..f9e63891 --- /dev/null +++ b/tests/dictionaries/45without_family/makedict/before.json @@ -0,0 +1,6 @@ +{ + "rougail.variable": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/45without_family/tiramisu/base.py b/tests/dictionaries/45without_family/tiramisu/base.py new file mode 100644 index 00000000..678c2bed --- /dev/null +++ b/tests/dictionaries/45without_family/tiramisu/base.py @@ -0,0 +1,16 @@ +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +option_2 = StrOption(name="variable", doc="variable", properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/50exists_exists/00-base.xml b/tests/dictionaries/50exists_exists/00-base.xml index f4f4f61f..10cb29e4 100644 --- a/tests/dictionaries/50exists_exists/00-base.xml +++ b/tests/dictionaries/50exists_exists/00-base.xml @@ -1,22 +1,12 @@ - - - - + - - - - - - - - diff --git a/tests/dictionaries/50exists_exists/01-base.xml b/tests/dictionaries/50exists_exists/01-base.xml index 0376408d..00c05dad 100644 --- a/tests/dictionaries/50exists_exists/01-base.xml +++ b/tests/dictionaries/50exists_exists/01-base.xml @@ -1,22 +1,12 @@ - - - - + - + oui - - - - - - - diff --git a/tests/dictionaries/50exists_exists/makedict/after.json b/tests/dictionaries/50exists_exists/makedict/after.json new file mode 100644 index 00000000..2e6c541d --- /dev/null +++ b/tests/dictionaries/50exists_exists/makedict/after.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/50exists_exists/makedict/base.json b/tests/dictionaries/50exists_exists/makedict/base.json index 797595b0..25056378 100644 --- a/tests/dictionaries/50exists_exists/makedict/base.json +++ b/tests/dictionaries/50exists_exists/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "non"} +{ + "rougail.general.mode_conteneur_actif": "non" +} diff --git a/tests/dictionaries/50exists_exists/makedict/before.json b/tests/dictionaries/50exists_exists/makedict/before.json new file mode 100644 index 00000000..2e6c541d --- /dev/null +++ b/tests/dictionaries/50exists_exists/makedict/before.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/50exists_exists/tiramisu/base.py b/tests/dictionaries/50exists_exists/tiramisu/base.py index 53cf044e..deb9cbf1 100644 --- a/tests/dictionaries/50exists_exists/tiramisu/base.py +++ b/tests/dictionaries/50exists_exists/tiramisu/base.py @@ -1,14 +1,17 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='Description', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="mode_conteneur_actif", doc="Description", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/50redefine_description/00-base.xml b/tests/dictionaries/50redefine_description/00-base.xml index c973121f..9ea33030 100644 --- a/tests/dictionaries/50redefine_description/00-base.xml +++ b/tests/dictionaries/50redefine_description/00-base.xml @@ -1,22 +1,12 @@ - - - - + - - - - - - - - diff --git a/tests/dictionaries/50redefine_description/01-redefine.xml b/tests/dictionaries/50redefine_description/01-redefine.xml index bef6be40..0ee2789b 100644 --- a/tests/dictionaries/50redefine_description/01-redefine.xml +++ b/tests/dictionaries/50redefine_description/01-redefine.xml @@ -1,20 +1,10 @@ - - - - + - - - - - - - diff --git a/tests/dictionaries/50redefine_description/makedict/after.json b/tests/dictionaries/50redefine_description/makedict/after.json new file mode 100644 index 00000000..2e6c541d --- /dev/null +++ b/tests/dictionaries/50redefine_description/makedict/after.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/50redefine_description/makedict/base.json b/tests/dictionaries/50redefine_description/makedict/base.json index 797595b0..25056378 100644 --- a/tests/dictionaries/50redefine_description/makedict/base.json +++ b/tests/dictionaries/50redefine_description/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "non"} +{ + "rougail.general.mode_conteneur_actif": "non" +} diff --git a/tests/dictionaries/50redefine_description/makedict/before.json b/tests/dictionaries/50redefine_description/makedict/before.json new file mode 100644 index 00000000..2e6c541d --- /dev/null +++ b/tests/dictionaries/50redefine_description/makedict/before.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/50redefine_description/tiramisu/base.py b/tests/dictionaries/50redefine_description/tiramisu/base.py index be7a8196..792e2176 100644 --- a/tests/dictionaries/50redefine_description/tiramisu/base.py +++ b/tests/dictionaries/50redefine_description/tiramisu/base.py @@ -1,14 +1,17 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='Redefined', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="mode_conteneur_actif", doc="Redefined", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/51exists_nonexists/00-base.xml b/tests/dictionaries/51exists_nonexists/00-base.xml index adecfbe4..68826787 100644 --- a/tests/dictionaries/51exists_nonexists/00-base.xml +++ b/tests/dictionaries/51exists_nonexists/00-base.xml @@ -1,25 +1,15 @@ - - - - + - + non - - - - - - - - diff --git a/tests/dictionaries/51exists_nonexists/01-base.xml b/tests/dictionaries/51exists_nonexists/01-base.xml index edd34100..fd4dd26d 100644 --- a/tests/dictionaries/51exists_nonexists/01-base.xml +++ b/tests/dictionaries/51exists_nonexists/01-base.xml @@ -1,22 +1,12 @@ - - - - + - + oui - - - - - - - diff --git a/tests/dictionaries/51exists_nonexists/makedict/after.json b/tests/dictionaries/51exists_nonexists/makedict/after.json new file mode 100644 index 00000000..b9d4ee93 --- /dev/null +++ b/tests/dictionaries/51exists_nonexists/makedict/after.json @@ -0,0 +1,14 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif1": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif2": { + "owner": "default", + "value": "oui" + } +} diff --git a/tests/dictionaries/51exists_nonexists/makedict/base.json b/tests/dictionaries/51exists_nonexists/makedict/base.json index 701610f6..4eee7b61 100644 --- a/tests/dictionaries/51exists_nonexists/makedict/base.json +++ b/tests/dictionaries/51exists_nonexists/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif1": "non", "rougail.general.mode_conteneur_actif2": "oui"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif1": "non", + "rougail.general.mode_conteneur_actif2": "oui" +} diff --git a/tests/dictionaries/51exists_nonexists/makedict/before.json b/tests/dictionaries/51exists_nonexists/makedict/before.json new file mode 100644 index 00000000..b9d4ee93 --- /dev/null +++ b/tests/dictionaries/51exists_nonexists/makedict/before.json @@ -0,0 +1,14 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif1": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif2": { + "owner": "default", + "value": "oui" + } +} diff --git a/tests/dictionaries/51exists_nonexists/tiramisu/base.py b/tests/dictionaries/51exists_nonexists/tiramisu/base.py index 7562d282..f5df0733 100644 --- a/tests/dictionaries/51exists_nonexists/tiramisu/base.py +++ b/tests/dictionaries/51exists_nonexists/tiramisu/base.py @@ -1,16 +1,19 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='Description', multi=False, default='non', values=('oui', 'non')) -option_4 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif1', doc='Description', multi=False, default='non', values=('oui', 'non')) -option_5 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif2', doc='New description', multi=False, default='oui', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="mode_conteneur_actif", doc="Description", default="non", properties=frozenset({"mandatory", "normal"})) +option_4 = StrOption(name="mode_conteneur_actif1", doc="Description", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_5 = StrOption(name="mode_conteneur_actif2", doc="New description", default="oui", properties=frozenset({"mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/51exists_redefine/00-base.xml b/tests/dictionaries/51exists_redefine/00-base.xml new file mode 100644 index 00000000..10cb29e4 --- /dev/null +++ b/tests/dictionaries/51exists_redefine/00-base.xml @@ -0,0 +1,12 @@ + + + + + + + + + diff --git a/tests/dictionaries/51exists_redefine/01-base.xml b/tests/dictionaries/51exists_redefine/01-base.xml new file mode 100644 index 00000000..73028b97 --- /dev/null +++ b/tests/dictionaries/51exists_redefine/01-base.xml @@ -0,0 +1,15 @@ + + + + + + oui + + + oui + + + + + diff --git a/tests/dictionaries/10load_multivalue/tiramisu/__init__.py b/tests/dictionaries/51exists_redefine/__init__.py similarity index 100% rename from tests/dictionaries/10load_multivalue/tiramisu/__init__.py rename to tests/dictionaries/51exists_redefine/__init__.py diff --git a/tests/dictionaries/51exists_redefine/makedict/after.json b/tests/dictionaries/51exists_redefine/makedict/after.json new file mode 100644 index 00000000..3a4c0953 --- /dev/null +++ b/tests/dictionaries/51exists_redefine/makedict/after.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "oui" + } +} diff --git a/tests/dictionaries/51exists_redefine/makedict/base.json b/tests/dictionaries/51exists_redefine/makedict/base.json new file mode 100644 index 00000000..50112b17 --- /dev/null +++ b/tests/dictionaries/51exists_redefine/makedict/base.json @@ -0,0 +1,3 @@ +{ + "rougail.general.mode_conteneur_actif": "oui" +} diff --git a/tests/dictionaries/51exists_redefine/makedict/before.json b/tests/dictionaries/51exists_redefine/makedict/before.json new file mode 100644 index 00000000..3a4c0953 --- /dev/null +++ b/tests/dictionaries/51exists_redefine/makedict/before.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "oui" + } +} diff --git a/tests/dictionaries/51exists_redefine/tiramisu/base.py b/tests/dictionaries/51exists_redefine/tiramisu/base.py new file mode 100644 index 00000000..de4748b5 --- /dev/null +++ b/tests/dictionaries/51exists_redefine/tiramisu/base.py @@ -0,0 +1,17 @@ +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +option_3 = StrOption(name="mode_conteneur_actif", doc="Description", default="oui", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/51redefine_auto/00-base.xml b/tests/dictionaries/51redefine_auto/00-base.xml index 086c1e48..9155e418 100644 --- a/tests/dictionaries/51redefine_auto/00-base.xml +++ b/tests/dictionaries/51redefine_auto/00-base.xml @@ -1,25 +1,19 @@ - - - - + - - - + non + mode_conteneur_actif - - - diff --git a/tests/dictionaries/51redefine_auto/01-base.xml b/tests/dictionaries/51redefine_auto/01-base.xml index b7b6a0fb..c45f1e0a 100644 --- a/tests/dictionaries/51redefine_auto/01-base.xml +++ b/tests/dictionaries/51redefine_auto/01-base.xml @@ -1,21 +1,15 @@ - - - - + - - + non + mode_conteneur_actif - - - diff --git a/tests/dictionaries/51redefine_auto/makedict/after.json b/tests/dictionaries/51redefine_auto/makedict/after.json new file mode 100644 index 00000000..da5b8acc --- /dev/null +++ b/tests/dictionaries/51redefine_auto/makedict/after.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/51redefine_auto/makedict/base.json b/tests/dictionaries/51redefine_auto/makedict/base.json index dc0cf526..ab81a62f 100644 --- a/tests/dictionaries/51redefine_auto/makedict/base.json +++ b/tests/dictionaries/51redefine_auto/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": null} +{ + "rougail.general.mode_conteneur_actif": null +} diff --git a/tests/dictionaries/51redefine_auto/makedict/before.json b/tests/dictionaries/51redefine_auto/makedict/before.json new file mode 100644 index 00000000..da5b8acc --- /dev/null +++ b/tests/dictionaries/51redefine_auto/makedict/before.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/51redefine_auto/tiramisu/base.py b/tests/dictionaries/51redefine_auto/tiramisu/base.py index d799758c..213df46a 100644 --- a/tests/dictionaries/51redefine_auto/tiramisu/base.py +++ b/tests/dictionaries/51redefine_auto/tiramisu/base.py @@ -1,14 +1,17 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default=Calculation(func.concat, Params((), kwargs={'valeur': ParamValue("non")})), values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.concat, Params((), kwargs={'valeur': ParamValue("non")})), properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/51redefine_autofill/00-base.xml b/tests/dictionaries/51redefine_autofill/00-base.xml index 39d001c1..e34cc1cb 100644 --- a/tests/dictionaries/51redefine_autofill/00-base.xml +++ b/tests/dictionaries/51redefine_autofill/00-base.xml @@ -1,25 +1,19 @@ - - - - + - - - + oui + mode_conteneur_actif - - - diff --git a/tests/dictionaries/51redefine_autofill/01-base.xml b/tests/dictionaries/51redefine_autofill/01-base.xml index ab6b8177..741e0d31 100644 --- a/tests/dictionaries/51redefine_autofill/01-base.xml +++ b/tests/dictionaries/51redefine_autofill/01-base.xml @@ -1,21 +1,15 @@ - - - - + - - + non + mode_conteneur_actif - - - diff --git a/tests/dictionaries/51redefine_autofill/makedict/after.json b/tests/dictionaries/51redefine_autofill/makedict/after.json new file mode 100644 index 00000000..da5b8acc --- /dev/null +++ b/tests/dictionaries/51redefine_autofill/makedict/after.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/51redefine_autofill/makedict/base.json b/tests/dictionaries/51redefine_autofill/makedict/base.json index dc0cf526..ab81a62f 100644 --- a/tests/dictionaries/51redefine_autofill/makedict/base.json +++ b/tests/dictionaries/51redefine_autofill/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": null} +{ + "rougail.general.mode_conteneur_actif": null +} diff --git a/tests/dictionaries/51redefine_autofill/makedict/before.json b/tests/dictionaries/51redefine_autofill/makedict/before.json new file mode 100644 index 00000000..da5b8acc --- /dev/null +++ b/tests/dictionaries/51redefine_autofill/makedict/before.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/51redefine_autofill/tiramisu/base.py b/tests/dictionaries/51redefine_autofill/tiramisu/base.py index 374d3f5a..09b30dd5 100644 --- a/tests/dictionaries/51redefine_autofill/tiramisu/base.py +++ b/tests/dictionaries/51redefine_autofill/tiramisu/base.py @@ -1,14 +1,17 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default=Calculation(func.concat, Params((), kwargs={'valeur': ParamValue("non")})), values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.concat, Params((), kwargs={'valeur': ParamValue("non")})), properties=frozenset({"normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/51redefine_family/00-base.xml b/tests/dictionaries/51redefine_family/00-base.xml index 8b34f2c9..5eeb4f94 100644 --- a/tests/dictionaries/51redefine_family/00-base.xml +++ b/tests/dictionaries/51redefine_family/00-base.xml @@ -1,20 +1,16 @@ - - - - + - - @@ -23,9 +19,6 @@ general2 - - - diff --git a/tests/dictionaries/51redefine_family/01-base.xml b/tests/dictionaries/51redefine_family/01-base.xml index f341f9e2..a7d68103 100644 --- a/tests/dictionaries/51redefine_family/01-base.xml +++ b/tests/dictionaries/51redefine_family/01-base.xml @@ -1,20 +1,10 @@ - - - - + non - - - - - - - diff --git a/tests/dictionaries/51redefine_family/makedict/after.json b/tests/dictionaries/51redefine_family/makedict/after.json new file mode 100644 index 00000000..18c09ea3 --- /dev/null +++ b/tests/dictionaries/51redefine_family/makedict/after.json @@ -0,0 +1,10 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general2.mode_conteneur_actif2": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/51redefine_family/makedict/base.json b/tests/dictionaries/51redefine_family/makedict/base.json index 54b3faed..1b9934fc 100644 --- a/tests/dictionaries/51redefine_family/makedict/base.json +++ b/tests/dictionaries/51redefine_family/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general2.mode_conteneur_actif2": "non"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general2.mode_conteneur_actif2": "non" +} diff --git a/tests/dictionaries/51redefine_family/makedict/before.json b/tests/dictionaries/51redefine_family/makedict/before.json new file mode 100644 index 00000000..18c09ea3 --- /dev/null +++ b/tests/dictionaries/51redefine_family/makedict/before.json @@ -0,0 +1,10 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general2.mode_conteneur_actif2": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/51redefine_family/tiramisu/base.py b/tests/dictionaries/51redefine_family/tiramisu/base.py index fb36bd02..93b17ad1 100644 --- a/tests/dictionaries/51redefine_family/tiramisu/base.py +++ b/tests/dictionaries/51redefine_family/tiramisu/base.py @@ -1,16 +1,19 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3]) -option_5 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif2', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_4 = OptionDescription(name='general2', doc='general2', properties=frozenset({'hidden', 'normal', Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))}), children=[option_5]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2, option_4]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) +option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_4 = OptionDescription(name="general2", doc="general2", children=[option_5], properties=frozenset({"hidden", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")}))})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/51redefine_fill/00-base.xml b/tests/dictionaries/51redefine_fill/00-base.xml index 39d001c1..e34cc1cb 100644 --- a/tests/dictionaries/51redefine_fill/00-base.xml +++ b/tests/dictionaries/51redefine_fill/00-base.xml @@ -1,25 +1,19 @@ - - - - + - - - + oui + mode_conteneur_actif - - - diff --git a/tests/dictionaries/51redefine_fill/01-base.xml b/tests/dictionaries/51redefine_fill/01-base.xml index b7b6a0fb..c45f1e0a 100644 --- a/tests/dictionaries/51redefine_fill/01-base.xml +++ b/tests/dictionaries/51redefine_fill/01-base.xml @@ -1,21 +1,15 @@ - - - - + - - + non + mode_conteneur_actif - - - diff --git a/tests/dictionaries/51redefine_fill/makedict/after.json b/tests/dictionaries/51redefine_fill/makedict/after.json new file mode 100644 index 00000000..da5b8acc --- /dev/null +++ b/tests/dictionaries/51redefine_fill/makedict/after.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/51redefine_fill/makedict/base.json b/tests/dictionaries/51redefine_fill/makedict/base.json index dc0cf526..ab81a62f 100644 --- a/tests/dictionaries/51redefine_fill/makedict/base.json +++ b/tests/dictionaries/51redefine_fill/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": null} +{ + "rougail.general.mode_conteneur_actif": null +} diff --git a/tests/dictionaries/51redefine_fill/makedict/before.json b/tests/dictionaries/51redefine_fill/makedict/before.json new file mode 100644 index 00000000..da5b8acc --- /dev/null +++ b/tests/dictionaries/51redefine_fill/makedict/before.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/51redefine_fill/tiramisu/base.py b/tests/dictionaries/51redefine_fill/tiramisu/base.py index d799758c..213df46a 100644 --- a/tests/dictionaries/51redefine_fill/tiramisu/base.py +++ b/tests/dictionaries/51redefine_fill/tiramisu/base.py @@ -1,14 +1,17 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default=Calculation(func.concat, Params((), kwargs={'valeur': ParamValue("non")})), values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.concat, Params((), kwargs={'valeur': ParamValue("non")})), properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/51redefine_fillauto/00-base.xml b/tests/dictionaries/51redefine_fillauto/00-base.xml index 833b6e54..75cf7960 100644 --- a/tests/dictionaries/51redefine_fillauto/00-base.xml +++ b/tests/dictionaries/51redefine_fillauto/00-base.xml @@ -1,25 +1,19 @@ - - - - + - + non - - + oui + mode_conteneur_actif - - - diff --git a/tests/dictionaries/51redefine_fillauto/01-base.xml b/tests/dictionaries/51redefine_fillauto/01-base.xml index 3a960564..6e85da2f 100644 --- a/tests/dictionaries/51redefine_fillauto/01-base.xml +++ b/tests/dictionaries/51redefine_fillauto/01-base.xml @@ -1,21 +1,15 @@ - - - - + - - + non + mode_conteneur_actif - - - diff --git a/tests/dictionaries/51redefine_fillauto/makedict/after.json b/tests/dictionaries/51redefine_fillauto/makedict/after.json new file mode 100644 index 00000000..da5b8acc --- /dev/null +++ b/tests/dictionaries/51redefine_fillauto/makedict/after.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/51redefine_fillauto/makedict/base.json b/tests/dictionaries/51redefine_fillauto/makedict/base.json index dc0cf526..ab81a62f 100644 --- a/tests/dictionaries/51redefine_fillauto/makedict/base.json +++ b/tests/dictionaries/51redefine_fillauto/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": null} +{ + "rougail.general.mode_conteneur_actif": null +} diff --git a/tests/dictionaries/51redefine_fillauto/makedict/before.json b/tests/dictionaries/51redefine_fillauto/makedict/before.json new file mode 100644 index 00000000..da5b8acc --- /dev/null +++ b/tests/dictionaries/51redefine_fillauto/makedict/before.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/51redefine_fillauto/tiramisu/base.py b/tests/dictionaries/51redefine_fillauto/tiramisu/base.py index d799758c..213df46a 100644 --- a/tests/dictionaries/51redefine_fillauto/tiramisu/base.py +++ b/tests/dictionaries/51redefine_fillauto/tiramisu/base.py @@ -1,14 +1,17 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default=Calculation(func.concat, Params((), kwargs={'valeur': ParamValue("non")})), values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default=Calculation(func.concat, Params((), kwargs={'valeur': ParamValue("non")})), properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/51redefine_help/00-base.xml b/tests/dictionaries/51redefine_help/00-base.xml index 64d717c8..7d3c5409 100644 --- a/tests/dictionaries/51redefine_help/00-base.xml +++ b/tests/dictionaries/51redefine_help/00-base.xml @@ -1,25 +1,12 @@ - - - - + - - - - - - - - redefine help - redefine help family - - diff --git a/tests/dictionaries/51redefine_help/01-base.xml b/tests/dictionaries/51redefine_help/01-base.xml index 480c426b..9a3aab1e 100644 --- a/tests/dictionaries/51redefine_help/01-base.xml +++ b/tests/dictionaries/51redefine_help/01-base.xml @@ -1,17 +1,10 @@ - - - - + + + + - - - - - - redefine help ok - redefine help family ok - - diff --git a/tests/dictionaries/51redefine_help/makedict/after.json b/tests/dictionaries/51redefine_help/makedict/after.json new file mode 100644 index 00000000..2e6c541d --- /dev/null +++ b/tests/dictionaries/51redefine_help/makedict/after.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/51redefine_help/makedict/base.json b/tests/dictionaries/51redefine_help/makedict/base.json index 797595b0..25056378 100644 --- a/tests/dictionaries/51redefine_help/makedict/base.json +++ b/tests/dictionaries/51redefine_help/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "non"} +{ + "rougail.general.mode_conteneur_actif": "non" +} diff --git a/tests/dictionaries/51redefine_help/makedict/before.json b/tests/dictionaries/51redefine_help/makedict/before.json new file mode 100644 index 00000000..2e6c541d --- /dev/null +++ b/tests/dictionaries/51redefine_help/makedict/before.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/51redefine_help/tiramisu/base.py b/tests/dictionaries/51redefine_help/tiramisu/base.py index 61d03acf..d7a3b246 100644 --- a/tests/dictionaries/51redefine_help/tiramisu/base.py +++ b/tests/dictionaries/51redefine_help/tiramisu/base.py @@ -1,16 +1,19 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='redefine help', multi=False, default='non', values=('oui', 'non')) -option_3.impl_set_information("help", "redefine help ok") -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3]) -option_2.impl_set_information("help", "redefine help family ok") -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="mode_conteneur_actif", doc="redefine help", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_3.impl_set_information('help', "redefine help ok") +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) +option_2.impl_set_information('help', "redefine help family ok") +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/51redefine_hidden/00-base.xml b/tests/dictionaries/51redefine_hidden/00-base.xml index b473ea15..4708db54 100644 --- a/tests/dictionaries/51redefine_hidden/00-base.xml +++ b/tests/dictionaries/51redefine_hidden/00-base.xml @@ -1,22 +1,12 @@ - - - - + - + non - - - - - - - diff --git a/tests/dictionaries/51redefine_hidden/01-redefine.xml b/tests/dictionaries/51redefine_hidden/01-redefine.xml index 65d1eeaa..07359c71 100644 --- a/tests/dictionaries/51redefine_hidden/01-redefine.xml +++ b/tests/dictionaries/51redefine_hidden/01-redefine.xml @@ -1,20 +1,10 @@ - - - - + - - - - - - - diff --git a/tests/dictionaries/51redefine_hidden/makedict/after.json b/tests/dictionaries/51redefine_hidden/makedict/after.json new file mode 100644 index 00000000..2e6c541d --- /dev/null +++ b/tests/dictionaries/51redefine_hidden/makedict/after.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/51redefine_hidden/makedict/base.json b/tests/dictionaries/51redefine_hidden/makedict/base.json index 797595b0..25056378 100644 --- a/tests/dictionaries/51redefine_hidden/makedict/base.json +++ b/tests/dictionaries/51redefine_hidden/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "non"} +{ + "rougail.general.mode_conteneur_actif": "non" +} diff --git a/tests/dictionaries/51redefine_hidden/makedict/before.json b/tests/dictionaries/51redefine_hidden/makedict/before.json new file mode 100644 index 00000000..2e6c541d --- /dev/null +++ b/tests/dictionaries/51redefine_hidden/makedict/before.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/51redefine_hidden/tiramisu/base.py b/tests/dictionaries/51redefine_hidden/tiramisu/base.py index aabe91f7..e05e7be1 100644 --- a/tests/dictionaries/51redefine_hidden/tiramisu/base.py +++ b/tests/dictionaries/51redefine_hidden/tiramisu/base.py @@ -1,14 +1,17 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='Redefine hidden', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="mode_conteneur_actif", doc="Redefine hidden", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/51redefine_multi/00-base.xml b/tests/dictionaries/51redefine_multi/00-base.xml index c973121f..9ea33030 100644 --- a/tests/dictionaries/51redefine_multi/00-base.xml +++ b/tests/dictionaries/51redefine_multi/00-base.xml @@ -1,22 +1,12 @@ - - - - + - - - - - - - - diff --git a/tests/dictionaries/51redefine_multi/01-redefine.xml b/tests/dictionaries/51redefine_multi/01-redefine.xml index ef35e190..fee1b09c 100644 --- a/tests/dictionaries/51redefine_multi/01-redefine.xml +++ b/tests/dictionaries/51redefine_multi/01-redefine.xml @@ -1,20 +1,10 @@ - - - - + - - - - - - - diff --git a/tests/dictionaries/10valid_enum_accent/tiramisu/__init__.py b/tests/dictionaries/51redefine_multi/errno_48 similarity index 100% rename from tests/dictionaries/10valid_enum_accent/tiramisu/__init__.py rename to tests/dictionaries/51redefine_multi/errno_48 diff --git a/tests/dictionaries/51redefine_remove_check/00-base.xml b/tests/dictionaries/51redefine_remove_check/00-base.xml index 0fbbb510..d6301851 100644 --- a/tests/dictionaries/51redefine_remove_check/00-base.xml +++ b/tests/dictionaries/51redefine_remove_check/00-base.xml @@ -1,25 +1,19 @@ - - - - + - - + a b c + mode_conteneur_actif - - - diff --git a/tests/dictionaries/51redefine_remove_check/01-base.xml b/tests/dictionaries/51redefine_remove_check/01-base.xml index 2661f4f1..1d0aa09e 100644 --- a/tests/dictionaries/51redefine_remove_check/01-base.xml +++ b/tests/dictionaries/51redefine_remove_check/01-base.xml @@ -1,20 +1,10 @@ - - - - + non - - - - - - - diff --git a/tests/dictionaries/51redefine_remove_check/makedict/after.json b/tests/dictionaries/51redefine_remove_check/makedict/after.json new file mode 100644 index 00000000..2e6c541d --- /dev/null +++ b/tests/dictionaries/51redefine_remove_check/makedict/after.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/51redefine_remove_check/makedict/base.json b/tests/dictionaries/51redefine_remove_check/makedict/base.json index 797595b0..25056378 100644 --- a/tests/dictionaries/51redefine_remove_check/makedict/base.json +++ b/tests/dictionaries/51redefine_remove_check/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "non"} +{ + "rougail.general.mode_conteneur_actif": "non" +} diff --git a/tests/dictionaries/51redefine_remove_check/makedict/before.json b/tests/dictionaries/51redefine_remove_check/makedict/before.json new file mode 100644 index 00000000..2e6c541d --- /dev/null +++ b/tests/dictionaries/51redefine_remove_check/makedict/before.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/51redefine_remove_check/tiramisu/base.py b/tests/dictionaries/51redefine_remove_check/tiramisu/base.py index ce7ab6f0..9d70847b 100644 --- a/tests/dictionaries/51redefine_remove_check/tiramisu/base.py +++ b/tests/dictionaries/51redefine_remove_check/tiramisu/base.py @@ -1,14 +1,17 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = StrOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non') -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/51redefine_remove_condition/00-base.xml b/tests/dictionaries/51redefine_remove_condition/00-base.xml index 9146f0dd..ff3f67bd 100644 --- a/tests/dictionaries/51redefine_remove_condition/00-base.xml +++ b/tests/dictionaries/51redefine_remove_condition/00-base.xml @@ -1,24 +1,20 @@ - - - - + - + non - + non - - @@ -28,9 +24,6 @@ mode_conteneur_actif2 - - - diff --git a/tests/dictionaries/51redefine_remove_condition/01-base.xml b/tests/dictionaries/51redefine_remove_condition/01-base.xml index 205792ab..be01a6ec 100644 --- a/tests/dictionaries/51redefine_remove_condition/01-base.xml +++ b/tests/dictionaries/51redefine_remove_condition/01-base.xml @@ -1,18 +1,8 @@ - - - - + - + - - - - - - - diff --git a/tests/dictionaries/51redefine_remove_condition/makedict/after.json b/tests/dictionaries/51redefine_remove_condition/makedict/after.json new file mode 100644 index 00000000..c1303c5d --- /dev/null +++ b/tests/dictionaries/51redefine_remove_condition/makedict/after.json @@ -0,0 +1,18 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.condition": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif1": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif2": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/51redefine_remove_condition/makedict/base.json b/tests/dictionaries/51redefine_remove_condition/makedict/base.json index ee42ef2d..e21c64e6 100644 --- a/tests/dictionaries/51redefine_remove_condition/makedict/base.json +++ b/tests/dictionaries/51redefine_remove_condition/makedict/base.json @@ -1 +1,6 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.condition": "non", "rougail.general.mode_conteneur_actif1": "non", "rougail.general.mode_conteneur_actif2": "non"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.condition": "non", + "rougail.general.mode_conteneur_actif1": "non", + "rougail.general.mode_conteneur_actif2": "non" +} diff --git a/tests/dictionaries/51redefine_remove_condition/makedict/before.json b/tests/dictionaries/51redefine_remove_condition/makedict/before.json new file mode 100644 index 00000000..c1303c5d --- /dev/null +++ b/tests/dictionaries/51redefine_remove_condition/makedict/before.json @@ -0,0 +1,18 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.condition": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif1": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif2": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/51redefine_remove_condition/tiramisu/base.py b/tests/dictionaries/51redefine_remove_condition/tiramisu/base.py index 94a4442d..411b40d7 100644 --- a/tests/dictionaries/51redefine_remove_condition/tiramisu/base.py +++ b/tests/dictionaries/51redefine_remove_condition/tiramisu/base.py @@ -1,17 +1,20 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='condition', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_5 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif1', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_6 = ChoiceOption(properties=frozenset({'mandatory', 'normal', Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue('oui')}))}), name='mode_conteneur_actif2', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5, option_6]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_4 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_5 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_6 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5, option_6], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/51redefine_removecondition_alltarget/00-base.xml b/tests/dictionaries/51redefine_removecondition_alltarget/00-base.xml deleted file mode 100644 index 7bb861fd..00000000 --- a/tests/dictionaries/51redefine_removecondition_alltarget/00-base.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - non - - - non - - - - - - - - - - oui - mode_conteneur_actif1 - mode_conteneur_actif2 - - - - - - - diff --git a/tests/dictionaries/51redefine_removecondition_alltarget/01-base.xml b/tests/dictionaries/51redefine_removecondition_alltarget/01-base.xml deleted file mode 100644 index ada5ad56..00000000 --- a/tests/dictionaries/51redefine_removecondition_alltarget/01-base.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/tests/dictionaries/51redefine_removecondition_alltarget/makedict/base.json b/tests/dictionaries/51redefine_removecondition_alltarget/makedict/base.json deleted file mode 100644 index ee42ef2d..00000000 --- a/tests/dictionaries/51redefine_removecondition_alltarget/makedict/base.json +++ /dev/null @@ -1 +0,0 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.condition": "non", "rougail.general.mode_conteneur_actif1": "non", "rougail.general.mode_conteneur_actif2": "non"} diff --git a/tests/dictionaries/51redefine_removecondition_alltarget/tiramisu/base.py b/tests/dictionaries/51redefine_removecondition_alltarget/tiramisu/base.py deleted file mode 100644 index fd6facb1..00000000 --- a/tests/dictionaries/51redefine_removecondition_alltarget/tiramisu/base.py +++ /dev/null @@ -1,17 +0,0 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') -for key, value in dict(locals()).items(): - if key != ['imp', 'func']: - setattr(func, key, value) -try: - from tiramisu3 import * -except: - from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='condition', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_5 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif1', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_6 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif2', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4, option_5, option_6]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) diff --git a/tests/dictionaries/51redefine_removecondition_nonautofreeze/00-base.xml b/tests/dictionaries/51redefine_removecondition_nonautofreeze/00-base.xml index 7c42bfd4..3b1f3b45 100644 --- a/tests/dictionaries/51redefine_removecondition_nonautofreeze/00-base.xml +++ b/tests/dictionaries/51redefine_removecondition_nonautofreeze/00-base.xml @@ -1,39 +1,30 @@ - - - - + - - - non - - - non - - - - non - - - - + + no + + + no + + + + no + + - oui - mode_conteneur_actif1 - mode_conteneur_actif2 + yes + my_var1 + my_var2 - - - diff --git a/tests/dictionaries/51redefine_removecondition_nonautofreeze/01-base.xml b/tests/dictionaries/51redefine_removecondition_nonautofreeze/01-base.xml index 205792ab..e9ee2115 100644 --- a/tests/dictionaries/51redefine_removecondition_nonautofreeze/01-base.xml +++ b/tests/dictionaries/51redefine_removecondition_nonautofreeze/01-base.xml @@ -1,18 +1,6 @@ - - - - + - - - - + - - - - - - diff --git a/tests/dictionaries/51redefine_removecondition_nonautofreeze/makedict/after.json b/tests/dictionaries/51redefine_removecondition_nonautofreeze/makedict/after.json new file mode 100644 index 00000000..4f0c7f29 --- /dev/null +++ b/tests/dictionaries/51redefine_removecondition_nonautofreeze/makedict/after.json @@ -0,0 +1,22 @@ +{ + "rougail.my_var": { + "owner": "forced", + "value": "no" + }, + "rougail.condition": { + "owner": "default", + "value": "no" + }, + "rougail.my_var1": { + "owner": "default", + "value": "no" + }, + "rougail.my_var2": { + "owner": "default", + "value": "no" + }, + "rougail.server_deployed": { + "owner": "default", + "value": false + } +} diff --git a/tests/dictionaries/51redefine_removecondition_nonautofreeze/makedict/base.json b/tests/dictionaries/51redefine_removecondition_nonautofreeze/makedict/base.json index a5d0b07e..6f3ba348 100644 --- a/tests/dictionaries/51redefine_removecondition_nonautofreeze/makedict/base.json +++ b/tests/dictionaries/51redefine_removecondition_nonautofreeze/makedict/base.json @@ -1 +1,7 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.condition": "non", "rougail.general.mode_conteneur_actif1": "non", "rougail.general.mode_conteneur_actif2": "non", "rougail.general.module_instancie": "non"} +{ + "rougail.my_var": "no", + "rougail.condition": "no", + "rougail.my_var1": "no", + "rougail.my_var2": "no", + "rougail.server_deployed": false +} diff --git a/tests/dictionaries/51redefine_removecondition_nonautofreeze/makedict/before.json b/tests/dictionaries/51redefine_removecondition_nonautofreeze/makedict/before.json new file mode 100644 index 00000000..7e322dd6 --- /dev/null +++ b/tests/dictionaries/51redefine_removecondition_nonautofreeze/makedict/before.json @@ -0,0 +1,22 @@ +{ + "rougail.my_var": { + "owner": "default", + "value": "no" + }, + "rougail.condition": { + "owner": "default", + "value": "no" + }, + "rougail.my_var1": { + "owner": "default", + "value": "no" + }, + "rougail.my_var2": { + "owner": "default", + "value": "no" + }, + "rougail.server_deployed": { + "owner": "default", + "value": false + } +} diff --git a/tests/dictionaries/51redefine_removecondition_nonautofreeze/tiramisu/base.py b/tests/dictionaries/51redefine_removecondition_nonautofreeze/tiramisu/base.py index 24f08342..bc4a6466 100644 --- a/tests/dictionaries/51redefine_removecondition_nonautofreeze/tiramisu/base.py +++ b/tests/dictionaries/51redefine_removecondition_nonautofreeze/tiramisu/base.py @@ -1,18 +1,20 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_7 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='module_instancie', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_3 = ChoiceOption(properties=frozenset({'auto_freeze', 'basic', 'force_store_value', 'mandatory', Calculation(calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_7, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='condition', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_5 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif1', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_6 = ChoiceOption(properties=frozenset({'mandatory', 'normal', Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue('oui')}))}), name='mode_conteneur_actif2', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'basic'}), children=[option_3, option_4, option_5, option_6, option_7]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_6 = BoolOption(name="server_deployed", doc="server_deployed", default=False, properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_2 = StrOption(name="my_var", doc="my_var", default="no", properties=frozenset({"basic", "force_store_value", "mandatory", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_6, todict=True, notraisepropertyerror=True), 'expected': ParamValue(True)}))})) +option_3 = StrOption(name="condition", doc="condition", default="no", properties=frozenset({"mandatory", "normal"})) +option_4 = StrOption(name="my_var1", doc="my_var1", default="no", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_5 = StrOption(name="my_var2", doc="my_var2", default="no", properties=frozenset({"mandatory", "normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3, option_4, option_5, option_6]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/51redefine_type/00-base.xml b/tests/dictionaries/51redefine_type/00-base.xml index c973121f..9ea33030 100644 --- a/tests/dictionaries/51redefine_type/00-base.xml +++ b/tests/dictionaries/51redefine_type/00-base.xml @@ -1,22 +1,12 @@ - - - - + - - - - - - - - diff --git a/tests/dictionaries/51redefine_type/01-redefine.xml b/tests/dictionaries/51redefine_type/01-redefine.xml index f02740f0..930995cc 100644 --- a/tests/dictionaries/51redefine_type/01-redefine.xml +++ b/tests/dictionaries/51redefine_type/01-redefine.xml @@ -1,20 +1,10 @@ - - - - + - - - - - - - diff --git a/tests/dictionaries/10valid_enum_base/tiramisu/__init__.py b/tests/dictionaries/51redefine_type/errno_48 similarity index 100% rename from tests/dictionaries/10valid_enum_base/tiramisu/__init__.py rename to tests/dictionaries/51redefine_type/errno_48 diff --git a/tests/dictionaries/51redefine_validenum/00-base.xml b/tests/dictionaries/51redefine_validenum/00-base.xml new file mode 100644 index 00000000..b2933fe2 --- /dev/null +++ b/tests/dictionaries/51redefine_validenum/00-base.xml @@ -0,0 +1,18 @@ + + + + + + + + + a + b + c + mode_conteneur_actif + + + + diff --git a/tests/dictionaries/51redefine_validenum/01-redefine.xml b/tests/dictionaries/51redefine_validenum/01-redefine.xml new file mode 100644 index 00000000..fce1d510 --- /dev/null +++ b/tests/dictionaries/51redefine_validenum/01-redefine.xml @@ -0,0 +1,17 @@ + + + + + + + + + + a + b + mode_conteneur_actif + + + + diff --git a/tests/dictionaries/51redefine_validenum/makedict/after.json b/tests/dictionaries/51redefine_validenum/makedict/after.json new file mode 100644 index 00000000..c043df35 --- /dev/null +++ b/tests/dictionaries/51redefine_validenum/makedict/after.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "a" + } +} diff --git a/tests/dictionaries/51redefine_validenum/makedict/base.json b/tests/dictionaries/51redefine_validenum/makedict/base.json new file mode 100644 index 00000000..7ca93417 --- /dev/null +++ b/tests/dictionaries/51redefine_validenum/makedict/base.json @@ -0,0 +1,3 @@ +{ + "rougail.general.mode_conteneur_actif": "a" +} diff --git a/tests/dictionaries/51redefine_validenum/makedict/before.json b/tests/dictionaries/51redefine_validenum/makedict/before.json new file mode 100644 index 00000000..c043df35 --- /dev/null +++ b/tests/dictionaries/51redefine_validenum/makedict/before.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "a" + } +} diff --git a/tests/dictionaries/51redefine_validenum/tiramisu/base.py b/tests/dictionaries/51redefine_validenum/tiramisu/base.py index adf637ed..34de05c3 100644 --- a/tests/dictionaries/51redefine_validenum/tiramisu/base.py +++ b/tests/dictionaries/51redefine_validenum/tiramisu/base.py @@ -1,11 +1,17 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[]) +option_3 = ChoiceOption(name="mode_conteneur_actif", doc="Redefine description", values=('a', 'b'), default="a", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/51redefine_value/00-base.xml b/tests/dictionaries/51redefine_value/00-base.xml index ac8188ca..305b1d08 100644 --- a/tests/dictionaries/51redefine_value/00-base.xml +++ b/tests/dictionaries/51redefine_value/00-base.xml @@ -1,25 +1,15 @@ - - - - + - + non - - - - - - - - diff --git a/tests/dictionaries/51redefine_value/01-redefine.xml b/tests/dictionaries/51redefine_value/01-redefine.xml index 2db49451..2d384c41 100644 --- a/tests/dictionaries/51redefine_value/01-redefine.xml +++ b/tests/dictionaries/51redefine_value/01-redefine.xml @@ -1,22 +1,12 @@ - - - - + oui - - - - - - - diff --git a/tests/dictionaries/51redefine_value/makedict/after.json b/tests/dictionaries/51redefine_value/makedict/after.json new file mode 100644 index 00000000..08d514d4 --- /dev/null +++ b/tests/dictionaries/51redefine_value/makedict/after.json @@ -0,0 +1,10 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif1": { + "owner": "default", + "value": "oui" + } +} diff --git a/tests/dictionaries/51redefine_value/makedict/base.json b/tests/dictionaries/51redefine_value/makedict/base.json index 76f57513..993bf2df 100644 --- a/tests/dictionaries/51redefine_value/makedict/base.json +++ b/tests/dictionaries/51redefine_value/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.mode_conteneur_actif1": "oui"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.mode_conteneur_actif1": "oui" +} diff --git a/tests/dictionaries/51redefine_value/makedict/before.json b/tests/dictionaries/51redefine_value/makedict/before.json new file mode 100644 index 00000000..08d514d4 --- /dev/null +++ b/tests/dictionaries/51redefine_value/makedict/before.json @@ -0,0 +1,10 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.mode_conteneur_actif1": { + "owner": "default", + "value": "oui" + } +} diff --git a/tests/dictionaries/51redefine_value/tiramisu/base.py b/tests/dictionaries/51redefine_value/tiramisu/base.py index 919c8917..e4b863be 100644 --- a/tests/dictionaries/51redefine_value/tiramisu/base.py +++ b/tests/dictionaries/51redefine_value/tiramisu/base.py @@ -1,15 +1,18 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='Redefine value', multi=False, default='non', values=('oui', 'non')) -option_4 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif1', doc='Redefine value', multi=False, default='oui', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="mode_conteneur_actif", doc="Redefine value", default="non", properties=frozenset({"mandatory", "normal"})) +option_4 = StrOption(name="mode_conteneur_actif1", doc="Redefine value", default="oui", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/51remove_fill/00-base.xml b/tests/dictionaries/51remove_fill/00-base.xml index 5bc01db8..725d6f15 100644 --- a/tests/dictionaries/51remove_fill/00-base.xml +++ b/tests/dictionaries/51remove_fill/00-base.xml @@ -1,26 +1,22 @@ - - - - + - - + + oui + + non - - + mode_conteneur_actif1 + mode_conteneur_actif - - - diff --git a/tests/dictionaries/51remove_fill/01-base.xml b/tests/dictionaries/51remove_fill/01-base.xml index a2413e16..f607fb19 100644 --- a/tests/dictionaries/51remove_fill/01-base.xml +++ b/tests/dictionaries/51remove_fill/01-base.xml @@ -1,5 +1,5 @@ - + diff --git a/tests/dictionaries/51remove_fill/makedict/after.json b/tests/dictionaries/51remove_fill/makedict/after.json new file mode 100644 index 00000000..f0a909af --- /dev/null +++ b/tests/dictionaries/51remove_fill/makedict/after.json @@ -0,0 +1,10 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "oui" + }, + "rougail.general.mode_conteneur_actif1": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/51remove_fill/makedict/base.json b/tests/dictionaries/51remove_fill/makedict/base.json index bf7550e6..a13f65aa 100644 --- a/tests/dictionaries/51remove_fill/makedict/base.json +++ b/tests/dictionaries/51remove_fill/makedict/base.json @@ -1 +1,4 @@ -{"rougail.general.mode_conteneur_actif": "oui", "rougail.general.mode_conteneur_actif1": "non"} +{ + "rougail.general.mode_conteneur_actif": "oui", + "rougail.general.mode_conteneur_actif1": "non" +} diff --git a/tests/dictionaries/51remove_fill/makedict/before.json b/tests/dictionaries/51remove_fill/makedict/before.json new file mode 100644 index 00000000..f0a909af --- /dev/null +++ b/tests/dictionaries/51remove_fill/makedict/before.json @@ -0,0 +1,10 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "oui" + }, + "rougail.general.mode_conteneur_actif1": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/51remove_fill/tiramisu/base.py b/tests/dictionaries/51remove_fill/tiramisu/base.py index 0fbc07a3..78ccdb56 100644 --- a/tests/dictionaries/51remove_fill/tiramisu/base.py +++ b/tests/dictionaries/51remove_fill/tiramisu/base.py @@ -1,15 +1,18 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='oui', values=('oui', 'non')) -option_4 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif1', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3, option_4]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"mandatory", "normal"})) +option_4 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/52exists_redefine/00-base.xml b/tests/dictionaries/52exists_redefine/00-base.xml index 90e907b0..39bc3a7b 100644 --- a/tests/dictionaries/52exists_redefine/00-base.xml +++ b/tests/dictionaries/52exists_redefine/00-base.xml @@ -1,22 +1,12 @@ - - - - + - - - - - - - - diff --git a/tests/dictionaries/52exists_redefine/01-base.xml b/tests/dictionaries/52exists_redefine/01-base.xml index bd823df2..1dbe1da7 100644 --- a/tests/dictionaries/52exists_redefine/01-base.xml +++ b/tests/dictionaries/52exists_redefine/01-base.xml @@ -1,22 +1,12 @@ - - - - + non - - - - - - - diff --git a/tests/dictionaries/52exists_redefine/makedict/after.json b/tests/dictionaries/52exists_redefine/makedict/after.json new file mode 100644 index 00000000..2e6c541d --- /dev/null +++ b/tests/dictionaries/52exists_redefine/makedict/after.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/52exists_redefine/makedict/base.json b/tests/dictionaries/52exists_redefine/makedict/base.json index 797595b0..25056378 100644 --- a/tests/dictionaries/52exists_redefine/makedict/base.json +++ b/tests/dictionaries/52exists_redefine/makedict/base.json @@ -1 +1,3 @@ -{"rougail.general.mode_conteneur_actif": "non"} +{ + "rougail.general.mode_conteneur_actif": "non" +} diff --git a/tests/dictionaries/52exists_redefine/makedict/before.json b/tests/dictionaries/52exists_redefine/makedict/before.json new file mode 100644 index 00000000..2e6c541d --- /dev/null +++ b/tests/dictionaries/52exists_redefine/makedict/before.json @@ -0,0 +1,6 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + } +} diff --git a/tests/dictionaries/52exists_redefine/tiramisu/base.py b/tests/dictionaries/52exists_redefine/tiramisu/base.py index 457f5830..47ed77cd 100644 --- a/tests/dictionaries/52exists_redefine/tiramisu/base.py +++ b/tests/dictionaries/52exists_redefine/tiramisu/base.py @@ -1,14 +1,17 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='New description', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1]) +option_3 = StrOption(name="mode_conteneur_actif", doc="New description", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1]) diff --git a/tests/dictionaries/60action_external/00-base.xml b/tests/dictionaries/60action_external/00-base.xml index bc7628d5..46d87131 100644 --- a/tests/dictionaries/60action_external/00-base.xml +++ b/tests/dictionaries/60action_external/00-base.xml @@ -1,22 +1,12 @@ - - - - + - - - - - - - - diff --git a/tests/dictionaries/60action_external/extra_dirs/extra/00-base.xml b/tests/dictionaries/60action_external/extra_dirs/extra/00-base.xml index 607bb5c1..f547fc6e 100644 --- a/tests/dictionaries/60action_external/extra_dirs/extra/00-base.xml +++ b/tests/dictionaries/60action_external/extra_dirs/extra/00-base.xml @@ -1,4 +1,4 @@ - + @@ -10,9 +10,9 @@ - + http://localhost/ + extra.test.calc_url - diff --git a/tests/dictionaries/60action_external/makedict/after.json b/tests/dictionaries/60action_external/makedict/after.json new file mode 100644 index 00000000..8bb18d68 --- /dev/null +++ b/tests/dictionaries/60action_external/makedict/after.json @@ -0,0 +1,14 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "extra.test.delay": { + "owner": "default", + "value": 0 + }, + "extra.test.calc_url": { + "owner": "default", + "value": "http://localhost/" + } +} diff --git a/tests/dictionaries/60action_external/makedict/base.json b/tests/dictionaries/60action_external/makedict/base.json index 0b1ab7e2..553f555e 100644 --- a/tests/dictionaries/60action_external/makedict/base.json +++ b/tests/dictionaries/60action_external/makedict/base.json @@ -1 +1,5 @@ -{"rougail.general.mode_conteneur_actif": "non", "extra.test.delay": 0, "extra.test.calc_url": "http://localhost/"} +{ + "rougail.general.mode_conteneur_actif": "non", + "extra.test.delay": 0, + "extra.test.calc_url": "http://localhost/" +} diff --git a/tests/dictionaries/60action_external/makedict/before.json b/tests/dictionaries/60action_external/makedict/before.json new file mode 100644 index 00000000..8bb18d68 --- /dev/null +++ b/tests/dictionaries/60action_external/makedict/before.json @@ -0,0 +1,14 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "extra.test.delay": { + "owner": "default", + "value": 0 + }, + "extra.test.calc_url": { + "owner": "default", + "value": "http://localhost/" + } +} diff --git a/tests/dictionaries/60action_external/tiramisu/base.py b/tests/dictionaries/60action_external/tiramisu/base.py index 079e5107..60131d82 100644 --- a/tests/dictionaries/60action_external/tiramisu/base.py +++ b/tests/dictionaries/60action_external/tiramisu/base.py @@ -1,18 +1,21 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='général', properties=frozenset({'normal'}), children=[option_3]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_6 = IntOption(properties=frozenset({'mandatory', 'normal'}), name='delay', doc='délai en minutes avant lancement', multi=False, default=0) -option_7 = URLOption(allow_ip=True, allow_without_dot=True, properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'normal'}), name='calc_url', doc='domain', multi=False, default=Calculation(func.calc_val, Params((ParamValue("http://localhost/")), kwargs={}))) -option_5 = OptionDescription(name='test', doc='test', properties=frozenset({'normal'}), children=[option_6, option_7]) -option_4 = OptionDescription(name='extra', doc='extra', children=[option_5]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1, option_4]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="général", children=[option_3], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_6 = IntOption(name="delay", doc="délai en minutes avant lancement", default=0, properties=frozenset({"mandatory", "normal"})) +option_7 = URLOption(name="calc_url", doc="domain", default=Calculation(func.calc_val, Params((ParamValue("http://localhost/")))), allow_ip=True, allow_without_dot=True, properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "normal"})) +option_5 = OptionDescription(name="test", doc="test", children=[option_6, option_7], properties=frozenset({"normal"})) +option_4 = OptionDescription(name="extra", doc="extra", children=[option_5]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_4]) diff --git a/tests/dictionaries/60extra_externalspace/00-base.xml b/tests/dictionaries/60extra_externalspace/00-base.xml deleted file mode 100644 index 4263114a..00000000 --- a/tests/dictionaries/60extra_externalspace/00-base.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/tests/dictionaries/60extra_externalspace/extra_dirs/extra/00-base.xml b/tests/dictionaries/60extra_externalspace/extra_dirs/extra/00-base.xml deleted file mode 100644 index 62370b9f..00000000 --- a/tests/dictionaries/60extra_externalspace/extra_dirs/extra/00-base.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - Exportation de la base de ejabberd - - - - pre - - - - - - diff --git a/tests/dictionaries/60extra_externalspace/extra_dirs/extra1/00-base.xml b/tests/dictionaries/60extra_externalspace/extra_dirs/extra1/00-base.xml deleted file mode 100644 index f5cf6635..00000000 --- a/tests/dictionaries/60extra_externalspace/extra_dirs/extra1/00-base.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - test - - - - - - non - activer_ejabberd - none - daily - - - diff --git a/tests/dictionaries/60extra_externalspaceauto/00-base.xml b/tests/dictionaries/60extra_externalspaceauto/00-base.xml deleted file mode 100644 index 4263114a..00000000 --- a/tests/dictionaries/60extra_externalspaceauto/00-base.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/tests/dictionaries/60extra_externalspaceauto/extra_dirs/extra/00-base.xml b/tests/dictionaries/60extra_externalspaceauto/extra_dirs/extra/00-base.xml deleted file mode 100644 index 62370b9f..00000000 --- a/tests/dictionaries/60extra_externalspaceauto/extra_dirs/extra/00-base.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - Exportation de la base de ejabberd - - - - pre - - - - - - diff --git a/tests/dictionaries/60extra_externalspaceauto/extra_dirs/extra1/00-base.xml b/tests/dictionaries/60extra_externalspaceauto/extra_dirs/extra1/00-base.xml deleted file mode 100644 index 1b015543..00000000 --- a/tests/dictionaries/60extra_externalspaceauto/extra_dirs/extra1/00-base.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - test - - - - - - non - extra.ejabberd.day - none - daily - - - diff --git a/tests/dictionaries/60extra_externalspacecondition/00-base.xml b/tests/dictionaries/60extra_externalspacecondition/00-base.xml index 3067f3c0..a525e91a 100644 --- a/tests/dictionaries/60extra_externalspacecondition/00-base.xml +++ b/tests/dictionaries/60extra_externalspacecondition/00-base.xml @@ -1,28 +1,18 @@ - - - - + - - - non + + + no - - - - - - - - diff --git a/tests/dictionaries/60extra_externalspacecondition/extra_dirs/extra/00-base.xml b/tests/dictionaries/60extra_externalspacecondition/extra_dirs/extra/00-base.xml index 62370b9f..26e4174a 100644 --- a/tests/dictionaries/60extra_externalspacecondition/extra_dirs/extra/00-base.xml +++ b/tests/dictionaries/60extra_externalspacecondition/extra_dirs/extra/00-base.xml @@ -1,6 +1,6 @@ - + @@ -12,6 +12,4 @@ - - diff --git a/tests/dictionaries/60extra_externalspacecondition/extra_dirs/extra1/00-base.xml b/tests/dictionaries/60extra_externalspacecondition/extra_dirs/extra1/00-base.xml index b12a61e9..87424efa 100644 --- a/tests/dictionaries/60extra_externalspacecondition/extra_dirs/extra1/00-base.xml +++ b/tests/dictionaries/60extra_externalspacecondition/extra_dirs/extra1/00-base.xml @@ -1,6 +1,6 @@ - + diff --git a/tests/dictionaries/60extra_externalspacecondition/makedict/after.json b/tests/dictionaries/60extra_externalspacecondition/makedict/after.json new file mode 100644 index 00000000..b2dd92d1 --- /dev/null +++ b/tests/dictionaries/60extra_externalspacecondition/makedict/after.json @@ -0,0 +1,30 @@ +{ + "rougail.general.my_var": { + "owner": "forced", + "value": "no" + }, + "rougail.general.my_var1": { + "owner": "default", + "value": "no" + }, + "rougail.general.server_deployed": { + "owner": "default", + "value": false + }, + "extra.ejabberd.description": { + "owner": "default", + "value": "Exportation de la base de ejabberd" + }, + "extra.ejabberd.day": { + "owner": "default", + "value": "none" + }, + "extra.ejabberd.mode": { + "owner": "default", + "value": "pre" + }, + "extra1.external.description": { + "owner": "default", + "value": "test" + } +} diff --git a/tests/dictionaries/60extra_externalspacecondition/makedict/base.json b/tests/dictionaries/60extra_externalspacecondition/makedict/base.json index e44851be..1c500131 100644 --- a/tests/dictionaries/60extra_externalspacecondition/makedict/base.json +++ b/tests/dictionaries/60extra_externalspacecondition/makedict/base.json @@ -1 +1,9 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.activer_ejabberd": "non", "rougail.general.module_instancie": "non", "extra.ejabberd.description": "Exportation de la base de ejabberd", "extra.ejabberd.day": "none", "extra.ejabberd.mode": "pre", "extra1.external.description": "test"} +{ + "rougail.general.my_var": "no", + "rougail.general.my_var1": "no", + "rougail.general.server_deployed": false, + "extra.ejabberd.description": "Exportation de la base de ejabberd", + "extra.ejabberd.day": "none", + "extra.ejabberd.mode": "pre", + "extra1.external.description": "test" +} diff --git a/tests/dictionaries/60extra_externalspacecondition/makedict/before.json b/tests/dictionaries/60extra_externalspacecondition/makedict/before.json new file mode 100644 index 00000000..c979ff36 --- /dev/null +++ b/tests/dictionaries/60extra_externalspacecondition/makedict/before.json @@ -0,0 +1,30 @@ +{ + "rougail.general.my_var": { + "owner": "default", + "value": "no" + }, + "rougail.general.my_var1": { + "owner": "default", + "value": "no" + }, + "rougail.general.server_deployed": { + "owner": "default", + "value": false + }, + "extra.ejabberd.description": { + "owner": "default", + "value": "Exportation de la base de ejabberd" + }, + "extra.ejabberd.day": { + "owner": "default", + "value": "none" + }, + "extra.ejabberd.mode": { + "owner": "default", + "value": "pre" + }, + "extra1.external.description": { + "owner": "default", + "value": "test" + } +} diff --git a/tests/dictionaries/60extra_externalspacecondition/tiramisu/base.py b/tests/dictionaries/60extra_externalspacecondition/tiramisu/base.py index 2b470570..f6352ae5 100644 --- a/tests/dictionaries/60extra_externalspacecondition/tiramisu/base.py +++ b/tests/dictionaries/60extra_externalspacecondition/tiramisu/base.py @@ -1,24 +1,27 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_5 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='module_instancie', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_3 = ChoiceOption(properties=frozenset({'auto_freeze', 'basic', 'force_store_value', 'mandatory', Calculation(calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_5, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_4 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='activer_ejabberd', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='général', properties=frozenset({'basic'}), children=[option_3, option_4, option_5]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_8 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='description', doc='description', multi=False, default='Exportation de la base de ejabberd') -option_9 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='day', doc='day', multi=False, default='none', values=('none', 'daily', 'weekly', 'monthly')) -option_10 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode', doc='mode', multi=False, default='pre', values=('pre', 'post')) -option_7 = OptionDescription(name='ejabberd', doc='ejabberd', properties=frozenset({'normal'}), children=[option_8, option_9, option_10]) -option_6 = OptionDescription(name='extra', doc='extra', children=[option_7]) -option_13 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='description', doc='description', multi=False, default='test') -option_12 = OptionDescription(name='external', doc='external', properties=frozenset({'normal', Calculation(calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_8, todict=True), 'expected': ParamValue('non')}))}), children=[option_13]) -option_11 = OptionDescription(name='extra1', doc='extra1', children=[option_12]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1, option_6, option_11]) +option_5 = BoolOption(name="server_deployed", doc="server_deployed", default=False, properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_3 = StrOption(name="my_var", doc="my_var", default="no", properties=frozenset({"basic", "force_store_value", "mandatory", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_5, todict=True, notraisepropertyerror=True), 'expected': ParamValue(True)}))})) +option_4 = StrOption(name="my_var1", doc="my_var1", default="no", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="général", children=[option_3, option_4, option_5], properties=frozenset({"basic"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_8 = StrOption(name="description", doc="description", default="Exportation de la base de ejabberd", properties=frozenset({"mandatory", "normal"})) +option_9 = ChoiceOption(name="day", doc="day", values=('none', 'daily', 'weekly', 'monthly'), default="none", properties=frozenset({"mandatory", "normal"})) +option_10 = ChoiceOption(name="mode", doc="mode", values=('pre', 'post'), default="pre", properties=frozenset({"mandatory", "normal"})) +option_7 = OptionDescription(name="ejabberd", doc="ejabberd", children=[option_8, option_9, option_10], properties=frozenset({"normal"})) +option_6 = OptionDescription(name="extra", doc="extra", children=[option_7]) +option_13 = StrOption(name="description", doc="description", default="test", properties=frozenset({"mandatory", "normal"})) +option_12 = OptionDescription(name="external", doc="external", children=[option_13], properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_8, todict=True, notraisepropertyerror=True), 'expected': ParamValue("non")}))})) +option_11 = OptionDescription(name="extra1", doc="extra1", children=[option_12]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6, option_11]) diff --git a/tests/dictionaries/60extra_externalspacecondition2/00-base.xml b/tests/dictionaries/60extra_externalspacecondition2/00-base.xml deleted file mode 100644 index 4263114a..00000000 --- a/tests/dictionaries/60extra_externalspacecondition2/00-base.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/tests/dictionaries/60extra_externalspacecondition2/extra_dirs/extra/00-base.xml b/tests/dictionaries/60extra_externalspacecondition2/extra_dirs/extra/00-base.xml deleted file mode 100644 index 62370b9f..00000000 --- a/tests/dictionaries/60extra_externalspacecondition2/extra_dirs/extra/00-base.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - Exportation de la base de ejabberd - - - - pre - - - - - - diff --git a/tests/dictionaries/60extra_externalspacecondition2/extra_dirs/extra1/00-base.xml b/tests/dictionaries/60extra_externalspacecondition2/extra_dirs/extra1/00-base.xml deleted file mode 100644 index 5b8e3a2d..00000000 --- a/tests/dictionaries/60extra_externalspacecondition2/extra_dirs/extra1/00-base.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - test - - - - - - non - extra.ejabberd - - - diff --git a/tests/dictionaries/60extra_externalspacecondition3/00-base.xml b/tests/dictionaries/60extra_externalspacecondition3/00-base.xml deleted file mode 100644 index 4263114a..00000000 --- a/tests/dictionaries/60extra_externalspacecondition3/00-base.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/tests/dictionaries/60extra_externalspacecondition3/extra_dirs/extra/00-base.xml b/tests/dictionaries/60extra_externalspacecondition3/extra_dirs/extra/00-base.xml deleted file mode 100644 index d850c1b4..00000000 --- a/tests/dictionaries/60extra_externalspacecondition3/extra_dirs/extra/00-base.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - test - - - - - - non - general - - - diff --git a/tests/dictionaries/60extra_group/00-base.xml b/tests/dictionaries/60extra_group/00-base.xml index 6752e5af..268c2024 100644 --- a/tests/dictionaries/60extra_group/00-base.xml +++ b/tests/dictionaries/60extra_group/00-base.xml @@ -1,19 +1,19 @@ - + - + /etc/mailname + /etc/mailname2 - - diff --git a/tests/dictionaries/60extra_group/extra_dirs/extra/00-base.xml b/tests/dictionaries/60extra_group/extra_dirs/extra/00-base.xml index 62ad4b4d..080fdf12 100644 --- a/tests/dictionaries/60extra_group/extra_dirs/extra/00-base.xml +++ b/tests/dictionaries/60extra_group/extra_dirs/extra/00-base.xml @@ -1,6 +1,6 @@ - + diff --git a/tests/dictionaries/60extra_group/makedict/after.json b/tests/dictionaries/60extra_group/makedict/after.json new file mode 100644 index 00000000..9aa0c6bf --- /dev/null +++ b/tests/dictionaries/60extra_group/makedict/after.json @@ -0,0 +1,96 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.activer_ejabberd": { + "owner": "default", + "value": "non" + }, + "extra.ejabberd.description.description": { + "owner": "default", + "value": [ + "test" + ] + }, + "extra.ejabberd.description.mode": { + "owner": [ + "default" + ], + "value": [ + "pre" + ] + }, + "services.test.files.mailname.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.mailname.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.mailname.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.mailname.name": { + "owner": "default", + "value": "/etc/mailname" + }, + "services.test.files.mailname.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.source": { + "owner": "default", + "value": "mailname" + }, + "services.test.files.mailname.activate": { + "owner": "default", + "value": true + }, + "services.test.files.mailname2.engine": { + "owner": "default", + "value": "jinja2" + }, + "services.test.files.mailname2.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname2.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.mailname2.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.mailname2.name": { + "owner": "default", + "value": "/etc/mailname2" + }, + "services.test.files.mailname2.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname2.source": { + "owner": "default", + "value": "mailname2" + }, + "services.test.files.mailname2.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/60extra_group/makedict/base.json b/tests/dictionaries/60extra_group/makedict/base.json index 0e2661fc..43604c9f 100644 --- a/tests/dictionaries/60extra_group/makedict/base.json +++ b/tests/dictionaries/60extra_group/makedict/base.json @@ -1 +1,28 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.activer_ejabberd": "non", "extra.ejabberd.description.description": ["test"], "extra.ejabberd.description.mode": ["pre"], "services.test.files.mailname.group": "root", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.templating": true, "services.test.files.mailname.activate": true} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.activer_ejabberd": "non", + "extra.ejabberd.description.description": [ + { + "extra.ejabberd.description.description": "test", + "extra.ejabberd.description.mode": "pre" + } + ], + "services.test.files.mailname.engine": "creole", + "services.test.files.mailname.group": "root", + "services.test.files.mailname.included": "no", + "services.test.files.mailname.mode": "0644", + "services.test.files.mailname.name": "/etc/mailname", + "services.test.files.mailname.owner": "root", + "services.test.files.mailname.source": "mailname", + "services.test.files.mailname.activate": true, + "services.test.files.mailname2.engine": "jinja2", + "services.test.files.mailname2.group": "root", + "services.test.files.mailname2.included": "no", + "services.test.files.mailname2.mode": "0644", + "services.test.files.mailname2.name": "/etc/mailname2", + "services.test.files.mailname2.owner": "root", + "services.test.files.mailname2.source": "mailname2", + "services.test.files.mailname2.activate": true, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/60extra_group/makedict/before.json b/tests/dictionaries/60extra_group/makedict/before.json new file mode 100644 index 00000000..9aa0c6bf --- /dev/null +++ b/tests/dictionaries/60extra_group/makedict/before.json @@ -0,0 +1,96 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.activer_ejabberd": { + "owner": "default", + "value": "non" + }, + "extra.ejabberd.description.description": { + "owner": "default", + "value": [ + "test" + ] + }, + "extra.ejabberd.description.mode": { + "owner": [ + "default" + ], + "value": [ + "pre" + ] + }, + "services.test.files.mailname.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.mailname.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.mailname.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.mailname.name": { + "owner": "default", + "value": "/etc/mailname" + }, + "services.test.files.mailname.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.source": { + "owner": "default", + "value": "mailname" + }, + "services.test.files.mailname.activate": { + "owner": "default", + "value": true + }, + "services.test.files.mailname2.engine": { + "owner": "default", + "value": "jinja2" + }, + "services.test.files.mailname2.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname2.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.mailname2.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.mailname2.name": { + "owner": "default", + "value": "/etc/mailname2" + }, + "services.test.files.mailname2.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname2.source": { + "owner": "default", + "value": "mailname2" + }, + "services.test.files.mailname2.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/60extra_group/result/etc/mailname b/tests/dictionaries/60extra_group/result/etc/mailname index ecca61d9..dc34cc5b 100644 --- a/tests/dictionaries/60extra_group/result/etc/mailname +++ b/tests/dictionaries/60extra_group/result/etc/mailname @@ -1 +1,11 @@ -pre +contain test +1 +leader: test +follower: pre +supeq +sup +diff +testpre +pretest +leader2: test +follower2: pre diff --git a/tests/dictionaries/60extra_group/result/etc/mailname2 b/tests/dictionaries/60extra_group/result/etc/mailname2 new file mode 100644 index 00000000..dc34cc5b --- /dev/null +++ b/tests/dictionaries/60extra_group/result/etc/mailname2 @@ -0,0 +1,11 @@ +contain test +1 +leader: test +follower: pre +supeq +sup +diff +testpre +pretest +leader2: test +follower2: pre diff --git a/tests/dictionaries/60extra_group/result/tmpfiles.d/rougail.conf b/tests/dictionaries/60extra_group/result/tmpfiles.d/rougail.conf new file mode 100644 index 00000000..7a8d00f4 --- /dev/null +++ b/tests/dictionaries/60extra_group/result/tmpfiles.d/rougail.conf @@ -0,0 +1,4 @@ +C /etc/mailname 0644 root root - /usr/local/lib/etc/mailname +z /etc/mailname - - - - - +C /etc/mailname2 0644 root root - /usr/local/lib/etc/mailname2 +z /etc/mailname2 - - - - - diff --git a/tests/dictionaries/60extra_group/tiramisu/base.py b/tests/dictionaries/60extra_group/tiramisu/base.py index 14e5487c..48bbaf6a 100644 --- a/tests/dictionaries/60extra_group/tiramisu/base.py +++ b/tests/dictionaries/60extra_group/tiramisu/base.py @@ -1,32 +1,46 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_4 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='activer_ejabberd', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='général', properties=frozenset({'normal'}), children=[option_3, option_4]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_8 = StrOption(properties=frozenset({'mandatory'}), name='description', doc='description', multi=True, default=['test']) -option_9 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='mode', doc='mode', multi=True, default_multi='pre') -option_7 = Leadership(name='description', doc='description', properties=frozenset({'normal'}), children=[option_8, option_9]) -option_6 = OptionDescription(name='ejabberd', doc='ejabberd', properties=frozenset({'normal'}), children=[option_7]) -option_5 = OptionDescription(name='extra', doc='extra', children=[option_6]) -option_14 = StrOption(name='group', doc='group', multi=False, default='root') -option_15 = StrOption(name='mode', doc='mode', multi=False, default='0644') -option_16 = StrOption(name='name', doc='name', multi=False, default='/etc/mailname') -option_17 = StrOption(name='owner', doc='owner', multi=False, default='root') -option_18 = StrOption(name='source', doc='source', multi=False, default='mailname') -option_19 = BoolOption(name='templating', doc='templating', multi=False, default=True) -option_20 = BoolOption(name='activate', doc='activate', multi=False, default=True) -option_13 = OptionDescription(name='mailname', doc='mailname', children=[option_14, option_15, option_16, option_17, option_18, option_19, option_20]) -option_12 = OptionDescription(name='files', doc='files', children=[option_13]) -option_11 = OptionDescription(name='test', doc='test', children=[option_12]) -option_11.impl_set_information("manage", True) -option_10 = OptionDescription(name='services', doc='services', properties=frozenset({'hidden'}), children=[option_11]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1, option_5, option_10]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_4 = StrOption(name="activer_ejabberd", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="général", children=[option_3, option_4], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_8 = StrOption(name="description", doc="description", multi=True, default=['test'], properties=frozenset({"mandatory"})) +option_9 = StrOption(name="mode", doc="mode", multi=True, default_multi="pre", properties=frozenset({"mandatory", "normal"})) +option_7 = Leadership(name="description", doc="description", children=[option_8, option_9], properties=frozenset({"normal"})) +option_6 = OptionDescription(name="ejabberd", doc="ejabberd", children=[option_7], properties=frozenset({"normal"})) +option_5 = OptionDescription(name="extra", doc="extra", children=[option_6]) +option_14 = StrOption(name="engine", doc="engine", default="creole") +option_15 = StrOption(name="group", doc="group", default="root") +option_16 = StrOption(name="included", doc="included", default="no") +option_17 = StrOption(name="mode", doc="mode", default="0644") +option_18 = FilenameOption(name="name", doc="name", default="/etc/mailname") +option_19 = StrOption(name="owner", doc="owner", default="root") +option_20 = StrOption(name="source", doc="source", default="mailname") +option_21 = BoolOption(name="activate", doc="activate", default=True) +option_13 = OptionDescription(name="mailname", doc="mailname", children=[option_14, option_15, option_16, option_17, option_18, option_19, option_20, option_21]) +option_23 = StrOption(name="engine", doc="engine", default="jinja2") +option_24 = StrOption(name="group", doc="group", default="root") +option_25 = StrOption(name="included", doc="included", default="no") +option_26 = StrOption(name="mode", doc="mode", default="0644") +option_27 = FilenameOption(name="name", doc="name", default="/etc/mailname2") +option_28 = StrOption(name="owner", doc="owner", default="root") +option_29 = StrOption(name="source", doc="source", default="mailname2") +option_30 = BoolOption(name="activate", doc="activate", default=True) +option_22 = OptionDescription(name="mailname2", doc="mailname2", children=[option_23, option_24, option_25, option_26, option_27, option_28, option_29, option_30]) +option_12 = OptionDescription(name="files", doc="files", children=[option_13, option_22]) +option_31 = BoolOption(name="activate", doc="activate", default=True) +option_32 = BoolOption(name="manage", doc="manage", default=True) +option_11 = OptionDescription(name="test", doc="test", children=[option_12, option_31, option_32]) +option_10 = OptionDescription(name="services", doc="services", children=[option_11], properties=frozenset({"hidden"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_5, option_10]) diff --git a/tests/dictionaries/60extra_group/tmpl/mailname b/tests/dictionaries/60extra_group/tmpl/mailname index da3e807a..de1500e6 100644 --- a/tests/dictionaries/60extra_group/tmpl/mailname +++ b/tests/dictionaries/60extra_group/tmpl/mailname @@ -1,3 +1,35 @@ +%if 'test' in %%extra.ejabberd.description +contain test +%end if +%%len(%%extra.ejabberd.description) +%if 'a' in %%extra.ejabberd.description +contain a +%end if %for %%description in %%extra.ejabberd.description -%%description.mode +leader: %%description +follower: %%description.mode +%if %%description <= %%description.mode +infeq +%end if +%if %%description >= %%description.mode +supeq +%end if +%if %%description < %%description.mode +inf +%end if +%if %%description > %%description.mode +sup +%end if +%if %%description == %%description.mode +eq +%end if +%if %%description != %%description.mode +diff +%end if +%set %%var = %%description + %%description.mode +%%var +%set %%var = %%description.mode + %%description +%%var %end for +leader2: %%extra.ejabberd.description[0] +follower2: %%extra.ejabberd.description[0].mode diff --git a/tests/dictionaries/60extra_group/tmpl/mailname2 b/tests/dictionaries/60extra_group/tmpl/mailname2 new file mode 100644 index 00000000..589c548e --- /dev/null +++ b/tests/dictionaries/60extra_group/tmpl/mailname2 @@ -0,0 +1,33 @@ +{% if 'test' in extra.ejabberd.description -%} +contain test +{% endif -%} +{{ extra.ejabberd.description|length }} +{% if 'a' in extra.ejabberd.description -%} +contain a +{% endif -%} +{% for description in extra.ejabberd.description -%} +leader: {{ description }} +follower: {{ description.mode }} +{% if description <= description.mode -%} +infeq +{% endif -%} +{% if description >= description.mode -%} +supeq +{% endif -%} +{% if description < description.mode -%} +inf +{% endif -%} +{% if description > description.mode -%} +sup +{% endif -%} +{% if description == description.mode -%} +eq +{% endif -%} +{% if description != description.mode -%} +diff +{% endif -%} +{{ description + description.mode }} +{{ description.mode + description }} +{% endfor -%} +leader2: {{ extra.ejabberd.description[0] }} +follower2: {{ extra.ejabberd.description[0].mode }} diff --git a/tests/dictionaries/60extra_help/00-base.xml b/tests/dictionaries/60extra_help/00-base.xml index 22be6cd9..d8156c27 100644 --- a/tests/dictionaries/60extra_help/00-base.xml +++ b/tests/dictionaries/60extra_help/00-base.xml @@ -1,29 +1,22 @@ - + - + /etc/mailname - - - - - - - - diff --git a/tests/dictionaries/60extra_help/extra_dirs/extra/00-base.xml b/tests/dictionaries/60extra_help/extra_dirs/extra/00-base.xml index 15a5a566..e49575c3 100644 --- a/tests/dictionaries/60extra_help/extra_dirs/extra/00-base.xml +++ b/tests/dictionaries/60extra_help/extra_dirs/extra/00-base.xml @@ -1,26 +1,24 @@ - + Exportation de la base de ejabberd - + pre - + non - activer_ejabberd + activer_ejabberd none daily + extra.ejabberd.day - - Test help - diff --git a/tests/dictionaries/60extra_help/makedict/after.json b/tests/dictionaries/60extra_help/makedict/after.json new file mode 100644 index 00000000..5b40c269 --- /dev/null +++ b/tests/dictionaries/60extra_help/makedict/after.json @@ -0,0 +1,62 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.activer_ejabberd": { + "owner": "default", + "value": "non" + }, + "extra.ejabberd.description": { + "owner": "default", + "value": "Exportation de la base de ejabberd" + }, + "extra.ejabberd.day": { + "owner": "default", + "value": null + }, + "extra.ejabberd.mode": { + "owner": "default", + "value": "pre" + }, + "services.test.files.mailname.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.mailname.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.mailname.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.mailname.name": { + "owner": "default", + "value": "/etc/mailname" + }, + "services.test.files.mailname.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.source": { + "owner": "default", + "value": "mailname" + }, + "services.test.files.mailname.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/60extra_help/makedict/base.json b/tests/dictionaries/60extra_help/makedict/base.json index 309d1341..9b605156 100644 --- a/tests/dictionaries/60extra_help/makedict/base.json +++ b/tests/dictionaries/60extra_help/makedict/base.json @@ -1 +1,17 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.activer_ejabberd": "non", "extra.ejabberd.description": "Exportation de la base de ejabberd", "extra.ejabberd.day": null, "extra.ejabberd.mode": "pre", "services.test.files.mailname.group": "root", "services.test.files.mailname.mode": "0644", "services.test.files.mailname.name": "/etc/mailname", "services.test.files.mailname.owner": "root", "services.test.files.mailname.source": "mailname", "services.test.files.mailname.templating": true, "services.test.files.mailname.activate": true} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.activer_ejabberd": "non", + "extra.ejabberd.description": "Exportation de la base de ejabberd", + "extra.ejabberd.day": null, + "extra.ejabberd.mode": "pre", + "services.test.files.mailname.engine": "creole", + "services.test.files.mailname.group": "root", + "services.test.files.mailname.included": "no", + "services.test.files.mailname.mode": "0644", + "services.test.files.mailname.name": "/etc/mailname", + "services.test.files.mailname.owner": "root", + "services.test.files.mailname.source": "mailname", + "services.test.files.mailname.activate": true, + "services.test.activate": true, + "services.test.manage": true +} diff --git a/tests/dictionaries/60extra_help/makedict/before.json b/tests/dictionaries/60extra_help/makedict/before.json new file mode 100644 index 00000000..5b40c269 --- /dev/null +++ b/tests/dictionaries/60extra_help/makedict/before.json @@ -0,0 +1,62 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.activer_ejabberd": { + "owner": "default", + "value": "non" + }, + "extra.ejabberd.description": { + "owner": "default", + "value": "Exportation de la base de ejabberd" + }, + "extra.ejabberd.day": { + "owner": "default", + "value": null + }, + "extra.ejabberd.mode": { + "owner": "default", + "value": "pre" + }, + "services.test.files.mailname.engine": { + "owner": "default", + "value": "creole" + }, + "services.test.files.mailname.group": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.included": { + "owner": "default", + "value": "no" + }, + "services.test.files.mailname.mode": { + "owner": "default", + "value": "0644" + }, + "services.test.files.mailname.name": { + "owner": "default", + "value": "/etc/mailname" + }, + "services.test.files.mailname.owner": { + "owner": "default", + "value": "root" + }, + "services.test.files.mailname.source": { + "owner": "default", + "value": "mailname" + }, + "services.test.files.mailname.activate": { + "owner": "default", + "value": true + }, + "services.test.activate": { + "owner": "default", + "value": true + }, + "services.test.manage": { + "owner": "default", + "value": true + } +} diff --git a/tests/dictionaries/60extra_help/tiramisu/base.py b/tests/dictionaries/60extra_help/tiramisu/base.py index 3d5d5943..fe6f95c3 100644 --- a/tests/dictionaries/60extra_help/tiramisu/base.py +++ b/tests/dictionaries/60extra_help/tiramisu/base.py @@ -1,33 +1,38 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_4 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='activer_ejabberd', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='général', properties=frozenset({'normal'}), children=[option_3, option_4]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_7 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='description', doc='description', multi=False, default='Exportation de la base de ejabberd') -option_8 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='day', doc='day', multi=False, default=Calculation(func.calc_multi_condition, Params((ParamValue("non")), kwargs={'condition_1': ParamOption(option_4, notraisepropertyerror=True, todict=False), 'match': ParamValue("none"), 'mismatch': ParamValue("daily")})), values=('none', 'daily', 'weekly', 'monthly')) -option_8.impl_set_information("help", "Test help") -option_9 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode', doc='mode', multi=False, default='pre', values=('pre', 'post')) -option_6 = OptionDescription(name='ejabberd', doc='ejabberd', properties=frozenset({'normal'}), children=[option_7, option_8, option_9]) -option_5 = OptionDescription(name='extra', doc='extra', children=[option_6]) -option_14 = StrOption(name='group', doc='group', multi=False, default='root') -option_15 = StrOption(name='mode', doc='mode', multi=False, default='0644') -option_16 = StrOption(name='name', doc='name', multi=False, default='/etc/mailname') -option_17 = StrOption(name='owner', doc='owner', multi=False, default='root') -option_18 = StrOption(name='source', doc='source', multi=False, default='mailname') -option_19 = BoolOption(name='templating', doc='templating', multi=False, default=True) -option_20 = BoolOption(name='activate', doc='activate', multi=False, default=True) -option_13 = OptionDescription(name='mailname', doc='mailname', children=[option_14, option_15, option_16, option_17, option_18, option_19, option_20]) -option_12 = OptionDescription(name='files', doc='files', children=[option_13]) -option_11 = OptionDescription(name='test', doc='test', children=[option_12]) -option_11.impl_set_information("manage", True) -option_10 = OptionDescription(name='services', doc='services', properties=frozenset({'hidden'}), children=[option_11]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1, option_5, option_10]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_4 = StrOption(name="activer_ejabberd", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="général", children=[option_3, option_4], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_7 = StrOption(name="description", doc="description", default="Exportation de la base de ejabberd", properties=frozenset({"mandatory", "normal"})) +option_8 = ChoiceOption(name="day", doc="day", values=('none', 'daily', 'weekly', 'monthly'), default=Calculation(func.calc_multi_condition, Params((ParamValue("non")), kwargs={'condition_1': ParamOption(option_4, notraisepropertyerror=True), 'match': ParamValue("none"), 'mismatch': ParamValue("daily")})), properties=frozenset({"mandatory", "normal"})) +option_8.impl_set_information('help', "Test help") +option_9 = ChoiceOption(name="mode", doc="mode", values=('pre', 'post'), default="pre", properties=frozenset({"mandatory", "normal"})) +option_6 = OptionDescription(name="ejabberd", doc="ejabberd", children=[option_7, option_8, option_9], properties=frozenset({"normal"})) +option_5 = OptionDescription(name="extra", doc="extra", children=[option_6]) +option_14 = StrOption(name="engine", doc="engine", default="creole") +option_15 = StrOption(name="group", doc="group", default="root") +option_16 = StrOption(name="included", doc="included", default="no") +option_17 = StrOption(name="mode", doc="mode", default="0644") +option_18 = FilenameOption(name="name", doc="name", default="/etc/mailname") +option_19 = StrOption(name="owner", doc="owner", default="root") +option_20 = StrOption(name="source", doc="source", default="mailname") +option_21 = BoolOption(name="activate", doc="activate", default=True) +option_13 = OptionDescription(name="mailname", doc="mailname", children=[option_14, option_15, option_16, option_17, option_18, option_19, option_20, option_21]) +option_12 = OptionDescription(name="files", doc="files", children=[option_13]) +option_22 = BoolOption(name="activate", doc="activate", default=True) +option_23 = BoolOption(name="manage", doc="manage", default=True) +option_11 = OptionDescription(name="test", doc="test", children=[option_12, option_22, option_23]) +option_10 = OptionDescription(name="services", doc="services", children=[option_11], properties=frozenset({"hidden"})) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_5, option_10]) diff --git a/tests/dictionaries/60extra_load/00-base.xml b/tests/dictionaries/60extra_load/00-base.xml index 2e4fec44..32dae3d3 100644 --- a/tests/dictionaries/60extra_load/00-base.xml +++ b/tests/dictionaries/60extra_load/00-base.xml @@ -1,25 +1,15 @@ - - - - + - - - - - - - - diff --git a/tests/dictionaries/60extra_load/extra_dirs/extra/00-base.xml b/tests/dictionaries/60extra_load/extra_dirs/extra/00-base.xml index 651c2125..ac0557b0 100644 --- a/tests/dictionaries/60extra_load/extra_dirs/extra/00-base.xml +++ b/tests/dictionaries/60extra_load/extra_dirs/extra/00-base.xml @@ -1,6 +1,6 @@ - + @@ -13,11 +13,12 @@ - + non - activer_ejabberd + activer_ejabberd none daily + extra.ejabberd.day diff --git a/tests/dictionaries/60extra_load/makedict/after.json b/tests/dictionaries/60extra_load/makedict/after.json new file mode 100644 index 00000000..383ce093 --- /dev/null +++ b/tests/dictionaries/60extra_load/makedict/after.json @@ -0,0 +1,22 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.activer_ejabberd": { + "owner": "default", + "value": "non" + }, + "extra.ejabberd.description": { + "owner": "default", + "value": "Exportation de la base de ejabberd" + }, + "extra.ejabberd.day": { + "owner": "default", + "value": null + }, + "extra.ejabberd.mode": { + "owner": "default", + "value": "pre" + } +} diff --git a/tests/dictionaries/60extra_load/makedict/base.json b/tests/dictionaries/60extra_load/makedict/base.json index 816c41bd..242a818d 100644 --- a/tests/dictionaries/60extra_load/makedict/base.json +++ b/tests/dictionaries/60extra_load/makedict/base.json @@ -1 +1,7 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.activer_ejabberd": "non", "extra.ejabberd.description": "Exportation de la base de ejabberd", "extra.ejabberd.day": null, "extra.ejabberd.mode": "pre"} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.activer_ejabberd": "non", + "extra.ejabberd.description": "Exportation de la base de ejabberd", + "extra.ejabberd.day": null, + "extra.ejabberd.mode": "pre" +} diff --git a/tests/dictionaries/60extra_load/makedict/before.json b/tests/dictionaries/60extra_load/makedict/before.json new file mode 100644 index 00000000..383ce093 --- /dev/null +++ b/tests/dictionaries/60extra_load/makedict/before.json @@ -0,0 +1,22 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.activer_ejabberd": { + "owner": "default", + "value": "non" + }, + "extra.ejabberd.description": { + "owner": "default", + "value": "Exportation de la base de ejabberd" + }, + "extra.ejabberd.day": { + "owner": "default", + "value": null + }, + "extra.ejabberd.mode": { + "owner": "default", + "value": "pre" + } +} diff --git a/tests/dictionaries/60extra_load/tiramisu/base.py b/tests/dictionaries/60extra_load/tiramisu/base.py index 9d3914dc..d47bb6a3 100644 --- a/tests/dictionaries/60extra_load/tiramisu/base.py +++ b/tests/dictionaries/60extra_load/tiramisu/base.py @@ -1,20 +1,23 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_4 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='activer_ejabberd', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='général', properties=frozenset({'normal'}), children=[option_3, option_4]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_7 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='description', doc='description', multi=False, default='Exportation de la base de ejabberd') -option_8 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='day', doc='day', multi=False, default=Calculation(func.calc_multi_condition, Params((ParamValue("non")), kwargs={'condition_1': ParamOption(option_4, notraisepropertyerror=True, todict=False), 'match': ParamValue("none"), 'mismatch': ParamValue("daily")})), values=('none', 'daily', 'weekly', 'monthly')) -option_9 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode', doc='mode', multi=False, default='pre', values=('pre', 'post')) -option_6 = OptionDescription(name='ejabberd', doc='ejabberd', properties=frozenset({'normal'}), children=[option_7, option_8, option_9]) -option_5 = OptionDescription(name='extra', doc='extra', children=[option_6]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1, option_5]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_4 = StrOption(name="activer_ejabberd", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="général", children=[option_3, option_4], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_7 = StrOption(name="description", doc="description", default="Exportation de la base de ejabberd", properties=frozenset({"mandatory", "normal"})) +option_8 = ChoiceOption(name="day", doc="day", values=('none', 'daily', 'weekly', 'monthly'), default=Calculation(func.calc_multi_condition, Params((ParamValue("non")), kwargs={'condition_1': ParamOption(option_4, notraisepropertyerror=True), 'match': ParamValue("none"), 'mismatch': ParamValue("daily")})), properties=frozenset({"mandatory", "normal"})) +option_9 = ChoiceOption(name="mode", doc="mode", values=('pre', 'post'), default="pre", properties=frozenset({"mandatory", "normal"})) +option_6 = OptionDescription(name="ejabberd", doc="ejabberd", children=[option_7, option_8, option_9], properties=frozenset({"normal"})) +option_5 = OptionDescription(name="extra", doc="extra", children=[option_6]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_5]) diff --git a/tests/dictionaries/60extra_mandatory/00-base.xml b/tests/dictionaries/60extra_mandatory/00-base.xml index 2e4fec44..32dae3d3 100644 --- a/tests/dictionaries/60extra_mandatory/00-base.xml +++ b/tests/dictionaries/60extra_mandatory/00-base.xml @@ -1,25 +1,15 @@ - - - - + - - - - - - - - diff --git a/tests/dictionaries/60extra_mandatory/extra_dirs/extra/00-base.xml b/tests/dictionaries/60extra_mandatory/extra_dirs/extra/00-base.xml index 76cfb57b..c1429053 100644 --- a/tests/dictionaries/60extra_mandatory/extra_dirs/extra/00-base.xml +++ b/tests/dictionaries/60extra_mandatory/extra_dirs/extra/00-base.xml @@ -1,6 +1,6 @@ - + @@ -12,11 +12,12 @@ - + non - activer_ejabberd + activer_ejabberd none daily + extra.ejabberd.day diff --git a/tests/dictionaries/60extra_mandatory/makedict/after.json b/tests/dictionaries/60extra_mandatory/makedict/after.json new file mode 100644 index 00000000..bd4b713a --- /dev/null +++ b/tests/dictionaries/60extra_mandatory/makedict/after.json @@ -0,0 +1,26 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.activer_ejabberd": { + "owner": "default", + "value": "non" + }, + "extra.ejabberd.description": { + "owner": "default", + "value": "Exportation de la base de ejabberd" + }, + "extra.ejabberd.day": { + "owner": "default", + "value": null + }, + "extra.ejabberd.mode": { + "owner": "default", + "value": "pre" + }, + "extra.ejabberd.var1": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/60extra_mandatory/makedict/base.json b/tests/dictionaries/60extra_mandatory/makedict/base.json index 3d194686..1934991a 100644 --- a/tests/dictionaries/60extra_mandatory/makedict/base.json +++ b/tests/dictionaries/60extra_mandatory/makedict/base.json @@ -1 +1,8 @@ -{"rougail.general.mode_conteneur_actif": "non", "rougail.general.activer_ejabberd": "non", "extra.ejabberd.description": "Exportation de la base de ejabberd", "extra.ejabberd.day": null, "extra.ejabberd.mode": "pre", "extra.ejabberd.var1": null} +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.activer_ejabberd": "non", + "extra.ejabberd.description": "Exportation de la base de ejabberd", + "extra.ejabberd.day": null, + "extra.ejabberd.mode": "pre", + "extra.ejabberd.var1": null +} diff --git a/tests/dictionaries/60extra_mandatory/makedict/before.json b/tests/dictionaries/60extra_mandatory/makedict/before.json new file mode 100644 index 00000000..bd4b713a --- /dev/null +++ b/tests/dictionaries/60extra_mandatory/makedict/before.json @@ -0,0 +1,26 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.activer_ejabberd": { + "owner": "default", + "value": "non" + }, + "extra.ejabberd.description": { + "owner": "default", + "value": "Exportation de la base de ejabberd" + }, + "extra.ejabberd.day": { + "owner": "default", + "value": null + }, + "extra.ejabberd.mode": { + "owner": "default", + "value": "pre" + }, + "extra.ejabberd.var1": { + "owner": "default", + "value": null + } +} diff --git a/tests/dictionaries/60extra_mandatory/tiramisu/base.py b/tests/dictionaries/60extra_mandatory/tiramisu/base.py index 212acda1..d9d56446 100644 --- a/tests/dictionaries/60extra_mandatory/tiramisu/base.py +++ b/tests/dictionaries/60extra_mandatory/tiramisu/base.py @@ -1,21 +1,24 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_4 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='activer_ejabberd', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='general', doc='général', properties=frozenset({'normal'}), children=[option_3, option_4]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_7 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='description', doc='description', multi=False, default='Exportation de la base de ejabberd') -option_8 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='day', doc='day', multi=False, default=Calculation(func.calc_multi_condition, Params((ParamValue("non")), kwargs={'condition_1': ParamOption(option_4, notraisepropertyerror=True, todict=False), 'match': ParamValue("none"), 'mismatch': ParamValue("daily")})), values=('none', 'daily', 'weekly', 'monthly')) -option_9 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode', doc='mode', multi=False, default='pre', values=('pre', 'post')) -option_10 = StrOption(properties=frozenset({'basic', 'mandatory'}), name='var1', doc='var1', multi=False) -option_6 = OptionDescription(name='ejabberd', doc='ejabberd', properties=frozenset({'basic'}), children=[option_7, option_8, option_9, option_10]) -option_5 = OptionDescription(name='extra', doc='extra', children=[option_6]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1, option_5]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_4 = StrOption(name="activer_ejabberd", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="général", children=[option_3, option_4], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_7 = StrOption(name="description", doc="description", default="Exportation de la base de ejabberd", properties=frozenset({"mandatory", "normal"})) +option_8 = ChoiceOption(name="day", doc="day", values=('none', 'daily', 'weekly', 'monthly'), default=Calculation(func.calc_multi_condition, Params((ParamValue("non")), kwargs={'condition_1': ParamOption(option_4, notraisepropertyerror=True), 'match': ParamValue("none"), 'mismatch': ParamValue("daily")})), properties=frozenset({"mandatory", "normal"})) +option_9 = ChoiceOption(name="mode", doc="mode", values=('pre', 'post'), default="pre", properties=frozenset({"mandatory", "normal"})) +option_10 = StrOption(name="var1", doc="var1", properties=frozenset({"basic", "mandatory"})) +option_6 = OptionDescription(name="ejabberd", doc="ejabberd", children=[option_7, option_8, option_9, option_10], properties=frozenset({"basic"})) +option_5 = OptionDescription(name="extra", doc="extra", children=[option_6]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_5]) diff --git a/tests/dictionaries/60extra_name_family/00-base.xml b/tests/dictionaries/60extra_name_family/00-base.xml index 7304014f..5f321110 100644 --- a/tests/dictionaries/60extra_name_family/00-base.xml +++ b/tests/dictionaries/60extra_name_family/00-base.xml @@ -1,25 +1,15 @@ - - - - + - - - - - - - - diff --git a/tests/dictionaries/60extra_name_family/extra_dirs/extra/00-base.xml b/tests/dictionaries/60extra_name_family/extra_dirs/extra/00-base.xml index 651c2125..ac0557b0 100644 --- a/tests/dictionaries/60extra_name_family/extra_dirs/extra/00-base.xml +++ b/tests/dictionaries/60extra_name_family/extra_dirs/extra/00-base.xml @@ -1,6 +1,6 @@ - + @@ -13,11 +13,12 @@ - + non - activer_ejabberd + activer_ejabberd none daily + extra.ejabberd.day diff --git a/tests/dictionaries/60extra_name_family/makedict/after.json b/tests/dictionaries/60extra_name_family/makedict/after.json new file mode 100644 index 00000000..19d92883 --- /dev/null +++ b/tests/dictionaries/60extra_name_family/makedict/after.json @@ -0,0 +1,22 @@ +{ + "rougail.extra.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.extra.activer_ejabberd": { + "owner": "default", + "value": "non" + }, + "extra.ejabberd.description": { + "owner": "default", + "value": "Exportation de la base de ejabberd" + }, + "extra.ejabberd.day": { + "owner": "default", + "value": null + }, + "extra.ejabberd.mode": { + "owner": "default", + "value": "pre" + } +} diff --git a/tests/dictionaries/60extra_name_family/makedict/base.json b/tests/dictionaries/60extra_name_family/makedict/base.json index eb7df63a..08a3bf0f 100644 --- a/tests/dictionaries/60extra_name_family/makedict/base.json +++ b/tests/dictionaries/60extra_name_family/makedict/base.json @@ -1 +1,7 @@ -{"rougail.extra.mode_conteneur_actif": "non", "rougail.extra.activer_ejabberd": "non", "extra.ejabberd.description": "Exportation de la base de ejabberd", "extra.ejabberd.day": null, "extra.ejabberd.mode": "pre"} +{ + "rougail.extra.mode_conteneur_actif": "non", + "rougail.extra.activer_ejabberd": "non", + "extra.ejabberd.description": "Exportation de la base de ejabberd", + "extra.ejabberd.day": null, + "extra.ejabberd.mode": "pre" +} diff --git a/tests/dictionaries/60extra_name_family/makedict/before.json b/tests/dictionaries/60extra_name_family/makedict/before.json new file mode 100644 index 00000000..19d92883 --- /dev/null +++ b/tests/dictionaries/60extra_name_family/makedict/before.json @@ -0,0 +1,22 @@ +{ + "rougail.extra.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.extra.activer_ejabberd": { + "owner": "default", + "value": "non" + }, + "extra.ejabberd.description": { + "owner": "default", + "value": "Exportation de la base de ejabberd" + }, + "extra.ejabberd.day": { + "owner": "default", + "value": null + }, + "extra.ejabberd.mode": { + "owner": "default", + "value": "pre" + } +} diff --git a/tests/dictionaries/60extra_name_family/tiramisu/base.py b/tests/dictionaries/60extra_name_family/tiramisu/base.py index 3ea4851e..706f671e 100644 --- a/tests/dictionaries/60extra_name_family/tiramisu/base.py +++ b/tests/dictionaries/60extra_name_family/tiramisu/base.py @@ -1,20 +1,23 @@ -import imp -func = imp.load_source('func', 'tests/dictionaries/../eosfunc/test.py') +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) for key, value in dict(locals()).items(): - if key != ['imp', 'func']: + if key != ['SourceFileLoader', 'func']: setattr(func, key, value) try: from tiramisu3 import * except: from tiramisu import * -from rougail.tiramisu import ConvertDynOptionDescription -option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_4 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='activer_ejabberd', doc='No change', multi=False, default='non', values=('oui', 'non')) -option_2 = OptionDescription(name='extra', doc='extra', properties=frozenset({'normal'}), children=[option_3, option_4]) -option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2]) -option_7 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='description', doc='description', multi=False, default='Exportation de la base de ejabberd') -option_8 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='day', doc='day', multi=False, default=Calculation(func.calc_multi_condition, Params((ParamValue("non")), kwargs={'condition_1': ParamOption(option_4, notraisepropertyerror=True, todict=False), 'match': ParamValue("none"), 'mismatch': ParamValue("daily")})), values=('none', 'daily', 'weekly', 'monthly')) -option_9 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode', doc='mode', multi=False, default='pre', values=('pre', 'post')) -option_6 = OptionDescription(name='ejabberd', doc='ejabberd', properties=frozenset({'normal'}), children=[option_7, option_8, option_9]) -option_5 = OptionDescription(name='extra', doc='extra', children=[option_6]) -option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1, option_5]) +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_4 = StrOption(name="activer_ejabberd", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_2 = OptionDescription(name="extra", doc="extra", children=[option_3, option_4], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_7 = StrOption(name="description", doc="description", default="Exportation de la base de ejabberd", properties=frozenset({"mandatory", "normal"})) +option_8 = ChoiceOption(name="day", doc="day", values=('none', 'daily', 'weekly', 'monthly'), default=Calculation(func.calc_multi_condition, Params((ParamValue("non")), kwargs={'condition_1': ParamOption(option_4, notraisepropertyerror=True), 'match': ParamValue("none"), 'mismatch': ParamValue("daily")})), properties=frozenset({"mandatory", "normal"})) +option_9 = ChoiceOption(name="mode", doc="mode", values=('pre', 'post'), default="pre", properties=frozenset({"mandatory", "normal"})) +option_6 = OptionDescription(name="ejabberd", doc="ejabberd", children=[option_7, option_8, option_9], properties=frozenset({"normal"})) +option_5 = OptionDescription(name="extra", doc="extra", children=[option_6]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_5]) diff --git a/tests/dictionaries/60extra_no_condition/00-base.xml b/tests/dictionaries/60extra_no_condition/00-base.xml new file mode 100644 index 00000000..4e809b8b --- /dev/null +++ b/tests/dictionaries/60extra_no_condition/00-base.xml @@ -0,0 +1,18 @@ + + + + + + non + + + + + + + diff --git a/tests/dictionaries/10valid_enum_base_redefine/tiramisu/__init__.py b/tests/dictionaries/60extra_no_condition/__init__.py similarity index 100% rename from tests/dictionaries/10valid_enum_base_redefine/tiramisu/__init__.py rename to tests/dictionaries/60extra_no_condition/__init__.py diff --git a/tests/dictionaries/60extra_no_condition/extra_dirs/extra/00-base.xml b/tests/dictionaries/60extra_no_condition/extra_dirs/extra/00-base.xml new file mode 100644 index 00000000..26e4174a --- /dev/null +++ b/tests/dictionaries/60extra_no_condition/extra_dirs/extra/00-base.xml @@ -0,0 +1,15 @@ + + + + + + + Exportation de la base de ejabberd + + + + pre + + + + diff --git a/tests/dictionaries/60extra_no_condition/makedict/after.json b/tests/dictionaries/60extra_no_condition/makedict/after.json new file mode 100644 index 00000000..0b78d652 --- /dev/null +++ b/tests/dictionaries/60extra_no_condition/makedict/after.json @@ -0,0 +1,26 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.activer_ejabberd": { + "owner": "default", + "value": "non" + }, + "rougail.general.module_instancie": { + "owner": "default", + "value": "non" + }, + "extra.ejabberd.description": { + "owner": "default", + "value": "Exportation de la base de ejabberd" + }, + "extra.ejabberd.day": { + "owner": "default", + "value": "none" + }, + "extra.ejabberd.mode": { + "owner": "default", + "value": "pre" + } +} diff --git a/tests/dictionaries/60extra_no_condition/makedict/base.json b/tests/dictionaries/60extra_no_condition/makedict/base.json new file mode 100644 index 00000000..5efa7f94 --- /dev/null +++ b/tests/dictionaries/60extra_no_condition/makedict/base.json @@ -0,0 +1,8 @@ +{ + "rougail.general.mode_conteneur_actif": "non", + "rougail.general.activer_ejabberd": "non", + "rougail.general.module_instancie": "non", + "extra.ejabberd.description": "Exportation de la base de ejabberd", + "extra.ejabberd.day": "none", + "extra.ejabberd.mode": "pre" +} diff --git a/tests/dictionaries/60extra_no_condition/makedict/before.json b/tests/dictionaries/60extra_no_condition/makedict/before.json new file mode 100644 index 00000000..0b78d652 --- /dev/null +++ b/tests/dictionaries/60extra_no_condition/makedict/before.json @@ -0,0 +1,26 @@ +{ + "rougail.general.mode_conteneur_actif": { + "owner": "default", + "value": "non" + }, + "rougail.general.activer_ejabberd": { + "owner": "default", + "value": "non" + }, + "rougail.general.module_instancie": { + "owner": "default", + "value": "non" + }, + "extra.ejabberd.description": { + "owner": "default", + "value": "Exportation de la base de ejabberd" + }, + "extra.ejabberd.day": { + "owner": "default", + "value": "none" + }, + "extra.ejabberd.mode": { + "owner": "default", + "value": "pre" + } +} diff --git a/tests/dictionaries/60extra_no_condition/tiramisu/base.py b/tests/dictionaries/60extra_no_condition/tiramisu/base.py new file mode 100644 index 00000000..581f42b8 --- /dev/null +++ b/tests/dictionaries/60extra_no_condition/tiramisu/base.py @@ -0,0 +1,24 @@ +from importlib.machinery import SourceFileLoader +from importlib.util import spec_from_loader, module_from_spec +loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py') +spec = spec_from_loader(loader.name, loader) +func = module_from_spec(spec) +loader.exec_module(func) +for key, value in dict(locals()).items(): + if key != ['SourceFileLoader', 'func']: + setattr(func, key, value) +try: + from tiramisu3 import * +except: + from tiramisu import * +option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"})) +option_4 = StrOption(name="activer_ejabberd", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_5 = StrOption(name="module_instancie", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"})) +option_2 = OptionDescription(name="general", doc="général", children=[option_3, option_4, option_5], properties=frozenset({"normal"})) +option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2]) +option_8 = StrOption(name="description", doc="description", default="Exportation de la base de ejabberd", properties=frozenset({"mandatory", "normal"})) +option_9 = ChoiceOption(name="day", doc="day", values=('none', 'daily', 'weekly', 'monthly'), default="none", properties=frozenset({"mandatory", "normal"})) +option_10 = ChoiceOption(name="mode", doc="mode", values=('pre', 'post'), default="pre", properties=frozenset({"mandatory", "normal"})) +option_7 = OptionDescription(name="ejabberd", doc="ejabberd", children=[option_8, option_9, option_10], properties=frozenset({"normal"})) +option_6 = OptionDescription(name="extra", doc="extra", children=[option_7]) +option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_6]) diff --git a/tests/dictionaries/60extra_redefine/00-base.xml b/tests/dictionaries/60extra_redefine/00-base.xml index 2e4fec44..32dae3d3 100644 --- a/tests/dictionaries/60extra_redefine/00-base.xml +++ b/tests/dictionaries/60extra_redefine/00-base.xml @@ -1,25 +1,15 @@ - - - - + - - - - - - - - diff --git a/tests/dictionaries/60extra_redefine/extra_dirs/extra/00-base.xml b/tests/dictionaries/60extra_redefine/extra_dirs/extra/00-base.xml index 651c2125..ac0557b0 100644 --- a/tests/dictionaries/60extra_redefine/extra_dirs/extra/00-base.xml +++ b/tests/dictionaries/60extra_redefine/extra_dirs/extra/00-base.xml @@ -1,6 +1,6 @@ - + @@ -13,11 +13,12 @@ - + non - activer_ejabberd + activer_ejabberd none daily + extra.ejabberd.day diff --git a/tests/dictionaries/60extra_redefine/extra_dirs/extra/01-redefine.xml b/tests/dictionaries/60extra_redefine/extra_dirs/extra/01-redefine.xml index cc262808..e1760cca 100644 --- a/tests/dictionaries/60extra_redefine/extra_dirs/extra/01-redefine.xml +++ b/tests/dictionaries/60extra_redefine/extra_dirs/extra/01-redefine.xml @@ -1,6 +1,6 @@ - + -