Skip to content

Commit ba701d3

Browse files
authored
Fix unit tests for temporal type serialization (#779)
1 parent 5b0c670 commit ba701d3

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

tests/unit/common/codec/hydration/v2/test_temporal_dehydration.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,17 @@ def test_native_date_time_negative_offset(self, hydration_scope):
6060
assert struct == Structure(b"I", 1539347861, 474716000, -3600)
6161

6262
def test_date_time_zone_id(self, hydration_scope):
63-
dt = DateTime(2018, 10, 12, 11, 37, 41, 474716862,
64-
pytz.timezone("Europe/Stockholm"))
63+
dt = DateTime(2018, 10, 12, 11, 37, 41, 474716862)
64+
dt = pytz.timezone("Europe/Stockholm").localize(dt)
65+
# offset should be UTC+2 (7200 seconds)
6566
struct = hydration_scope.dehydration_hooks[type(dt)](dt)
66-
assert struct == Structure(b"i", 1539339941, 474716862,
67+
assert struct == Structure(b"i", 1539337061, 474716862,
6768
"Europe/Stockholm")
6869

6970
def test_native_date_time_zone_id(self, hydration_scope):
70-
dt = datetime.datetime(2018, 10, 12, 11, 37, 41, 474716,
71-
pytz.timezone("Europe/Stockholm"))
71+
dt = datetime.datetime(2018, 10, 12, 11, 37, 41, 474716)
72+
dt = pytz.timezone("Europe/Stockholm").localize(dt)
73+
# offset should be UTC+2 (7200 seconds)
7274
struct = hydration_scope.dehydration_hooks[type(dt)](dt)
73-
assert struct == Structure(b"i", 1539339941, 474716000,
75+
assert struct == Structure(b"i", 1539337061, 474716000,
7476
"Europe/Stockholm")

0 commit comments

Comments
 (0)