#NEWLINE# def test_jsonrpc_spec_v2_example11( prot ) : #NEWLINE# #INDENT# requests = prot . parse_request ( '[\n        {"jsonrpc": "2.0", "method": "sum", "params": [1,2,4], "id": "1"},\n        {"jsonrpc": "2.0", "method": "notify_hello", "params": [7]},\n        {"jsonrpc": "2.0", "method": "subtract", "params": [42,23], "id": "2"},\n        {"foo": "boo"},\n        {"jsonrpc": "2.0", "method": "foo.get", "params": {"name": "myself"}, "id": "5"},\n        {"jsonrpc": "2.0", "method": "get_data", "id": "9"}\n    ]' ) #NEWLINE# assert isinstance ( requests [ 3 ] , JSONRPCInvalidRequestError ) #NEWLINE# responses = requests . create_batch_response ( ) #NEWLINE# responses . append ( requests [ 0 ] . respond ( 7 ) ) #NEWLINE# responses . append ( requests [ 2 ] . respond ( 19 ) ) #NEWLINE# responses . append ( requests [ 3 ] . error_respond ( ) ) #NEWLINE# responses . append ( requests [ 4 ] . error_respond ( MethodNotFoundError ( 'foo.get' ) ) ) #NEWLINE# responses . append ( requests [ 5 ] . respond ( [ 'hello' , 5 ] ) ) #NEWLINE# assert _json_equal ( '[\n        {"jsonrpc": "2.0", "result": 7, "id": "1"},\n        {"jsonrpc": "2.0", "result": 19, "id": "2"},\n        {"jsonrpc": "2.0", "error": {"code": -32600, "message": "Invalid Request"}, "id": null},\n        {"jsonrpc": "2.0", "error": {"code": -32601, "message": "Method not found"}, "id": "5"},\n        {"jsonrpc": "2.0", "result": ["hello", 5], "id": "9"}\n    ]' , responses . serialize ( ) )