Skip to content

Commit

Permalink
Cucumber tests OK
Browse files Browse the repository at this point in the history
  • Loading branch information
payetvin committed Jan 24, 2025
1 parent d918ff2 commit aa7c460
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
21 changes: 9 additions & 12 deletions src/tests/cucumber/features/short_tests.feature
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
Feature: short tests

@fast @short
Scenario: 034 Mixed Expansion - Smart grid model 1
# Like previous test, but with unit commitment
# => overall cost is better, there are less startups, and min up & down time are not equal
Given the study path is "short-tests/034 Mixed Expansion - Smart grid model 1"
When I run antares simulator
Then the simulation takes less than 10 seconds
And the simulation succeeds
And in area "B", during year 1, hourly production of "OIL" for "1 JAN 02:00" is 1974
And in area "B", during year 1, hourly production of "OIL" for "1 JAN 02:00" is 1148

@fast @short
Scenario: 001 One node - passive
Given the study path is "short-tests/001 One node - passive"
Expand Down Expand Up @@ -142,3 +130,12 @@ Feature: short tests
And the annual system cost is
| EXP | STD | MIN | MAX |
| 7.972e+10 | 2.258e+10 | 5.613e+10 | 1.082e+11 |

@fast @short
Scenario: 034 Mixed Expansion - Smart grid model 1
Given the study path is "short-tests/034 Mixed Expansion - Smart grid model 1"
When I run antares simulator
Then the simulation takes less than 10 seconds
And the simulation succeeds
And in area "b", during year 1, hourly production of "MIXED FUEL" for "1 JAN 01:00" is 27814
And in area "b", during year 1, hourly production of "OIL" for "2 JAN 19:00" is 8113
4 changes: 2 additions & 2 deletions src/tests/cucumber/features/steps/common_steps/steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ def check_prod_for_all_years(context, area, prod_name, comparator_and_hourly_pro
for year in range(1, context.nbyears + 1):
check_prod_for_specific_year(context, area, year, prod_name, comparator_and_hourly_prod)

@then('in area "{area}", during year {year:d}, hourly production of "{prod_name}" for "{date}" is {value}')
@then('in area "{area}", during year {year:d}, hourly production of "{prod_name}" for "{date}" is {value:d}')
def check_prod_for_specific_year_and_hour(context, area, year, prod_name, date, value):
actual_hourly_prod = context.soh.get_specific_value(area, year, prod_name, date)
assert actual_hourly_prod - value <= 1e-6
assert actual_hourly_prod == value

@step('in area "{area}", during year {year:d}, total non-proportional cost is {np_cost:g}')
def check_np_cost_for_specific_year(context, area, year, np_cost):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@ def get_loss_of_load_duration_h(self, area: str, year: int) -> int:

def get_unsupplied_energy_mwh(self, area: str, year: int, date: str) -> float:
return self.__get_values_hourly_for_specific_hour(area, year, date)["UNSP. ENRG"]["MWh"].sum()
def get_specific_value(self, area: str, year: int, date: str, prod_name: str) -> float:
return self.__get_values_hourly_for_specific_hour(area, year, date)[prod_name]["MWh"]

def get_specific_value(self, area: str, year: int, prod_name: str, date: str) -> float:
return self.__get_values_hourly_for_specific_hour(area, year, date)[prod_name]["MWh"].sum()

def get_non_proportional_cost(self, area: str, year: int) -> float:
return self.__get_values_hourly(area, year)["NP COST"]["Euro"].sum()

0 comments on commit aa7c460

Please sign in to comment.