示例#1
0
 def test_tel(self):
     """Success scenario for tel validation"""
     tel = fields.Tel(default="01222222222")
     self.assertEqual(tel.default, "01222222222")
     """Failure scenario for tel validation"""
     tel = fields.Tel(default="012-222-22222")
     self.assertEqual(tel.from_raw(tel.default), "01222222222")
     with self.assertRaises(ValidationError):
         tel.validate("test")
示例#2
0
class Student(Base):
    ID = fields.Integer()
    name = fields.String()
    email = fields.Email()
    tel = fields.Tel()
    web = fields.URL()
    birthday = fields.Date()
示例#3
0
class Student(Base):
    name = fields.String(default="")
    age = fields.Integer(min=6, max=12)
    grades = fields.List(fields.Float())
    mobile = fields.Tel()
    address = fields.Object(Address)