class Record(Model): pk = Num64Field()
class Record(Model): pk = Num64Field(min_value=0) data = StringField(min_length=1, max_length=100)
class Record(Model): pk = Num64Field(required=True)
def test_invalid_min_value(self): with self.assertRaises(ValueError): Num64Field(min_value=INT64_MIN - 1)
def test_invalid_max_value(self): with self.assertRaises(ValueError): Num64Field(max_value=INT64_MAX + 1)
def test_fail_on_max_value(self): value = 2L field = Num64Field(max_value=1) with self.assertRaises(ValidationError): field.validate(value)
def test_fail_on_invalid_type(self): value = 'invalid-value' field = Num64Field(min_value=1) with self.assertRaises(ValidationError): field.validate(value)
class Record(Model): pk = Num64Field() data = StringField()
class Record(Model): pk = Num64Field(default=get_default_pk) data = StringField(default=DataGetter())
class Record(Model): pk = Num64Field(default=default_pk) data = StringField(default=default_data)