コード例 #1
0
ファイル: test_validators.py プロジェクト: boris317/JsonWeb
    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))
コード例 #2
0
ファイル: test_schema.py プロジェクト: mbatchkarov/JsonWeb
 class PersonSchema(ObjectSchema):
     first_name = String()
     last_name = String()
     id = Integer()
     test = Float()
コード例 #3
0
ファイル: test_schema.py プロジェクト: mbatchkarov/JsonWeb
 class JobSchema(ObjectSchema):
     title = String()
     id = Integer()
コード例 #4
0
ファイル: test_validators.py プロジェクト: boris317/JsonWeb
 def test_nullable_is_true(self):
     v = Integer(nullable=True)
     self.assertEqual(None, v.validate(None))
コード例 #5
0
ファイル: mySchema.py プロジェクト: kappyprasad/Clouds
class AddressSchema(ObjectSchema):
    number = Integer()
    street = String()
    suburb = String()