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 import os | 4 import os |
5 import unittest | 5 import unittest |
6 | 6 |
7 from telemetry import value | 7 from telemetry import value |
8 from telemetry.page import page_set | 8 from telemetry.page import page_set |
9 | 9 |
10 | 10 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 self.assertFalse(b.IsMergableWith(a)) | 90 self.assertFalse(b.IsMergableWith(a)) |
91 | 91 |
92 def testAsDictBaseKeys(self): | 92 def testAsDictBaseKeys(self): |
93 v = ValueForAsDictTest(None, 'x', 'unit', important=True, description=None) | 93 v = ValueForAsDictTest(None, 'x', 'unit', important=True, description=None) |
94 d = v.AsDict() | 94 d = v.AsDict() |
95 | 95 |
96 self.assertEquals(d, { | 96 self.assertEquals(d, { |
97 'name': 'x', | 97 'name': 'x', |
98 'type': 'baz', | 98 'type': 'baz', |
99 'units': 'unit', | 99 'units': 'unit', |
| 100 'important': True |
100 }) | 101 }) |
101 | 102 |
102 def testAsDictWithPage(self): | 103 def testAsDictWithPage(self): |
103 page0 = self.pages[0] | 104 page0 = self.pages[0] |
104 | 105 |
105 v = ValueForAsDictTest(page0, 'x', 'unit', important=False, | 106 v = ValueForAsDictTest(page0, 'x', 'unit', important=False, |
106 description=None) | 107 description=None) |
107 d = v.AsDict() | 108 d = v.AsDict() |
108 | 109 |
109 self.assertIn('page_id', d) | 110 self.assertIn('page_id', d) |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 'units': 'unit' | 191 'units': 'unit' |
191 } | 192 } |
192 d1 = { | 193 d1 = { |
193 'type': 'value_for_from_dict_test', | 194 'type': 'value_for_from_dict_test', |
194 'name': 'y', | 195 'name': 'y', |
195 'units': 'unit' | 196 'units': 'unit' |
196 } | 197 } |
197 vs = value.Value.ListOfValuesFromListOfDicts([d0, d1], {}) | 198 vs = value.Value.ListOfValuesFromListOfDicts([d0, d1], {}) |
198 self.assertEquals(vs[0].name, 'x') | 199 self.assertEquals(vs[0].name, 'x') |
199 self.assertEquals(vs[1].name, 'y') | 200 self.assertEquals(vs[1].name, 'y') |
OLD | NEW |