code: def test_string_to_complex_cast(str_type, scalar_type):
      value = scalar_type(b"1+3j")
      assert scalar_type(value) == 1 + 3j
      assert (
          np.array([value], dtype=object).astype(scalar_type)[()]
          == 1 + 3j
      )
      assert np.array(value).astype(scalar_type)[()] == 1 + 3j
      arr = np.zeros(1, dtype=scalar_type)
      arr[0] = value
      assert arr[0] == 1 + 3j
  
imports: import sys
  import numpy
  import numpy._core.umath
  from numpy._core._rational_tests import rational
  import pytest
  from numpy.testing import assert_, assert_equal, assert_array_equal, assert_raises, assert_warns, HAS_REFCOUNT
label_desc: Use image node_id 9 for calling a global function with example usage: test_string_to_complex_cast(str_type, scalar_type) without return types