| 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 from datetime import datetime | 5 from datetime import datetime |
| 6 from datetime import timedelta | 6 from datetime import timedelta |
| 7 import os | 7 import os |
| 8 import sys | 8 import sys |
| 9 import textwrap | 9 import textwrap |
| 10 import unittest | 10 import unittest |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 self.assertTrue(blame_result.path, expected_blame.path) | 68 self.assertTrue(blame_result.path, expected_blame.path) |
| 69 for region, expected_region in zip(blame_result, expected_blame): | 69 for region, expected_region in zip(blame_result, expected_blame): |
| 70 self.assertTrue(region.ToDict(), expected_region.ToDict()) | 70 self.assertTrue(region.ToDict(), expected_region.ToDict()) |
| 71 | 71 |
| 72 def testGitBlameParserEmptyOutput(self): | 72 def testGitBlameParserEmptyOutput(self): |
| 73 blame_result = self.blame_parser('', 'src/core/SkFont.h', 'rev') | 73 blame_result = self.blame_parser('', 'src/core/SkFont.h', 'rev') |
| 74 self.assertIsNone(blame_result) | 74 self.assertIsNone(blame_result) |
| 75 | 75 |
| 76 def testGitBlameParserDummyOutput(self): | 76 def testGitBlameParserDummyOutput(self): |
| 77 blame_result = self.blame_parser('Dummy', | 77 blame_result = self.blame_parser('Dummy', |
| 78 'src/core/SkFont.h', | 78 'src/core/SkFont.h', |
| 79 'rev') | 79 'rev') |
| 80 self.assertIsNone(blame_result) | 80 self.assertIsNone(blame_result) |
| 81 | 81 |
| 82 def testGetFileChangeInfo(self): | 82 def testGetFileChangeInfo(self): |
| 83 self.assertIsNone(local_git_parsers.GetFileChangeInfo('change type', | 83 self.assertIsNone(local_git_parsers.GetFileChangeInfo('unknown change type', |
| 84 None, None)) | 84 None, None)) |
| 85 | 85 |
| 86 def testGitChangeLogParser(self): | 86 def testGitChangeLogParser(self): |
| 87 output = textwrap.dedent( | 87 output = textwrap.dedent( |
| 88 """ | 88 """ |
| 89 commit revision | 89 commit revision |
| 90 tree tree_revision | 90 tree tree_revision |
| 91 parents parent_revision | 91 parents parent_revision |
| 92 | 92 |
| 93 author Test | 93 author Test |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 output = '**Changelog start**\nblablabla' | 237 output = '**Changelog start**\nblablabla' |
| 238 self.assertEqual(local_git_parsers.GitChangeLogsParser()(output, | 238 self.assertEqual(local_git_parsers.GitChangeLogsParser()(output, |
| 239 'http://repo'), []) | 239 'http://repo'), []) |
| 240 | 240 |
| 241 def testGitDiffParser(self): | 241 def testGitDiffParser(self): |
| 242 self.assertEqual('output', local_git_parsers.GitDiffParser()('output')) | 242 self.assertEqual('output', local_git_parsers.GitDiffParser()('output')) |
| 243 | 243 |
| 244 | 244 |
| 245 if __name__ == '__main__': | 245 if __name__ == '__main__': |
| 246 unittest.main() | 246 unittest.main() |
| OLD | NEW |