code: def test_exception(self):
      with pytest.raises(TypeError) as errinfo:
          spatial_gradient(1)
      assert "Not a Tensor type" in str(errinfo)
  
      with pytest.raises(TypeError) as errinfo:
          spatial_gradient(torch.zeros(1))
      assert "shape must be [['B', 'C', 'H', 'W']]" in str(errinfo)
  
imports: import pytest
  import torch
  from kornia.filters import Sobel, SpatialGradient, SpatialGradient3d, sobel, spatial_gradient, spatial_gradient3d
  from kornia.testing import BaseTester, tensor_to_gradcheck_var
label_desc: Use image node_id 3 for calling the TestSpatialGradient obj's underlying member method code with example usage: obj.test_exception() without return types