Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(10)  |  Call(9)  |  Derive(0)  |  Import(1)
Py2JSON will handle all the transformations

src/p/y/py2json-HEAD/py2json/test/test_py2json.py   py2json(Download)
from py2json import Py2JSON
import unittest
class Py2JSONTest(unittest.TestCase):
    def test_to_json_schema_type(self):
                return 'hello'
        json_smd = Py2JSON(Foo)
        s = 'string'
        assert json_smd.to_json_schema_type(s) == 'string'
                print 'bar'
        json_smd = Py2JSON(Foo)
        assert json_smd._get_docstring_method(name='foo', docstring=Foo().foo.__doc__) == {'target': 'foo', 'parameters': [{'type': 'string', 'optional': False, 'name': 'param', 'description': 'this is the coolest function ever'}]}
                print 'bar %s' % param
        json_smd = Py2JSON(Foo)
        assert json_smd._get_method_schema(Foo().foo) == {'target': 'foo', 'parameters': [{'default': 'this is a string', 'optional': False, 'type': 'string', 'name': 'param'}]}
        json_smd = Py2JSON(Foo)
        assert json_smd.schema == '{"services": {"bar2": {"target": "bar2", "parameters": [{"default": 666, "optional": false, "type": "integer", "name": "integer"}]}, "bar": {"target": "bar", "parameters": [{"default": "this is a str", "optional": false, "type": "string", "name": "string"}]}}, "envelope": "JSON", "target": null, "transport": "REST", "additionalParameters": true}'
        json_smd = Py2JSON(Foo2, excluded_methods=['bar'])