| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2016 The Chromium Authors. All rights reserved. | 2 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import copy | 6 import copy |
| 7 import os | 7 import os |
| 8 import sys | 8 import sys |
| 9 import unittest | 9 import unittest |
| 10 | 10 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 with self.assertRaises(config_validation.ValidationFail): | 101 with self.assertRaises(config_validation.ValidationFail): |
| 102 config_validation.validate_bisect_config(config, schema) | 102 config_validation.validate_bisect_config(config, schema) |
| 103 | 103 |
| 104 def test_validate_metric_format_failure(self): | 104 def test_validate_metric_format_failure(self): |
| 105 schema = { | 105 schema = { |
| 106 'metric': {'type': 'string'}, | 106 'metric': {'type': 'string'}, |
| 107 'bisect_mode': {'type': 'string'}, | 107 'bisect_mode': {'type': 'string'}, |
| 108 } | 108 } |
| 109 config = { | 109 config = { |
| 110 'bisect_mode': 'mean', | 110 'bisect_mode': 'mean', |
| 111 'metric': 'a/b/c', | 111 'metric': 'a/b/c/d', |
| 112 } | 112 } |
| 113 with self.assertRaises(config_validation.ValidationFail): | 113 with self.assertRaises(config_validation.ValidationFail): |
| 114 config_validation.validate_bisect_config(config, schema) | 114 config_validation.validate_bisect_config(config, schema) |
| 115 | 115 |
| 116 def test_validate_metric_format_pass(self): | 116 def test_validate_metric_format_pass(self): |
| 117 schema = { | 117 schema = { |
| 118 'metric': {'type': 'string'}, | 118 'metric': {'type': 'string'}, |
| 119 'bisect_mode': {'type': 'string'}, | 119 'bisect_mode': {'type': 'string'}, |
| 120 } | 120 } |
| 121 config = { | 121 config = { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 def test_validate_choice_failure(self): | 168 def test_validate_choice_failure(self): |
| 169 with self.assertRaises(config_validation.ValidationFail): | 169 with self.assertRaises(config_validation.ValidationFail): |
| 170 config_validation.validate_key( | 170 config_validation.validate_key( |
| 171 config={'x': 3}, | 171 config={'x': 3}, |
| 172 schema={'x': {'type': 'int', 'choices': [1, 2]}}, | 172 schema={'x': {'type': 'int', 'choices': [1, 2]}}, |
| 173 key='x') | 173 key='x') |
| 174 | 174 |
| 175 | 175 |
| 176 if __name__ == '__main__': | 176 if __name__ == '__main__': |
| 177 unittest.main() # pragma: no cover | 177 unittest.main() # pragma: no cover |
| OLD | NEW |