From 53b46da370ae233abb47c39878c6bc3b83f9bf5d Mon Sep 17 00:00:00 2001 From: Laurent LAPORTE Date: Mon, 25 Mar 2024 07:53:39 +0100 Subject: [PATCH] feat(bc): make `comments`, `filter_year_by_year` and `filter_synthesis` fields optional --- .../model/command/create_binding_constraint.py | 6 +++--- tests/variantstudy/test_command_factory.py | 14 +++++++++++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/antarest/study/storage/variantstudy/model/command/create_binding_constraint.py b/antarest/study/storage/variantstudy/model/command/create_binding_constraint.py index a8c04d657f..5a832b7d29 100644 --- a/antarest/study/storage/variantstudy/model/command/create_binding_constraint.py +++ b/antarest/study/storage/variantstudy/model/command/create_binding_constraint.py @@ -75,9 +75,9 @@ class BindingConstraintProperties(BaseModel, extra=Extra.forbid, allow_populatio enabled: bool = True time_step: BindingConstraintFrequency = BindingConstraintFrequency.HOURLY operator: BindingConstraintOperator = BindingConstraintOperator.EQUAL - comments: str = "" - filter_year_by_year: str = "" - filter_synthesis: str = "" + comments: t.Optional[str] = None + filter_year_by_year: t.Optional[str] = None + filter_synthesis: t.Optional[str] = None class BindingConstraintProperties870(BindingConstraintProperties): diff --git a/tests/variantstudy/test_command_factory.py b/tests/variantstudy/test_command_factory.py index a0324a2722..09f45d30f3 100644 --- a/tests/variantstudy/test_command_factory.py +++ b/tests/variantstudy/test_command_factory.py @@ -132,6 +132,9 @@ def setup_class(self): "operator": "equal", "coeffs": {}, "values": "values", + "comments": "", + "filter_synthesis": "", + "filter_year_by_year": "", }, ), CommandDTO( @@ -144,7 +147,10 @@ def setup_class(self): "operator": "equal", "coeffs": {}, "values": "values", - } + "comments": "", + "filter_synthesis": "", + "filter_year_by_year": "", + }, ], ), CommandDTO( @@ -156,6 +162,9 @@ def setup_class(self): "operator": "equal", "coeffs": {}, "values": "values", + "comments": "", + "filter_synthesis": "", + "filter_year_by_year": "", }, ), CommandDTO( @@ -167,6 +176,9 @@ def setup_class(self): "time_step": "hourly", "operator": "equal", "coeffs": {}, + "comments": "", + "filter_synthesis": "", + "filter_year_by_year": "", } ], ),