コード例 #1
0
ファイル: test_field.py プロジェクト: threefoldtech/js-ng
 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)