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

All Samples(3)  |  Call(3)  |  Derive(0)  |  Import(0)
add a parameter to the schema

src/p/y/py2json-HEAD/py2json/test/test_py2json.py   py2json(Download)
                print integer
        json_smd = Py2JSON(Foo)
        json_smd.add_param('foo', 12.3)
        assert json_smd.schema == '{"target": null, "envelope": "JSON", "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"}]}}, "foo": 12.300000000000001, "transport": "REST", "additionalParameters": true}'
 
                print integer
        json_smd = Py2JSON(foo)
        json_smd.add_param('foo', 12.3)
        json_smd.replace_param('foo', 'py2json replacement')
        assert json_smd.schema == '{"target": null, "envelope": "JSON", "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"}]}}, "foo": "py2json replacement", "transport": "REST", "additionalParameters": true}'
                print integer
        json_smd = Py2JSON(Foo)
        json_smd.add_param('foo', 12.3)
        json_smd.delete_param('foo')
        assert json_smd.schema == '{"target": null, "envelope": "JSON", "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"}]}}, "transport": "REST", "additionalParameters": true}'