From e9896b8a2b718c2d538bb3d6abf888416010345d Mon Sep 17 00:00:00 2001 From: gwen Date: Tue, 9 Jul 2024 10:37:35 +0200 Subject: [PATCH] removes an unnecessary else statement --- src/rougail/error.py | 4 ++-- src/rougail/object_model.py | 3 --- .../dictionaries/rougail/00-base.yml | 1 + .../dictionaries/rougail/00-base.yml | 1 + 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/rougail/error.py b/src/rougail/error.py index 6f237b843..53f8b3f10 100644 --- a/src/rougail/error.py +++ b/src/rougail/error.py @@ -83,8 +83,8 @@ class NotFoundError(Exception): ## ---- specific exceptions ---- class VariableCalculationDependencyError(Exception): - """When an 'optional=true' attribute is set, and - the target variable doesn't exists. + """When an attribute is set, and + the target of this attribute doesn't exists. """ def __init__(self, msg, errno, xmlfiles): if xmlfiles: diff --git a/src/rougail/object_model.py b/src/rougail/object_model.py index 2d2cfa49c..00b5aea25 100644 --- a/src/rougail/object_model.py +++ b/src/rougail/object_model.py @@ -351,9 +351,6 @@ class VariableCalculation(Calculation): if self.optional: msg = f'the dependent variable was not found "{self.optional}" for variable "{self.path}"' raise VariableCalculationDependencyError(msg, 90, self.xmlfiles) - else: - msg = f'Variable not found "{self.variable}" for attribute "{self.attribute_name}" for variable "{self.path}"' - raise DictConsistencyError(msg, 88, self.xmlfiles) if not isinstance(variable, objectspace.variable): # FIXME remove the pfff raise Exception("pfff it's a family") diff --git a/tests/dictionaries/90_optional_parameter_in_variable_default/dictionaries/rougail/00-base.yml b/tests/dictionaries/90_optional_parameter_in_variable_default/dictionaries/rougail/00-base.yml index b65bc9e7d..4a017adc3 100644 --- a/tests/dictionaries/90_optional_parameter_in_variable_default/dictionaries/rougail/00-base.yml +++ b/tests/dictionaries/90_optional_parameter_in_variable_default/dictionaries/rougail/00-base.yml @@ -1,3 +1,4 @@ +--- version: 1.1 #my_variable: # multi: true diff --git a/tests/dictionaries/90_optional_parameter_in_variable_exists/dictionaries/rougail/00-base.yml b/tests/dictionaries/90_optional_parameter_in_variable_exists/dictionaries/rougail/00-base.yml index 382366bc4..61cf089c9 100644 --- a/tests/dictionaries/90_optional_parameter_in_variable_exists/dictionaries/rougail/00-base.yml +++ b/tests/dictionaries/90_optional_parameter_in_variable_exists/dictionaries/rougail/00-base.yml @@ -1,3 +1,4 @@ +--- version: 1.1 my_variable: multi: true