def test_rest_exception(): mlflow_exception = MlflowException("test", error_code=RESOURCE_ALREADY_EXISTS) json_exception = mlflow_exception.serialize_as_json() deserialized_rest_exception = RestException(json.loads(json_exception)) assert deserialized_rest_exception.error_code == "RESOURCE_ALREADY_EXISTS" assert "test" in deserialized_rest_exception.message
def test_serialize_to_json(self): mlflow_exception = MlflowException("test") deserialized = json.loads(mlflow_exception.serialize_as_json()) assert deserialized["message"] == "test" assert deserialized["error_code"] == "INTERNAL_ERROR"
def test_serialize_to_json(self): mlflow_exception = MlflowException('test') deserialized = json.loads(mlflow_exception.serialize_as_json()) assert deserialized['message'] == 'test' assert deserialized['error_code'] == 'INTERNAL_ERROR'