def test_bad_values(self): from cites.schema import IsPhone, CommonString PhoneField = CommonString.including_validators(IsPhone()) for value in self.bad_values: element = PhoneField(value) self.assertFalse(element.validate(), "Invalid phone %r did not trigger error" % value)
def test_ok_values(self): from cites.schema import IsPhone, CommonString PhoneField = CommonString.including_validators(IsPhone()) for value in self.ok_values: element = PhoneField(value) self.assertTrue(element.validate(), "Valid phone %r triggered error" % value)