def test_integer_validator(self): v = Integer() self.assertEqual(v.validate(42), 42) with self.assertRaises(ValidationError) as c: v.validate("foo") self.assertEqual("Expected int got str instead.", str(c.exception))
class PersonSchema(ObjectSchema): first_name = String() last_name = String() id = Integer() test = Float()
class JobSchema(ObjectSchema): title = String() id = Integer()
def test_nullable_is_true(self): v = Integer(nullable=True) self.assertEqual(None, v.validate(None))
class AddressSchema(ObjectSchema): number = Integer() street = String() suburb = String()