Пример #1
0
class SampleEntity(Entity):
    string_field = StringField()
    string_field_w_default = StringField('default')
    integer_field = IntField()
    integer_field_w_default = IntField(42)
    enum_field = EnumField(ChooseOne)
    enum_field_w_default = EnumField(ChooseOne, ChooseOne.B)
    list_field = ListField(string_types, ['alpha', 'beta', 'gamma'])
Пример #2
0
class DerivedSampleEntity(SampleEntity):
    string_field_w_default = StringField('new_default')
    choice = EnumField(ChooseOne, required=False)
    new_field = IntField()
    enum_field = ChooseOne.A

    def __init__(self, new_field, **kwargs):
        super(DerivedSampleEntity, self).__init__(new_field=new_field,
                                                  **kwargs)
Пример #3
0
    def test_unassigned_name_throws_error(self):
        field = IntField()
        with ExpectedException(AttributeError):
            field.name

        class Clazz(object):
            int_field = IntField()

        clazz = Clazz()
        with ExpectedException(AttributeError):
            clazz.int_field
Пример #4
0
class PackageSpec(Entity):
    """
    pyside-1.1.2-py27_1
    zlib-1.2.7-1
    """
    channel = StringField()
    name = StringField()
    version = StringField()
    build = StringField()
    build_number = IntField()
    platform = EnumField(Platform)
    arch = EnumField(Arch)
Пример #5
0
 class Clazz(Entity):
     int_field = IntField(required=False, nullable=True)
Пример #6
0
 class Clazz(Entity):
     int_field = IntField('18')
Пример #7
0
 class Clazz(object):
     int_field = IntField()
Пример #8
0
class Patch(Entity):
    filename = StringField()
    url = StringField()
    patch_level = IntField(default=0)