Skip to content

Commit

Permalink
test_class_ems checks for np NaN added
Browse files Browse the repository at this point in the history
  • Loading branch information
NormannK committed Oct 8, 2024
1 parent c4fbce6 commit f49884e
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions tests/test_class_ems.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import numpy as np
import pytest

from akkudoktoreos.class_akku import PVAkku
Expand Down Expand Up @@ -277,18 +278,18 @@ def test_simulation(create_ems_instance):
result["Last_Wh_pro_Stunde"][12] == 1132.03
), "The value at index 12 of 'Last_Wh_pro_Stunde' should be 1132.03."

# Verify that the value at index 0 is 'None'
assert (
result["Last_Wh_pro_Stunde"][0] is None
), "The value at index 0 of 'Last_Wh_pro_Stunde' should be None."
# Verify that the value at index 0 is 'None' or NaN
assert result["Last_Wh_pro_Stunde"][0] is None or np.isnan(
result["Last_Wh_pro_Stunde"][0]
), "The value at index 0 of 'Last_Wh_pro_Stunde' should be None or NaN."

# Check that 'Netzeinspeisung_Wh_pro_Stunde' and 'Netzbezug_Wh_pro_Stunde' are consistent
assert (
result["Netzeinspeisung_Wh_pro_Stunde"][0] is None
), "The value at index 0 of 'Netzeinspeisung_Wh_pro_Stunde' should be None."
assert (
result["Netzbezug_Wh_pro_Stunde"][0] is None
), "The value at index 0 of 'Netzbezug_Wh_pro_Stunde' should be None."
assert result["Netzeinspeisung_Wh_pro_Stunde"][0] is None or np.isnan(
result["Netzeinspeisung_Wh_pro_Stunde"][0]
), "The value at index 0 of 'Netzeinspeisung_Wh_pro_Stunde' should be None or NaN."
assert result["Netzbezug_Wh_pro_Stunde"][0] is None or np.isnan(
result["Netzbezug_Wh_pro_Stunde"][0]
), "The value at index 0 of 'Netzbezug_Wh_pro_Stunde' should be None or NaN."
assert (
result["Netzbezug_Wh_pro_Stunde"][1] == 21679.13
), "The value at index 1 of 'Netzbezug_Wh_pro_Stunde' should be21679.13."
Expand Down

0 comments on commit f49884e

Please sign in to comment.