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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
(Empty)
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import unittest
6
7 from common import time_util
8 from datetime import datetime
9 from datetime import timedelta
10
11
12 class DiffTest(unittest.TestCase):
13 def testRemoveMicrosecondsFromDelta(self):
14 date1 = datetime(2016, 5, 1, 1, 1, 1, 1)
15 date2 = datetime(2016, 5, 1, 1, 1, 1, 2)
16 delta = date2 - date1
17
18 self.assertEqual(
19 time_util.RemoveMicrosecondsFromDelta(delta).microseconds,
20 0)
21
22 def testFormatTimedelta(self):
23 self.assertIsNone(time_util.FormatTimedelta(None))
24 self.assertEqual(time_util.FormatTimedelta(timedelta(0, 1)),
25 '00:00:01')
26 self.assertEqual(time_util.FormatTimedelta(timedelta(0, 60)),
27 '00:01:00')
28 self.assertEqual(time_util.FormatTimedelta(timedelta(0, 3600)),
29 '01:00:00')
30 self.assertEqual(time_util.FormatTimedelta(timedelta(0, 0, 1)),
31 '00:00:00')
32
33 def testFormatDatetime(self):
34 self.assertIsNone(time_util.FormatDatetime(None))
35 self.assertEqual(
36 time_util.FormatDatetime(datetime(2016, 1, 2, 1, 2, 3)),
37 '2016-01-02 01:02:03 UTC')
OLDNEW
« no previous file with comments | « no previous file | appengine/findit/common/time_util.py » ('j') | appengine/findit/handlers/crash/fracas_dashboard.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698