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