示例#1
0
    def test_fail_on_regex(self):
        value = u"123test45"
        field = StringField(regex=u"^\d+$")

        with self.assertRaises(ValidationError):
            field.validate(value)
示例#2
0
    def test_fail_on_max_length(self):
        value = u"test"
        field = StringField(max_length=1)

        with self.assertRaises(ValidationError):
            field.validate(value)
示例#3
0
    def test_fail_on_invalid_type(self):
        value = {}
        field = StringField()

        with self.assertRaises(ValidationError):
            field.validate(value)
示例#4
0
    def test_fail_on_regex(self):
        value = u'123test45'
        field = StringField(regex=u'^\d+$')

        with self.assertRaises(ValidationError):
            field.validate(value)
示例#5
0
    def test_fail_on_max_length(self):
        value = u'test'
        field = StringField(max_length=1)

        with self.assertRaises(ValidationError):
            field.validate(value)
示例#6
0
    def test_fail_on_invalid_type(self):
        value = {}
        field = StringField()

        with self.assertRaises(ValidationError):
            field.validate(value)