Example #1
0
    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))
Example #2
0
 class PersonSchema(ObjectSchema):
     first_name = String()
     last_name = String()
     id = Integer()
     test = Float()
Example #3
0
 class JobSchema(ObjectSchema):
     title = String()
     id = Integer()
Example #4
0
 def test_nullable_is_true(self):
     v = Integer(nullable=True)
     self.assertEqual(None, v.validate(None))
Example #5
0
class AddressSchema(ObjectSchema):
    number = Integer()
    street = String()
    suburb = String()