Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rwijtvliet committed Nov 5, 2024
1 parent ff34f8a commit 6864e21
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/core/pfline/test_pfline_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,15 +272,18 @@ def test_init_with_integers(col: str):
@pytest.mark.parametrize("freq", ["15min", "h"])
def test_contain_whole_day(inclusive: str, freq: str):
"""An index must contain full days.
For hourly-or-shorter values, this means that the start time of the first period () must equal the end time of the
last period (), which is not the case."""
For hourly-or-shorter values, this means that the start time of the first period must equal the end time of the last period.
"""
index = pd.date_range(
"2020-01-01", "2020-02-01", freq=freq, tz="Europe/Berlin", inclusive=inclusive
)
if inclusive == "left":
# This should work without any error
pfl = dev.get_flatpfline(index)
assert isinstance(pfl, PfLine)
pf.testing.assert_index_equal(pfl.index, index)
assert pfl.start == index[0]
assert pfl.end not in index # because exclusive
else:
# For "both" inclusive, it should raise an error
with pytest.raises(ValueError):
Expand Down

0 comments on commit 6864e21

Please sign in to comment.