Skip to content

Commit

Permalink
Added test to verify custom time series content provided at creation …
Browse files Browse the repository at this point in the history
…works
  • Loading branch information
Sigurd-Borge committed Sep 26, 2024
1 parent 7d58483 commit 6d4073c
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/antares/services/local_services/test_study.py
Original file line number Diff line number Diff line change
Expand Up @@ -1366,3 +1366,30 @@ def test_binding_constraints_have_correct_default_time_series(self, test_constra
assert actual_time_series_equal.equals(expected_time_series_daily_weekly)
assert actual_time_series_both_greater.equals(expected_time_series_hourly)
assert actual_time_series_both_lesser.equals(expected_time_series_hourly)

def test_submitted_time_series_is_saved(self, local_study_with_constraint):
# Given
expected_time_series = pd.DataFrame(np.ones([3, 1]))
local_study_with_constraint.create_binding_constraint(
name="test time series",
properties=BindingConstraintProperties(
operator=BindingConstraintOperator.GREATER, time_step=BindingConstraintFrequency.HOURLY
),
greater_term_matrix=expected_time_series,
)
expected_file_contents = """1.0
1.0
1.0
"""

# When
with local_study_with_constraint._binding_constraints_service.time_series[
"test time series_gt"
].local_file.file_path.open("r") as time_series_file:
actual_time_series = pd.read_csv(time_series_file, header=None)
time_series_file.seek(0)
actual_file_contents = time_series_file.read()

# Then
assert actual_time_series.equals(expected_time_series)
assert actual_file_contents == expected_file_contents

0 comments on commit 6d4073c

Please sign in to comment.