Exemplo n.º 1
0
 def test_str_field_bad(self):
     with self.assertRaises(ModelError):
         Field('f', str, 12)
     f = Field('f', str, '12')
     with self.assertRaises(ModelError):
         f.validate(12)
     with self.assertRaises(ModelError):
         f.validate(None)
Exemplo n.º 2
0
 def test_int_field_bad(self):
     with self.assertRaises(ModelError):
         Field('f', int, '12')
     f = Field('f', int, 12)
     with self.assertRaises(ModelError):
         f.validate('12')
     with self.assertRaises(ModelError):
         f.validate(None)
Exemplo n.º 3
0
 def test_int_field_good(self):
     f = Field('name', int)
     f.validate(1)