| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2015 The LUCI Authors. All rights reserved. | 2 # Copyright 2015 The LUCI Authors. All rights reserved. |
| 3 # Use of this source code is governed under the Apache License, Version 2.0 | 3 # Use of this source code is governed under the Apache License, Version 2.0 |
| 4 # that can be found in the LICENSE file. | 4 # that can be found in the LICENSE file. |
| 5 | 5 |
| 6 import os | |
| 7 import sys | |
| 8 import unittest | 6 import unittest |
| 9 | 7 |
| 10 import test_env | 8 import test_env |
| 11 | 9 |
| 12 from recipe_engine import loader, recipe_api, config | 10 from recipe_engine import config |
| 13 | 11 |
| 14 class TestConfigGroupSchema(unittest.TestCase): | 12 class TestConfigGroupSchema(unittest.TestCase): |
| 15 def testNewReturnsConfigGroup(self): | 13 def testNewReturnsConfigGroup(self): |
| 16 schema = config.ConfigGroupSchema(test=config.Single(int)) | 14 schema = config.ConfigGroupSchema(test=config.Single(int)) |
| 17 | 15 |
| 18 self.assertIsInstance(schema.new(test=3), config.ConfigGroup) | 16 self.assertIsInstance(schema.new(test=3), config.ConfigGroup) |
| 19 | 17 |
| 20 def testCallCallsNew(self): | 18 def testCallCallsNew(self): |
| 21 schema = config.ConfigGroupSchema(test=config.Single(int)) | 19 schema = config.ConfigGroupSchema(test=config.Single(int)) |
| 22 sentinel = object() | 20 sentinel = object() |
| (...skipping 14 matching lines...) Expand all Loading... |
| 37 schema = config.ConfigGroupSchema(test=config.Enum('foo', 'bar')) | 35 schema = config.ConfigGroupSchema(test=config.Enum('foo', 'bar')) |
| 38 self.assertIsInstance(schema.new(test='foo'), config.ConfigGroup) | 36 self.assertIsInstance(schema.new(test='foo'), config.ConfigGroup) |
| 39 | 37 |
| 40 def testMustBeOneOf(self): | 38 def testMustBeOneOf(self): |
| 41 schema = config.ConfigGroupSchema(test=config.Enum('foo', 'bar')) | 39 schema = config.ConfigGroupSchema(test=config.Enum('foo', 'bar')) |
| 42 with self.assertRaises(ValueError): | 40 with self.assertRaises(ValueError): |
| 43 schema.new(test='baz') | 41 schema.new(test='baz') |
| 44 | 42 |
| 45 if __name__ == '__main__': | 43 if __name__ == '__main__': |
| 46 unittest.main() | 44 unittest.main() |
| OLD | NEW |