示例#1
0
 def test_always_required(self):
     field = mapping.ConstantField(default='test')
     assert field.required
     self.assertRaises(TypeError,
                       mapping.ConstantField,
                       default='test',
                       required=False)
示例#2
0
 class Dummy(mapping.Mapping):
     field = mapping.ComponentField(mapping=mapping.Component.build(
         mapping.Field(name='foo'), mapping.IntegerField(name='bar'),
         mapping.ConstantField(name='baz', default='42')))
示例#3
0
 class Dummy(mapping.Mapping):
     field = mapping.ConstantField(default=42)