Skip to content

Commit

Permalink
Add test for missing annual demand
Browse files Browse the repository at this point in the history
  • Loading branch information
joda9 committed Jul 10, 2024
1 parent 840af44 commit b704d2c
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/network/test_timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -1793,6 +1793,26 @@ def test_predefined_conventional_loads_by_sector(self, caplog):
).values,
).all()

# test Error if 'annual_consumption' is missing
# Save the original 'annual_consumption' values
original_annual_consumption = self.edisgo.topology.loads_df[
"annual_consumption"
].copy()
# Set 'annual_consumption' to None for the test
self.edisgo.topology.loads_df["annual_consumption"] = None
with pytest.raises(AttributeError) as exc_info:
self.edisgo.timeseries.predefined_conventional_loads_by_sector(
self.edisgo, "demandlib"
)
assert (
exc_info.value.args[0]
== "The annual consumption of some loads is missing. Please provide"
)
# Restore the original 'annual_consumption' values
self.edisgo.topology.loads_df[
"annual_consumption"
] = original_annual_consumption

def test_predefined_charging_points_by_use_case(self, caplog):
index = pd.date_range("1/1/2018", periods=3, freq="H")
self.edisgo.timeseries.timeindex = index
Expand Down

0 comments on commit b704d2c

Please sign in to comment.