code: def assert_warning(model, guide, elbo):
      """
      Assert that inference works but with a warning.
      """
      inference = build_svi(model, guide, elbo)
      with warnings.catch_warnings(record=True) as w:
          warnings.simplefilter("always")
          inference.step()
          assert len(w), "No warnings were raised"
          for warning in w:
              print(warning)
  
imports: import warnings
  import pytest
  import torch
  from pytest import approx
  from torch.distributions import constraints
  from pyro.generic import distributions
  from pyro.generic import infer, ops, optim, pyro, pyro_backend
  from tests.common import assert_close, xfail_param
label_desc: Use image node_id 4 for calling a global function with example usage: assert_warning(model, guide, elbo) without return types