Пример #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)