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')
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')
def test_TypeField_raises_ValidationError_on_incorrect_type(self): field = TypeField() field.type = unicode self.assertRaises(ValidationError, field.validate, 42)