Skip to content

Commit

Permalink
feat(tests): add UT for sets
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinBelthle committed Jun 18, 2024
1 parent 4b345ba commit 0537d67
Show file tree
Hide file tree
Showing 6 changed files with 4,560 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ def build(self) -> TREE:
children: TREE = {a: Area(self.context, self.config.next_file(a), area=a) for a in areas}

for s in sets:
children[f"@ {s}"] = Set(self.context, self.config.next_file(f"@ {s}"), set=s)
children[s] = Set(self.context, self.config.next_file(s), set=s)
return children
Binary file modified examples/studies/STA-mini.zip
Binary file not shown.
3 changes: 3 additions & 0 deletions tests/helpers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import math
import time
import uuid
from datetime import datetime, timedelta, timezone
Expand Down Expand Up @@ -66,6 +67,8 @@ def assert_study(a: SUB_JSON, b: SUB_JSON) -> None:
_assert_list(cast(List[float], a.tolist()), b)
elif isinstance(a, list) and isinstance(b, np.ndarray):
_assert_list(a, cast(List[float], b.tolist()))
elif isinstance(a, float) and math.isnan(a):
assert math.isnan(b)
else:
_assert_others(a, b)

Expand Down
327 changes: 327 additions & 0 deletions tests/storage/integration/data/set_id_annual.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,327 @@
import math

set_id_annual = {
"columns": [
("OP. COST", "Euro", "min"),
("OP. COST", "Euro", "max"),
("MRG. PRICE", "Euro", "min"),
("MRG. PRICE", "Euro", "max"),
("CO2 EMIS.", "Tons", "min"),
("CO2 EMIS.", "Tons", "max"),
("NH3 EMIS.", "Tons", "min"),
("NH3 EMIS.", "Tons", "max"),
("SO2 EMIS.", "Tons", "min"),
("SO2 EMIS.", "Tons", "max"),
("NOX EMIS.", "Tons", "min"),
("NOX EMIS.", "Tons", "max"),
("PM2_5 EMIS.", "Tons", "min"),
("PM2_5 EMIS.", "Tons", "max"),
("PM5 EMIS.", "Tons", "min"),
("PM5 EMIS.", "Tons", "max"),
("PM10 EMIS.", "Tons", "min"),
("PM10 EMIS.", "Tons", "max"),
("NMVOC EMIS.", "Tons", "min"),
("NMVOC EMIS.", "Tons", "max"),
("OP1 EMIS.", "Tons", "min"),
("OP1 EMIS.", "Tons", "max"),
("OP2 EMIS.", "Tons", "min"),
("OP2 EMIS.", "Tons", "max"),
("OP3 EMIS.", "Tons", "min"),
("OP3 EMIS.", "Tons", "max"),
("OP4 EMIS.", "Tons", "min"),
("OP4 EMIS.", "Tons", "max"),
("OP5 EMIS.", "Tons", "min"),
("OP5 EMIS.", "Tons", "max"),
("BALANCE", "MWh", "min"),
("BALANCE", "MWh", "max"),
("LOAD", "MWh", "min"),
("LOAD", "MWh", "max"),
("H. ROR", "MWh", "min"),
("H. ROR", "MWh", "max"),
("NUCLEAR", "MWh", "min"),
("NUCLEAR", "MWh", "max"),
("LIGNITE", "MWh", "min"),
("LIGNITE", "MWh", "max"),
("COAL", "MWh", "min"),
("COAL", "MWh", "max"),
("GAS", "MWh", "min"),
("GAS", "MWh", "max"),
("OIL", "MWh", "min"),
("OIL", "MWh", "max"),
("MIX. FUEL", "MWh", "min"),
("MIX. FUEL", "MWh", "max"),
("MISC. DTG", "MWh", "min"),
("MISC. DTG", "MWh", "max"),
("MISC. DTG 2", "MWh", "min"),
("MISC. DTG 2", "MWh", "max"),
("MISC. DTG 3", "MWh", "min"),
("MISC. DTG 3", "MWh", "max"),
("MISC. DTG 4", "MWh", "min"),
("MISC. DTG 4", "MWh", "max"),
("WIND OFFSHORE", "MWh", "min"),
("WIND OFFSHORE", "MWh", "max"),
("WIND ONSHORE", "MWh", "min"),
("WIND ONSHORE", "MWh", "max"),
("SOLAR CONCRT.", "MWh", "min"),
("SOLAR CONCRT.", "MWh", "max"),
("SOLAR PV", "MWh", "min"),
("SOLAR PV", "MWh", "max"),
("SOLAR ROOFT", "MWh", "min"),
("SOLAR ROOFT", "MWh", "max"),
("RENW. 1", "MWh", "min"),
("RENW. 1", "MWh", "max"),
("RENW. 2", "MWh", "min"),
("RENW. 2", "MWh", "max"),
("RENW. 3", "MWh", "min"),
("RENW. 3", "MWh", "max"),
("RENW. 4", "MWh", "min"),
("RENW. 4", "MWh", "max"),
("H. STOR", "MWh", "min"),
("H. STOR", "MWh", "max"),
("H. PUMP", "MWh", "min"),
("H. PUMP", "MWh", "max"),
("H. LEV", "%", "min"),
("H. LEV", "%", "max"),
("H. INFL", "MWh", "min"),
("H. INFL", "MWh", "max"),
("H. OVFL", "%", "min"),
("H. OVFL", "%", "max"),
("H. VAL", "Euro/MWh", "min"),
("H. VAL", "Euro/MWh", "max"),
("H. COST", "Euro", "min"),
("H. COST", "Euro", "max"),
("PSP_open_injection", "MW", "min"),
("PSP_open_injection", "MW", "max"),
("PSP_open_withdrawal", "MW", "min"),
("PSP_open_withdrawal", "MW", "max"),
("PSP_open_level", "MWh", "min"),
("PSP_open_level", "MWh", "max"),
("PSP_closed_injection", "MW", "min"),
("PSP_closed_injection", "MW", "max"),
("PSP_closed_withdrawal", "MW", "min"),
("PSP_closed_withdrawal", "MW", "max"),
("PSP_closed_level", "MWh", "min"),
("PSP_closed_level", "MWh", "max"),
("Pondage_injection", "MW", "min"),
("Pondage_injection", "MW", "max"),
("Pondage_withdrawal", "MW", "min"),
("Pondage_withdrawal", "MW", "max"),
("Pondage_level", "MWh", "min"),
("Pondage_level", "MWh", "max"),
("Battery_injection", "MW", "min"),
("Battery_injection", "MW", "max"),
("Battery_withdrawal", "MW", "min"),
("Battery_withdrawal", "MW", "max"),
("Battery_level", "MWh", "min"),
("Battery_level", "MWh", "max"),
("Other1_injection", "MW", "min"),
("Other1_injection", "MW", "max"),
("Other1_withdrawal", "MW", "min"),
("Other1_withdrawal", "MW", "max"),
("Other1_level", "MWh", "min"),
("Other1_level", "MWh", "max"),
("Other2_injection", "MW", "min"),
("Other2_injection", "MW", "max"),
("Other2_withdrawal", "MW", "min"),
("Other2_withdrawal", "MW", "max"),
("Other2_level", "MWh", "min"),
("Other2_level", "MWh", "max"),
("Other3_injection", "MW", "min"),
("Other3_injection", "MW", "max"),
("Other3_withdrawal", "MW", "min"),
("Other3_withdrawal", "MW", "max"),
("Other3_level", "MWh", "min"),
("Other3_level", "MWh", "max"),
("Other4_injection", "MW", "min"),
("Other4_injection", "MW", "max"),
("Other4_withdrawal", "MW", "min"),
("Other4_withdrawal", "MW", "max"),
("Other4_level", "MWh", "min"),
("Other4_level", "MWh", "max"),
("Other5_injection", "MW", "min"),
("Other5_injection", "MW", "max"),
("Other5_withdrawal", "MW", "min"),
("Other5_withdrawal", "MW", "max"),
("Other5_level", "MWh", "min"),
("Other5_level", "MWh", "max"),
("UNSP. ENRG", "MWh", "min"),
("UNSP. ENRG", "MWh", "max"),
("SPIL. ENRG", "MWh", "min"),
("SPIL. ENRG", "MWh", "max"),
("LOLD", "Hours", "min"),
("LOLD", "Hours", "max"),
("AVL DTG", "MWh", "min"),
("AVL DTG", "MWh", "max"),
("DTG MRG", "MWh", "min"),
("DTG MRG", "MWh", "max"),
("MAX MRG", "MWh", "min"),
("MAX MRG", "MWh", "max"),
("NP COST", "Euro", "min"),
("NP COST", "Euro", "max"),
("NODU", " ", "min"),
("NODU", " ", "max"),
],
"data": [
[
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
math.nan,
math.nan,
1.0,
1.0,
math.nan,
math.nan,
math.nan,
math.nan,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
1.0,
]
],
"index": ["Annual"],
}
Loading

0 comments on commit 0537d67

Please sign in to comment.