Example #1
0
 def test_enum(self):
   cd = config.Enum("hello", "world")
   self.assertEqual(
     cd.schema_proto(),
     d.Schema(enum=d.Schema.Enum(
       values_json=[
         '"hello"',
         '"world"',
       ],
       required=True,
     ))
   )
Example #2
0
 def testMustBeOneOf(self):
   schema = config.ConfigGroupSchema(test=config.Enum('foo', 'bar'))
   with self.assertRaises(ValueError):
     schema.new(test='baz')
Example #3
0
 def testEnum(self):
   schema = config.ConfigGroupSchema(test=config.Enum('foo', 'bar'))
   self.assertIsInstance(schema.new(test='foo'), config.ConfigGroup)