code: def test_fromstring_complex():
      for ctype in ["complex", "cdouble"]:
          # Check spacing between separator
          assert_equal(
              np.fromstring("1, 2 ,  3  ,4", sep=",", dtype=ctype),
              np.array([1.0, 2.0, 3.0, 4.0]),
          )
          # Real component not specified
          assert_equal(
              np.fromstring("1j, -2j,  3j, 4e1j", sep=",", dtype=ctype),
              np.array([1.0j, -2.0j, 3.0j, 40.0j]),
          )
          # Both components specified
          assert_equal(
              np.fromstring(
                  "1+1j,2-2j, -3+3j,  -4e1+4j", sep=",", dtype=ctype
              ),
              np.array(
                  [1.0 + 1.0j, 2.0 - 2.0j, -3.0 + 3.0j, -40.0 + 4j]
              ),
          )
          # Spaces at wrong places
          with assert_warns(DeprecationWarning):
              assert_equal(
                  np.fromstring("1+2 j,3", dtype=ctype, sep=","),
                  np.array([1.0]),
              )
          with assert_warns(DeprecationWarning):
              assert_equal(
                  np.fromstring("1+ 2j,3", dtype=ctype, sep=","),
                  np.array([1.0]),
              )
          with assert_warns(DeprecationWarning):
              assert_equal(
                  np.fromstring("1 +2j,3", dtype=ctype, sep=","),
                  np.array([1.0]),
              )
          with assert_warns(DeprecationWarning):
              assert_equal(
                  np.fromstring("1+j", dtype=ctype, sep=","),
                  np.array([1.0]),
              )
          with assert_warns(DeprecationWarning):
              assert_equal(
                  np.fromstring("1+", dtype=ctype, sep=","),
                  np.array([1.0]),
              )
          with assert_warns(DeprecationWarning):
              assert_equal(
                  np.fromstring("1j+1", dtype=ctype, sep=","),
                  np.array([1j]),
              )
  
imports: import warnings
  import platform
  import pytest
  import numpy
  from numpy.testing import assert_, assert_equal, assert_raises, assert_warns, assert_array_equal, temppath, IS_MUSL
  from numpy._core.tests._locales import CommaDecimalPointLocale
label_desc: Use image node_id 7 for calling a global function with example usage: test_fromstring_complex() without return types