code: def test_python_scalar_construtors():
      b = asarray(False)
      i = asarray(0)
      f = asarray(0.0)
  
      assert bool(b) == False
      assert int(i) == 0
      assert float(f) == 0.0
      assert operator.index(i) == 0
  
      # bool/int/float should only be allowed on 0-D arrays.
      assert_raises(TypeError, lambda: bool(asarray([False])))
      assert_raises(TypeError, lambda: int(asarray([0])))
      assert_raises(TypeError, lambda: float(asarray([0.0])))
      assert_raises(TypeError, lambda: operator.index(asarray([0])))
  
      # bool/int/float should only be allowed on arrays of the corresponding
      # dtype
      assert_raises(ValueError, lambda: bool(i))
      assert_raises(ValueError, lambda: bool(f))
  
      assert_raises(ValueError, lambda: int(b))
      assert_raises(ValueError, lambda: int(f))
  
      assert_raises(ValueError, lambda: float(b))
      assert_raises(ValueError, lambda: float(i))
  
      assert_raises(TypeError, lambda: operator.index(b))
      assert_raises(TypeError, lambda: operator.index(f))
  
file_path: cupy/tests/cupy_tests/array_api_tests/test_array_object.py
imports: import operator
  from numpy.testing import assert_raises
  import cupy
  import pytest
  from cupy.array_api import ones, asarray, reshape, result_type, all, equal
  from cupy.array_api._dtypes import _all_dtypes, _boolean_dtypes, _floating_dtypes, _integer_dtypes, _integer_or_boolean_dtypes, _numeric_dtypes, int8, int16, int32, int64, uint64, bool
  from cupy.array_api._array_object import Array
label_desc: Use image node_id 3 for calling a global function with example usage: test_python_scalar_construtors() without return types