code: def test_mcmc_model_side_enumeration(model, temperature):
      # Perform fake inference.
      # Draw from prior rather than trying to sample from mcmc posterior.
      # This has the wrong distribution but the right type for tests.
      mcmc_trace = handlers.trace(
          handlers.block(
              handlers.enum(infer.config_enumerate(model)),
              expose=["loc", "scale"],
          )
      ).get_trace()
      mcmc_data = {
          name: site["value"]
          for name, site in mcmc_trace.nodes.items()
          if site["type"] == "sample"
      }
  
      # MAP estimate discretes, conditioned on posterior sampled continous latents.
      actual_trace = handlers.trace(
          infer.infer_discrete(
              # TODO support replayed sites in infer_discrete.
              # handlers.replay(infer.config_enumerate(model), mcmc_trace),
              handlers.condition(
                  infer.config_enumerate(model), mcmc_data
              ),
              temperature=temperature,
          ),
      ).get_trace()
  
      # Check site names and shapes.
      expected_trace = handlers.trace(model).get_trace()
      assert set(actual_trace.nodes) == set(expected_trace.nodes)
      assert (
          "z1"
          not in actual_trace.nodes["scale"]["funsor"]["value"].inputs
      )
  
file_path: pyro/tests/contrib/funsor/test_infer_discrete.py
imports: import logging
  import os
  import pyroapi
  import pytest
  import torch
  from pyro.infer.autoguide import AutoNormal
  from tests.common import assert_equal
label_desc: Use image node_id 9 for calling a global function with example usage: test_mcmc_model_side_enumeration(model, temperature) without return types