code: def test_cast_scalar_invalid(device, shape):
      dtype = chainerx.float32
  
      a = chainerx.ones(shape, dtype)
      with pytest.raises(chainerx.DimensionError):
          float(a)
  
      a = chainerx.ones(shape, dtype)
      with pytest.raises(chainerx.DimensionError):
          int(a)
  
      a = chainerx.ones(shape, dtype)
      with pytest.raises(chainerx.DimensionError):
          bool(a)
  
      a = chainerx.ones(shape, dtype)
      with pytest.raises(chainerx.DimensionError):
          a.item()
  
imports: import copy
  import math
  import pickle
  import numpy
  import pytest
  import chainerx
  import chainerx.testing
  from chainerx_tests import array_utils
label_desc: Use image node_id 5 for calling a global function with example usage: test_cast_scalar_invalid(device, shape) without return types