code: def test_complex(self):
      # Purely imaginary
      y = geomspace(1j, 16j, num=5)
      assert_allclose(y, [1j, 2j, 4j, 8j, 16j])
      assert_array_equal(y.real, 0)
  
      y = geomspace(-4j, -324j, num=5)
      assert_allclose(y, [-4j, -12j, -36j, -108j, -324j])
      assert_array_equal(y.real, 0)
  
      y = geomspace(1 + 1j, 1000 + 1000j, num=4)
      assert_allclose(y, [1 + 1j, 10 + 10j, 100 + 100j, 1000 + 1000j])
  
      y = geomspace(-1 + 1j, -1000 + 1000j, num=4)
      assert_allclose(
          y, [-1 + 1j, -10 + 10j, -100 + 100j, -1000 + 1000j]
      )
  
      # Logarithmic spirals
      y = geomspace(-1, 1, num=3, dtype=complex)
      assert_allclose(y, [-1, 1j, +1])
  
      y = geomspace(0 + 3j, -3 + 0j, 3)
      assert_allclose(y, [0 + 3j, -3 / sqrt(2) + 3j / sqrt(2), -3 + 0j])
      y = geomspace(0 + 3j, 3 + 0j, 3)
      assert_allclose(y, [0 + 3j, 3 / sqrt(2) + 3j / sqrt(2), 3 + 0j])
      y = geomspace(-3 + 0j, 0 - 3j, 3)
      assert_allclose(y, [-3 + 0j, -3 / sqrt(2) - 3j / sqrt(2), 0 - 3j])
      y = geomspace(0 + 3j, -3 + 0j, 3)
      assert_allclose(y, [0 + 3j, -3 / sqrt(2) + 3j / sqrt(2), -3 + 0j])
      y = geomspace(-2 - 3j, 5 + 7j, 7)
      assert_allclose(
          y,
          [
              -2 - 3j,
              -0.29058977 - 4.15771027j,
              2.08885354 - 4.34146838j,
              4.58345529 - 3.16355218j,
              6.41401745 - 0.55233457j,
              6.75707386 + 3.11795092j,
              5 + 7j,
          ],
      )
  
      # Type promotion should prevent the -5 from becoming a NaN
      y = geomspace(3j, -5, 2)
      assert_allclose(y, [3j, -5])
      y = geomspace(-5, 3j, 2)
      assert_allclose(y, [-5, 3j])
  
imports: import sys
  import pytest
  import numpy
  from numpy import logspace, linspace, geomspace, dtype, array, arange, isnan, ndarray, sqrt, nextafter, stack, errstate
  from numpy._core import sctypes
  from numpy._core.function_base import add_newdoc
  from numpy.testing import assert_, assert_equal, assert_raises, assert_array_equal, assert_allclose, IS_PYPY
label_desc: Use image node_id 4 for calling the TestGeomspace obj's underlying member method code with example usage: obj.test_complex() without return types