def testValidate(self): field = InterfaceField(title=u'Interface field', description=u'', readonly=False, required=False) field.validate(DummyInterface) self.assertRaises(WrongType, field.validate, object())
class IListTypeDefinition(Interface): """used for indicating the type of mailing list""" title = Attribute("displayable title of list type") description = Attribute("displayable description of list type") list_marker = InterfaceField(title=_(u'list marker'), description=_(u'marked interface used to indicate the list type'), constraint=IListType.providedBy) index = Int(title=_(u'sort index'))
def __init__(self, **kw): super(GlobalInterface, self).__init__(InterfaceField(), **kw)
def testValidateRequired(self): field = InterfaceField(title=u'Interface field', description=u'', readonly=False, required=True) self.assertRaises(RequiredMissing, field.validate, None)