Skip to content

Commit

Permalink
Assert no timezone for naive datetimes. (#1286)
Browse files Browse the repository at this point in the history
Fixes #1282
  • Loading branch information
Huite authored Mar 18, 2024
1 parent 320c3c6 commit 319337c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions python/ribasim/tests/test_io.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from datetime import datetime

import pytest
import ribasim
import tomli
Expand Down Expand Up @@ -144,3 +146,13 @@ def test_roundtrip(trivial, tmp_path):
for node1, node2 in zip(model1._nodes(), model2._nodes()):
for table1, table2 in zip(node1._tables(), node2._tables()):
__assert_equal(table1.df, table2.df)


def test_datetime_timezone():
# Due to a pydantic issue, a time zone was added.
# https://github.com/Deltares/Ribasim/issues/1282
model = ribasim.Model(starttime="2000-01-01", endtime="2001-01-01 00:00:00")
assert isinstance(model.starttime, datetime)
assert isinstance(model.endtime, datetime)
assert model.starttime.tzinfo is None
assert model.endtime.tzinfo is None

0 comments on commit 319337c

Please sign in to comment.