code: def test_strict_checks(self, xp, dtype, shape):
      # Check that `_strict_check` behaves as expected
      dtype = getattr(xp, dtype)
      x = xp.broadcast_to(xp.asarray(1, dtype=dtype), shape)
      x = x if shape else x[()]
      y = np_compat.asarray(1)[()]
  
      options = dict(
          check_namespace=True, check_dtype=False, check_shape=False
      )
      if xp == np:
          xp_assert_equal(x, y, **options)
      else:
          with pytest.raises(
              AssertionError, match="Namespaces do not match."
          ):
              xp_assert_equal(x, y, **options)
  
      options = dict(
          check_namespace=False, check_dtype=True, check_shape=False
      )
      if y.dtype.name in str(x.dtype):
          xp_assert_equal(x, y, **options)
      else:
          with pytest.raises(
              AssertionError, match="dtypes do not match."
          ):
              xp_assert_equal(x, y, **options)
  
      options = dict(
          check_namespace=False, check_dtype=False, check_shape=True
      )
      if x.shape == y.shape:
          xp_assert_equal(x, y, **options)
      else:
          with pytest.raises(
              AssertionError, match="Shapes do not match."
          ):
              xp_assert_equal(x, y, **options)
  
file_path: scipy/scipy/_lib/tests/test_array_api.py
imports: import numpy
  import pytest
  from scipy.conftest import array_api_compatible
  from scipy._lib._array_api import _GLOBAL_CONFIG, array_namespace, as_xparray, copy, xp_assert_equal, is_numpy
  import scipy._lib.array_api_compat.numpy
label_desc: Use image node_id 6 for calling the TestArrayAPI obj's underlying member method code with example usage: obj.test_strict_checks(xp, dtype, shape) without return types