示例#1
0
 class Record(Model):
     pk = Num64Field()
示例#2
0
 class Record(Model):
     pk = Num64Field(min_value=0)
     data = StringField(min_length=1, max_length=100)
示例#3
0
 class Record(Model):
     pk = Num64Field(required=True)
示例#4
0
 def test_invalid_min_value(self):
     with self.assertRaises(ValueError):
         Num64Field(min_value=INT64_MIN - 1)
示例#5
0
 def test_invalid_max_value(self):
     with self.assertRaises(ValueError):
         Num64Field(max_value=INT64_MAX + 1)
示例#6
0
    def test_fail_on_max_value(self):
        value = 2L
        field = Num64Field(max_value=1)

        with self.assertRaises(ValidationError):
            field.validate(value)
示例#7
0
    def test_fail_on_invalid_type(self):
        value = 'invalid-value'
        field = Num64Field(min_value=1)

        with self.assertRaises(ValidationError):
            field.validate(value)
示例#8
0
 class Record(Model):
     pk = Num64Field()
     data = StringField()
示例#9
0
 class Record(Model):
     pk = Num64Field(default=get_default_pk)
     data = StringField(default=DataGetter())
示例#10
0
 class Record(Model):
     pk = Num64Field(default=default_pk)
     data = StringField(default=default_data)