code: def test_binary(self, method, exp_type):
      x = pt.lmatrix("x")
      y = pt.lmatrix("y")
      x = sparse.csr_from_dense(x)
      y = sparse.csr_from_dense(y)
  
      method_to_call = getattr(x, method)
  
      if exp_type == SparseTensorType:
          exp_res_type = csr_matrix
          cm = ExitStack()
      else:
          exp_res_type = np.ndarray
          cm = pytest.warns(UserWarning, match=".*converted to dense.*")
  
      with cm:
          z = method_to_call(y)
  
      if not isinstance(z, tuple):
          z_outs = (z,)
      else:
          z_outs = z
  
      assert all(isinstance(out.type, exp_type) for out in z_outs)
  
      f = pytensor.function([x, y], z)
      res = f(
          [[1, 0, 2], [-1, 0, 0]],
          [[1, 1, 2], [1, 4, 1]],
      )
  
      if not isinstance(res, list):
          res_outs = [res]
      else:
          res_outs = res
  
      assert all(isinstance(out, exp_res_type) for out in res_outs)
  
file_path: pytensor/tests/sparse/test_var.py
imports: from contextlib import ExitStack
  import numpy
  import pytest
  from scipy.sparse.csr import csr_matrix
  import pytensor
  import pytensor.sparse
  import pytensor.tensor
  from pytensor.sparse.type import SparseTensorType
  from pytensor.tensor.type import DenseTensorType
label_desc: Use image node_id 2 for calling the TestSparseVariable obj's underlying member method code with example usage: obj.test_binary(method, exp_type) without return types