예제 #1
0
 def test_one(self):
     res = {"jsonrpc": "2.0", "result": "foo", "id": 1}
     jsonrpc_response = JSONRPCResponse(res)
     assert total_results(jsonrpc_response) == 1
예제 #2
0
 def test_unparsed(self):
     assert total_results(None) == 0
예제 #3
0
 def test_list(self):
     res = {"jsonrpc": "2.0", "result": "foo", "id": 1}
     jsonrpc_response = JSONRPCResponse(res)
     assert total_results([jsonrpc_response, jsonrpc_response]) == 2
예제 #4
0
def test_total_responses_list():
    response = SuccessResponse(**{"jsonrpc": "2.0", "result": "foo", "id": 1})
    assert total_results([response, response]) == 2
예제 #5
0
def test_total_responses_one():
    response = SuccessResponse(**{"jsonrpc": "2.0", "result": "foo", "id": 1})
    assert total_results(response) == 1
예제 #6
0
def test_total_responses_unparsed():
    assert total_results(None) == 0