Exemple #1
0
def _string_to_dict(request):
    """Convert a JSON-RPC request string, to a dictionary.

    :param request: The JSON-RPC request string.
    :raises ValueError: If the string cannot be parsed to JSON.
    :returns: The same request in dict form.
    """
    try:
        return json.loads(request)
    except ValueError:
        raise ParseError()
 def test_configuration(self):
     ParseError.message = "Error parsing"
     self.assertEqual("Error parsing", str(ParseError()))
     ParseError.message = "Parse error"
 def test_str(self):
     self.assertEqual("Parse error", str(ParseError()))
 def test_raise(self):
     with self.assertRaises(JsonRpcServerError):
         raise ParseError()
Exemple #5
0
 def test_configuration(self):
     ParseError.message = 'Error parsing'
     self.assertEqual('Error parsing', str(ParseError()))
     ParseError.message = 'Parse error'