code: def test_generic_enumerate_support(case, expand):
      raw_dist = case.get_dist()
  
      dim_to_name, name_to_dim = _default_dim_to_name(
          raw_dist.batch_shape
      )
      with eager_no_dists:
          with xfail_if_not_implemented(match="try upgrading backend"):
              funsor_dist = to_funsor(
                  raw_dist, output=funsor.Real, dim_to_name=dim_to_name
              )
  
      assert getattr(
          raw_dist, "has_enumerate_support", False
      ) == getattr(funsor_dist, "has_enumerate_support", False)
      if getattr(funsor_dist, "has_enumerate_support", False):
          name_to_dim["value"] = (
              -1 if not name_to_dim else min(name_to_dim.values()) - 1
          )
          with xfail_if_not_implemented(
              "enumerate support not implemented"
          ):
              raw_support = raw_dist.enumerate_support(expand=expand)
              funsor_support = funsor_dist.enumerate_support(
                  expand=expand
              )
              assert_close(
                  to_data(funsor_support, name_to_dim=name_to_dim),
                  raw_support,
              )
  
imports: import re
  from collections import OrderedDict, namedtuple
  from importlib import import_module
  import numpy
  import pytest
  import funsor
  import funsor.ops
  from funsor.distribution import BACKEND_TO_DISTRIBUTIONS_BACKEND
  from funsor.interpretations import CallableInterpretation, eager, lazy, normalize, reflect
  from funsor.terms import to_data, to_funsor
  from funsor.testing import assert_close, check_funsor, excludes_backend, rand, randint, randn, random_scale_tril, xfail_if_not_found, xfail_if_not_implemented, xfail_param
  from funsor.util import get_backend
label_desc: Use image node_id 5 for calling a global function with example usage: test_generic_enumerate_support(case, expand) without return types