code: def test_affine_subs(expr, expected_type, expected_inputs):
      expected_output = Real
  
      t = Tensor(
          randn(2, 3), OrderedDict([("i", Bint[2]), ("j", Bint[3])])
      )
      assert isinstance(t, Tensor)
  
      n = Number(2.0)
      assert isinstance(n, Number)
  
      x = Variable("x", Real)
      assert isinstance(x, Variable)
  
      y = Variable("y", Real)
      assert isinstance(y, Variable)
  
      z = Variable("z", Real)
      assert isinstance(z, Variable)
  
      result = eval(expr)
      assert isinstance(result, expected_type)
      check_funsor(result, expected_inputs, expected_output)
      assert is_affine(result)
  
file_path: funsor/test/test_affine.py
imports: from collections import OrderedDict
  import pytest
  from funsor.affine import extract_affine, is_affine
  from funsor.cnf import Contraction
  from funsor.domains import Bint, Real, Reals
  from funsor.tensor import Einsum, Tensor
  from funsor.terms import Finitary, Number, Unary, Variable
  from funsor.testing import assert_close, check_funsor, ones, randn, random_gaussian, random_tensor
label_desc: Use image node_id 2 for calling a global function with example usage: test_affine_subs(expr, expected_type, expected_inputs) without return types