Skip to content
Merged
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions tests/spanner_dbapi/test_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# https://developers.google.com/open-source/licenses/bsd

import datetime
import time
from unittest import TestCase

from google.cloud.spanner_dbapi.types import (
Expand All @@ -17,8 +18,8 @@
)
from google.cloud.spanner_dbapi.utils import PeekIterator

tzUTC = 0 # 0 hours offset from UTC

tzUTC = 0 # 0 hours offset from UTC)
utcOffset = time.timezone # offset for current timezone

class TypesTests(TestCase):
def test_Date(self):
Expand All @@ -37,8 +38,8 @@ def test_Timestamp(self):
self.assertEqual(got, want, "mismatch between conversion")

def test_DateFromTicks(self):
epochTicks = 1572851662.9782631 # Sun Nov 03 23:14:22 2019
got = DateFromTicks(epochTicks)
epochTicks = 1572822862.9782631 # Sun Nov 03 23:14:22 2019
got = DateFromTicks(epochTicks + utcOffset)
# Since continuous integration infrastructure such as Travis CI
# uses clocks on UTC, it is useful to be able to compare against
# either of UTC or the known standard time.
Expand All @@ -52,8 +53,8 @@ def test_DateFromTicks(self):
)

def test_TimeFromTicks(self):
epochTicks = 1572851662.9782631 # Sun Nov 03 23:14:22 2019
got = TimeFromTicks(epochTicks)
epochTicks = 1572822862.9782631 # Sun Nov 03 23:14:22 2019
got = TimeFromTicks(epochTicks + utcOffset)
# Since continuous integration infrastructure such as Travis CI
# uses clocks on UTC, it is useful to be able to compare against
# either of UTC or the known standard time.
Expand All @@ -67,8 +68,8 @@ def test_TimeFromTicks(self):
)

def test_TimestampFromTicks(self):
epochTicks = 1572851662.9782631 # Sun Nov 03 23:14:22 2019
got = TimestampFromTicks(epochTicks)
epochTicks = 1572822862.9782631 # Sun Nov 03 23:14:22 2019
got = TimestampFromTicks(epochTicks + utcOffset)
# Since continuous integration infrastructure such as Travis CI
# uses clocks on UTC, it is useful to be able to compare against
# either of UTC or the known standard time.
Expand Down