def test_walk_array(self): subject = {'list': [Int()]} self.assertEqual( {'list': [{"type": "integer"}]}, swagger.to_dict(subject) ) self.assertTrue(isinstance(subject['list'][0], Int))
def test_walk_schema(self): subject = swagger.Object(properties={"a": Int()}) self.assertEqual( { "type": "object", "properties": { "a": { "type": "integer" } } }, swagger.to_dict(subject) ) self.assertTrue(isinstance(subject, swagger.Object)) self.assertTrue(isinstance(subject.properties["a"], Int))
def test_walk_primitives(self): self.assertEqual( {"a": 1, "b": "2", "c": {}}, swagger.to_dict({"a": 1, "b": "2", "c": {}}) )