Commit 271511e2 authored by Eric Duminil's avatar Eric Duminil
Browse files

Adding more simulation tests

parent 31c40d73
"""Live integration tests for SimStadt workflows. Skipped if SimStadt is not installed.""" """Live integration tests for SimStadt workflows. Skipped if SimStadt is not installed."""
from pathlib import Path from pathlib import Path
import rich
import pytest import pytest
...@@ -29,9 +30,14 @@ def test_heat_demand(): ...@@ -29,9 +30,14 @@ def test_heat_demand():
assert "Heated area" in kpis assert "Heated area" in kpis
assert "Yearly Heating demand" in kpis assert "Yearly Heating demand" in kpis
# TODO: More detailed tests
assert kpis["Yearly Heating demand"].value > 0 assert kpis["Yearly Heating demand"].value > 0
assert kpis["Heated area"].value > 0 assert kpis["Yearly Heating demand"].unit == "kWh / a"
assert kpis["Specific Heating Demand"].value == pytest.approx(100, abs=30)
assert kpis["Specific Heating Demand"].unit == "kWh / (m² · a)"
assert kpis["Mean Uvalue"].value == pytest.approx(1, abs=0.2)
assert kpis["Mean Uvalue"].unit == "W / (m² · K)"
assert kpis["Year of construction"].value == pytest.approx(1950, abs=50)
assert kpis["Year of construction"].unit == None
@pytest.mark.integration @pytest.mark.integration
...@@ -43,6 +49,7 @@ def test_pv(): ...@@ -43,6 +49,7 @@ def test_pv():
description="PV – MiniBuchwald", description="PV – MiniBuchwald",
) )
kpis = to_dict(results.kpis) kpis = to_dict(results.kpis)
rich.print(kpis)
assert "PV potential yield" in kpis assert "PV potential yield" in kpis
assert "Roof area for PV" in kpis assert "Roof area for PV" in kpis
...@@ -59,6 +66,7 @@ def test_load_profile(): ...@@ -59,6 +66,7 @@ def test_load_profile():
description="Load profile – MiniBuchwald", description="Load profile – MiniBuchwald",
) )
kpis = to_dict(results.kpis) kpis = to_dict(results.kpis)
rich.print(kpis)
assert "Number of buildings" in kpis assert "Number of buildings" in kpis
assert "Total load [MWh]" in kpis or any("load" in k.lower() for k in kpis) assert "Total load [MWh]" in kpis or any("load" in k.lower() for k in kpis)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment