Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4170)

Unified Diff: appengine/findit/common/test/time_util_test.py

Issue 2376573004: [Findit] For automatic analyses of flaky tests, run the Swarming tasks off PST peak hours. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: appengine/findit/common/test/time_util_test.py
diff --git a/appengine/findit/common/test/time_util_test.py b/appengine/findit/common/test/time_util_test.py
index 607130e590bf5ea1be8b88c8d774e68baaab4b43..aa43d756778cac6937c33ed73caac7d00c69dd1a 100644
--- a/appengine/findit/common/test/time_util_test.py
+++ b/appengine/findit/common/test/time_util_test.py
@@ -8,6 +8,8 @@ from common import time_util
from datetime import datetime
from datetime import timedelta
+import pytz
+
class DiffTest(unittest.TestCase):
def testRemoveMicrosecondsFromDelta(self):
@@ -35,3 +37,12 @@ class DiffTest(unittest.TestCase):
self.assertEqual(
time_util.FormatDatetime(datetime(2016, 1, 2, 1, 2, 3)),
'2016-01-02 01:02:03 UTC')
+
+ def testGetDateTimeInTimezone(self):
+ utc_datetime = datetime(2016, 9, 27, 20, 46, 18, 1, pytz.utc)
+ result_pst_datetime = time_util.GetDatetimeInTimezone(
+ 'US/Pacific', utc_datetime)
+ expected_pst_datetime = datetime(2016, 9, 27, 13, 46, 18, 1,
+ pytz.timezone('US/Pacific'))
+ self.assertEqual(result_pst_datetime.date(), expected_pst_datetime.date())
+ self.assertEqual(result_pst_datetime.time(), expected_pst_datetime.time())

Powered by Google App Engine
This is Rietveld 408576698