def METHOD_NAME(self, rhs, lhs=None, cholesky=False):
    linear_op = self.create_linear_op().requires_grad_(True)
    linear_op_copy = linear_op.clone().detach_().requires_grad_(True)
    evaluated = self.evaluate_linear_op(linear_op_copy)
    evaluated.register_hook(self._ensure_symmetric_grad)
    # Create a test right hand side and left hand side
    rhs.requires_grad_(True)
    rhs_copy = rhs.clone().detach().requires_grad_(True)
    if lhs is not None:
        lhs.requires_grad_(True)
        lhs_copy = lhs.clone().detach().requires_grad_(True)
    _wrapped_cg = MagicMock(wraps=linear_operator.utils.linear_cg)
    with patch("linear_operator.utils.linear_cg", new=_wrapped_cg) as linear_cg_mock:
        with linear_operator.settings.max_cholesky_size(
            math.inf if cholesky else 0
        ), linear_operator.settings.cg_tolerance(1e-4):
            # Perform the solve
            if lhs is not None:
                res = linear_op.solve(rhs, lhs)
                actual = lhs_copy @ evaluated.inverse() @ rhs_copy
            else:
                res = linear_op.solve(rhs)
                actual = evaluated.inverse().matmul(rhs_copy)
            self.assertAllClose(res, actual, rtol=0.02, atol=1e-5)
            # Perform backward pass
            grad = torch.randn_like(res)
            res.backward(gradient=grad)
            actual.backward(gradient=grad)
            for arg, arg_copy in zip(linear_op.representation(), linear_op_copy.representation()):
                if arg_copy.requires_grad and arg_copy.is_leaf and arg_copy.grad is not None:
                    self.assertAllClose(arg.grad, arg_copy.grad, rtol=0.03, atol=1e-5)
            self.assertAllClose(rhs.grad, rhs_copy.grad, rtol=0.03, atol=1e-5)
            if lhs is not None:
                self.assertAllClose(lhs.grad, lhs_copy.grad, rtol=0.03, atol=1e-5)
        self.assertFalse(linear_cg_mock.called)