code: def test_string_to_boolean_cast(dtype, out_dtype):
      # Only the last two (empty) strings are falsy (the `\0` is stripped):
      arr = np.array(
          ["10", "10\0\0\0", "0\0\0", "0", "False", " ", "", "\0"],
          dtype=dtype,
      )
      expected = np.array(
          [True, True, True, True, True, True, False, False],
          dtype=out_dtype,
      )
      assert_array_equal(arr.astype(out_dtype), expected)
      # As it's similar, check that nonzero behaves the same (structs are
      # nonzero if all entries are)
      assert_array_equal(np.nonzero(arr), np.nonzero(expected))
  
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 8 for calling a global function with example usage: test_string_to_boolean_cast(dtype, out_dtype) without return types