Skip to content

Commit 34e47ad

Browse files
committed
DateTime and more: Use time zone "Europe/Kyiv" for testing
1 parent 37d122d commit 34e47ad

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

tests/datetime_test.py

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
from __future__ import absolute_import
2323

24-
from datetime import tzinfo, timedelta
2524
import datetime as dt
2625
from unittest import TestCase, skipIf
2726
from unittest.mock import patch, MagicMock
@@ -38,6 +37,11 @@
3837
except ImportError:
3938
from sqlalchemy.ext.declarative import declarative_base
4039

40+
try:
41+
import zoneinfo
42+
except ImportError:
43+
from backports import zoneinfo
44+
4145
from crate.client.cursor import Cursor
4246

4347

@@ -46,21 +50,9 @@
4650
FakeCursor.return_value = fake_cursor
4751

4852

49-
class CST(tzinfo):
50-
"""
51-
Timezone object for CST
52-
"""
53-
54-
def utcoffset(self, date_time):
55-
return timedelta(seconds=-3600)
56-
57-
def dst(self, date_time):
58-
return timedelta(seconds=-7200)
59-
60-
6153
INPUT_DATE = dt.date(2009, 5, 13)
6254
INPUT_DATETIME_NOTZ = dt.datetime(2009, 5, 13, 19, 19, 30, 123456)
63-
INPUT_DATETIME_TZ = dt.datetime(2009, 5, 13, 19, 19, 30, 123456, tzinfo=CST())
55+
INPUT_DATETIME_TZ = dt.datetime(2009, 5, 13, 19, 19, 30, 123456, tzinfo=zoneinfo.ZoneInfo("Europe/Kyiv"))
6456
OUTPUT_DATE = INPUT_DATE
6557
OUTPUT_TIME = dt.time(19, 19, 30, 123000)
6658
OUTPUT_DATETIME_NOTZ = dt.datetime(2009, 5, 13, 19, 19, 30, 123000)

0 commit comments

Comments
 (0)