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

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

        with self.assertRaises(ValidationError):
            field.validate(value)
Example #3
0
    def test_fail_on_invalid_type(self):
        value = {}
        field = BytesField()

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

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

        with self.assertRaises(ValidationError):
            field.validate(value)
Example #6
0
    def test_fail_on_invalid_type(self):
        value = {}
        field = BytesField()

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