blob: a2f4073dcf73e02f7b40b0a1df9b0db62c955d87 [file] [log] [blame]
commit-bot@chromium.org3eb77e42014-04-04 16:40:25 +00001#!/usr/bin/python
2
3"""
4Copyright 2014 Google Inc.
5
6Use of this source code is governed by a BSD-style license that can be
7found in the LICENSE file.
8
9Test results.py
10
11"""
12
13# Imports from within Skia
14import base_unittest
15import results
16
17
18class ResultsTest(base_unittest.TestCase):
19
20 def test_combine_subdicts_typical(self):
21 """Test combine_subdicts() with no merge conflicts. """
22 input_dict = {
23 "failed" : {
24 "changed.png" : [ "bitmap-64bitMD5", 8891695120562235492 ],
25 },
26 "no-comparison" : {
27 "unchanged.png" : [ "bitmap-64bitMD5", 11092453015575919668 ],
28 }
29 }
30 expected_output_dict = {
31 "changed.png" : [ "bitmap-64bitMD5", 8891695120562235492 ],
32 "unchanged.png" : [ "bitmap-64bitMD5", 11092453015575919668 ],
33 }
34 actual_output_dict = results.BaseComparisons.combine_subdicts(
35 input_dict=input_dict)
36 self.assertEqual(actual_output_dict, expected_output_dict)
37
38 def test_combine_subdicts_with_merge_conflict(self):
39 """Test combine_subdicts() with a merge conflict. """
40 input_dict = {
41 "failed" : {
42 "changed.png" : [ "bitmap-64bitMD5", 8891695120562235492 ],
43 },
44 "no-comparison" : {
45 "changed.png" : [ "bitmap-64bitMD5", 11092453015575919668 ],
46 }
47 }
48 with self.assertRaises(Exception):
49 actual_output_dict = results.BaseComparisons.combine_subdicts(
50 input_dict=input_dict)
51
52
53def main():
54 base_unittest.main(ResultsTest)
55
56
57if __name__ == '__main__':
58 main()