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, )) )
def testMustBeOneOf(self): schema = config.ConfigGroupSchema(test=config.Enum('foo', 'bar')) with self.assertRaises(ValueError): schema.new(test='baz')
def testEnum(self): schema = config.ConfigGroupSchema(test=config.Enum('foo', 'bar')) self.assertIsInstance(schema.new(test='foo'), config.ConfigGroup)