Skip to content

Commit 901b8c7

Browse files
committed
Add timezone test
1 parent 6704a68 commit 901b8c7

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

tests/test_converter.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import traceback
99
from collections import deque
1010
from dataclasses import dataclass
11-
from datetime import datetime, timezone
11+
from datetime import datetime, timezone, timedelta
1212
from enum import Enum, IntEnum
1313
from typing import (
1414
Any,
@@ -199,6 +199,14 @@ async def assert_payload(
199199
type_hint=datetime,
200200
)
201201

202+
# Timezones work
203+
await assert_payload(
204+
datetime(2020, 1, 1, 1, 1, 1, tzinfo=timezone(timedelta(hours=5))),
205+
"json/plain",
206+
'"2020-01-01T01:01:01+05:00"',
207+
type_hint=datetime,
208+
)
209+
202210
# Data class with datetime
203211
await assert_payload(
204212
DatetimeClass(datetime=datetime(2020, 1, 1, 1, 1, 1)),

0 commit comments

Comments
 (0)