Example #1
0
    def test_TypeField_validates_correct_type(self):
        field = TypeField()
        field.type = unicode

        try:
            field.validate(u'hello world')
        except ValidationError:
            self.fail('TypeField.validate() raised ValidationError unexpectedly')
Example #2
0
    def test_TypeField_validates_correct_type(self):
        field = TypeField()
        field.type = unicode

        try:
            field.validate(u'hello world')
        except ValidationError:
            self.fail(
                'TypeField.validate() raised ValidationError unexpectedly')
Example #3
0
    def test_TypeField_raises_ValidationError_on_incorrect_type(self):
        field = TypeField()
        field.type = unicode

        self.assertRaises(ValidationError, field.validate, 42)
Example #4
0
    def test_TypeField_raises_ValidationError_on_incorrect_type(self):
        field = TypeField()
        field.type = unicode

        self.assertRaises(ValidationError, field.validate, 42)