code: def test_scalar_strict(self):
      def f(var, val):
          var.set_value(val)
  
      b = shared(np.int64(7), strict=True)
      assert b.type == lscalar
      with pytest.raises(TypeError):
          f(b, 8.23)
  
      b = shared(np.int32(7), strict=True)
      assert b.type == iscalar
      with pytest.raises(TypeError):
          f(b, 8.23)
  
      b = shared(np.int16(7), strict=True)
      assert b.type == wscalar
      with pytest.raises(TypeError):
          f(b, 8.23)
  
      b = shared(np.int8(7), strict=True)
      assert b.type == bscalar
      with pytest.raises(TypeError):
          f(b, 8.23)
  
      b = shared(np.float64(7.234), strict=True)
      assert b.type == dscalar
      with pytest.raises(TypeError):
          f(b, 8)
  
      b = shared(np.float32(7.234), strict=True)
      assert b.type == fscalar
      with pytest.raises(TypeError):
          f(b, 8)
  
      b = shared(7.234, strict=True)
      assert b.type == dscalar
      with pytest.raises(TypeError):
          f(b, 8)
  
      b = shared(7.234, strict=True)
      assert b.type == dscalar
      with pytest.raises(TypeError):
          f(b, 8)
  
      b = shared(np.zeros((5, 5), dtype="float32"))
      with pytest.raises(TypeError):
          f(b, np.random.random((5, 5)))
  
file_path: pytensor/tests/compile/test_shared.py
imports: import numpy
  import pytest
  import pytensor.tensor
  from pytensor.compile.sharedvalue import SharedVariable, shared
  from pytensor.configdefaults import config
  from pytensor.link.c.type import generic
  from pytensor.misc.safe_asarray import _asarray
  from pytensor.tensor.type import TensorType, bscalar, bvector, dscalar, dvector, fscalar, fvector, iscalar, ivector, lscalar, lvector, wscalar, wvector
  from pytensor.utils import PYTHON_INT_BITWIDTH
label_desc: Use image node_id 5 for calling the TestSharedVariable obj's underlying member method code with example usage: obj.test_scalar_strict() without return types