OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import collections | 5 import collections |
6 import textwrap | 6 import textwrap |
7 import unittest | 7 import unittest |
8 | 8 |
9 from infra.services.gnumbd.support import data | 9 from infra.libs.git2 import data |
10 | 10 |
11 class TestCommitTimestamp(unittest.TestCase): | 11 class TestCommitTimestamp(unittest.TestCase): |
12 def testBasic(self): | 12 def testBasic(self): |
13 TS = '1399330903 -0700' | 13 TS = '1399330903 -0700' |
14 t = data.CommitTimestamp.from_raw(TS) | 14 t = data.CommitTimestamp.from_raw(TS) |
15 self.assertEqual(1399330903, t.secs) | 15 self.assertEqual(1399330903, t.secs) |
16 self.assertEqual(7, t.hours) | 16 self.assertEqual(7, t.hours) |
17 self.assertEqual(0, t.mins) | 17 self.assertEqual(0, t.mins) |
18 self.assertEqual('-', t.sign) | 18 self.assertEqual('-', t.sign) |
19 self.assertEqual('-0700', t.tz_str) | 19 self.assertEqual('-0700', t.tz_str) |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 def testPartial(self): | 433 def testPartial(self): |
434 COMMIT = textwrap.dedent("""\ | 434 COMMIT = textwrap.dedent("""\ |
435 tree deadbeefdeadbeefdeadbeefdeadbeefdeadbeef | 435 tree deadbeefdeadbeefdeadbeefdeadbeefdeadbeef |
436 """) | 436 """) |
437 with self.assertRaises(data.PartialCommit): | 437 with self.assertRaises(data.PartialCommit): |
438 data.CommitData.from_raw(COMMIT) | 438 data.CommitData.from_raw(COMMIT) |
439 | 439 |
440 def testEmpty(self): | 440 def testEmpty(self): |
441 with self.assertRaises(data.PartialCommit): | 441 with self.assertRaises(data.PartialCommit): |
442 data.CommitData.from_raw('') | 442 data.CommitData.from_raw('') |
OLD | NEW |