def test_validate(self): field = CepField() field._set_attr_name('d') self.assertIsNone(field.validate('12345678')) self.assertIsNone(field.validate('12345-678')) self.assertIsNone(field.validate('1234567-8')) self.assertEqual('CEP must have exactly 8 characters', field.validate('1234567')) self.assertEqual('CEP must have exactly 8 characters', field.validate('123456789')) self.assertEqual('CEP must contain only numbers', field.validate('1234567a'))
def test_validate(self): field = CepField() field._set_attr_name("d") self.assertIsNone(field.validate("12345678")) self.assertIsNone(field.validate("12345-678")) self.assertIsNone(field.validate("1234567-8")) self.assertEqual("CEP must have exactly 8 characters", field.validate("1234567")) self.assertEqual("CEP must have exactly 8 characters", field.validate("123456789")) self.assertEqual("CEP must contain only numbers", field.validate("1234567a"))