Skip to content

Commit

Permalink
DateTime and more: Use time zone "Europe/Kyiv" for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed Jun 25, 2024
1 parent cfddf42 commit 619c991
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions tests/datetime_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

from __future__ import absolute_import

from datetime import tzinfo, timedelta
import datetime as dt
from unittest import TestCase, skipIf
from unittest.mock import patch, MagicMock
Expand All @@ -38,6 +37,11 @@
except ImportError:
from sqlalchemy.ext.declarative import declarative_base

try:
import zoneinfo
except ImportError:
from backports import zoneinfo

from crate.client.cursor import Cursor


Expand All @@ -46,21 +50,9 @@
FakeCursor.return_value = fake_cursor


class CST(tzinfo):
"""
Timezone object for CST
"""

def utcoffset(self, date_time):
return timedelta(seconds=-3600)

def dst(self, date_time):
return timedelta(seconds=-7200)


INPUT_DATE = dt.date(2009, 5, 13)
INPUT_DATETIME_NOTZ = dt.datetime(2009, 5, 13, 19, 19, 30, 123456)
INPUT_DATETIME_TZ = dt.datetime(2009, 5, 13, 19, 19, 30, 123456, tzinfo=CST())
INPUT_DATETIME_TZ = dt.datetime(2009, 5, 13, 19, 19, 30, 123456, tzinfo=zoneinfo.ZoneInfo("Europe/Kyiv"))
OUTPUT_DATE = INPUT_DATE
OUTPUT_TIME = dt.time(19, 19, 30, 123000)
OUTPUT_DATETIME_NOTZ = dt.datetime(2009, 5, 13, 19, 19, 30, 123000)
Expand Down

0 comments on commit 619c991

Please sign in to comment.