def test_always_required(self): field = mapping.ConstantField(default='test') assert field.required self.assertRaises(TypeError, mapping.ConstantField, default='test', required=False)
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')))
class Dummy(mapping.Mapping): field = mapping.ConstantField(default=42)