code: def test_tensor_values_eq_approx():
      # test, inf, -inf and nan equal themselves
      a = np.asarray([-np.inf, -1, 0, 1, np.inf, np.nan])
      with pytest.warns(RuntimeWarning):
          assert TensorType.values_eq_approx(a, a)
  
      # test inf, -inf don't equal themselves
      b = np.asarray([np.inf, -1, 0, 1, np.inf, np.nan])
      with pytest.warns(RuntimeWarning):
          assert not TensorType.values_eq_approx(a, b)
      b = np.asarray([-np.inf, -1, 0, 1, -np.inf, np.nan])
      with pytest.warns(RuntimeWarning):
          assert not TensorType.values_eq_approx(a, b)
  
      # test allow_remove_inf
      b = np.asarray([np.inf, -1, 0, 1, 5, np.nan])
      assert TensorType.values_eq_approx(a, b, allow_remove_inf=True)
      b = np.asarray([np.inf, -1, 0, 1, 5, 6])
      assert not TensorType.values_eq_approx(
          a, b, allow_remove_inf=True
      )
  
      # test allow_remove_nan
      b = np.asarray([np.inf, -1, 0, 1, 5, np.nan])
      assert not TensorType.values_eq_approx(
          a, b, allow_remove_nan=False
      )
      b = np.asarray([-np.inf, -1, 0, 1, np.inf, 6])
      with pytest.warns(RuntimeWarning):
          assert not TensorType.values_eq_approx(
              a, b, allow_remove_nan=False
          )
  
imports: import os.path
  from tempfile import mkdtemp
  import numpy
  import pytest
  import pytensor.tensor
  from pytensor.configdefaults import config
  from pytensor.tensor.shape import SpecifyShape
  from pytensor.tensor.type import TensorType, col, matrix, row, scalar, tensor, tensor3, tensor4, tensor5, tensor6, tensor7, vector
label_desc: Use image node_id 12 for calling a global function with example usage: test_tensor_values_eq_approx() without return types