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

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

Issue 2043973002: [Findit] Fracas crash triage dashboard (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Surpass pylint errors. Created 4 years, 6 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
« no previous file with comments | « appengine/findit/common/retry_http_client.py ('k') | appengine/findit/common/time_util.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
new file mode 100644
index 0000000000000000000000000000000000000000..607130e590bf5ea1be8b88c8d774e68baaab4b43
--- /dev/null
+++ b/appengine/findit/common/test/time_util_test.py
@@ -0,0 +1,37 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import unittest
+
+from common import time_util
+from datetime import datetime
+from datetime import timedelta
+
+
+class DiffTest(unittest.TestCase):
+ def testRemoveMicrosecondsFromDelta(self):
+ date1 = datetime(2016, 5, 1, 1, 1, 1, 1)
+ date2 = datetime(2016, 5, 1, 1, 1, 1, 2)
+ delta = date2 - date1
+
+ self.assertEqual(
+ time_util.RemoveMicrosecondsFromDelta(delta).microseconds,
+ 0)
+
+ def testFormatTimedelta(self):
+ self.assertIsNone(time_util.FormatTimedelta(None))
+ self.assertEqual(time_util.FormatTimedelta(timedelta(0, 1)),
+ '00:00:01')
+ self.assertEqual(time_util.FormatTimedelta(timedelta(0, 60)),
+ '00:01:00')
+ self.assertEqual(time_util.FormatTimedelta(timedelta(0, 3600)),
+ '01:00:00')
+ self.assertEqual(time_util.FormatTimedelta(timedelta(0, 0, 1)),
+ '00:00:00')
+
+ def testFormatDatetime(self):
+ self.assertIsNone(time_util.FormatDatetime(None))
+ self.assertEqual(
+ time_util.FormatDatetime(datetime(2016, 1, 2, 1, 2, 3)),
+ '2016-01-02 01:02:03 UTC')
« no previous file with comments | « appengine/findit/common/retry_http_client.py ('k') | appengine/findit/common/time_util.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698