Beispiel #1
0
class PersonSchema(ObjectSchema):
    id = Integer()
    name = String()
    dob = DateTime(format='%Y-%m-%dT%H:%M:%S')
    title = String(optional=True)
    address = EnsureType("Address")
    jobs = List(EnsureType("Job"))
Beispiel #2
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 #3
0
class _Message(ObjectSchema):
    StatusCode           = String()
    AutoScalingGroupARN  = String()
    Description          = String()
    Service              = String()
    Details              = Dict(String())
    AutoScalingGroupName = String()
    ActivityId           = String()
    AccountId            = String()
    RequestId            = String()
    StartTime            = DateTime(format='%Y-%m-%dT%H:%M:%S.%f')
    Time                 = DateTime(format='%Y-%m-%dT%H:%M:%S.%f')
    Progress             = Integer()
    EndTime              = DateTime(format='%Y-%m-%dT%H:%M:%S.%f')
    Cause                = String()
    Event                = String()
    StatusMessage        = String()
    EC2InstanceId        = String()
Beispiel #4
0
 def test_nullable_is_true(self):
     v = Integer(nullable=True)
     self.assertEqual(None, v.validate(None))
Beispiel #5
0
 class PersonSchema(ObjectSchema):
     first_name = String()
     last_name = String()
     id = Integer()
     test = Float()
Beispiel #6
0
 class JobSchema(ObjectSchema):
     title = String()
     id = Integer()
Beispiel #7
0
class AddressSchema(ObjectSchema):
    number = Integer()
    street = String()
    suburb = String()