def test_one(self): res = {"jsonrpc": "2.0", "result": "foo", "id": 1} jsonrpc_response = JSONRPCResponse(res) assert total_results(jsonrpc_response) == 1
def test_unparsed(self): assert total_results(None) == 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
def test_total_responses_list(): response = SuccessResponse(**{"jsonrpc": "2.0", "result": "foo", "id": 1}) assert total_results([response, response]) == 2
def test_total_responses_one(): response = SuccessResponse(**{"jsonrpc": "2.0", "result": "foo", "id": 1}) assert total_results(response) == 1
def test_total_responses_unparsed(): assert total_results(None) == 0