code: def test_gh9551_raise_error_if_disp_true():
      """Test that if disp is true then zero derivative raises RuntimeError"""
  
      def f(x):
          return x * x + 1
  
      def f_p(x):
          return 2 * x
  
      assert_warns(
          RuntimeWarning, zeros.newton, f, 1.0, f_p, disp=False
      )
      with pytest.raises(
          RuntimeError,
          match=r"^Derivative was zero\. Failed to converge after \d+ iterations, value is [+-]?\d*\.\d+\.$",
      ):
          zeros.newton(f, 1.0, f_p)
      root = zeros.newton(f, complex(10.0, 10.0), f_p)
      assert_allclose(root, complex(0.0, 1.0))
  
imports: import pytest
  from math import sqrt, exp, sin, cos
  from functools import lru_cache
  from numpy.testing import assert_warns, assert_, assert_allclose, assert_equal, assert_array_equal, suppress_warnings
  import numpy
  from numpy import finfo, power, nan, isclose
  from scipy.optimize import zeros, newton, root_scalar
  from scipy._lib._util import getfullargspec_no_self
  from scipy.optimize._tstutils import get_tests, functions, fstrings
label_desc: Use image node_id 18 for calling a global function with example usage: test_gh9551_raise_error_if_disp_true() and returns: unknown, unknown