code: def test_subsequent_expands_ok(dist, sample_shapes, default):
      for idx in range(dist.get_num_test_data()):
          d = dist.pyro_dist(**dist.get_dist_params(idx))
          original_batch_shape = d.batch_shape
          for shape in sample_shapes:
              proposed_batch_shape = (
                  torch.Size(shape) + original_batch_shape
              )
              if default:
                  n = TorchDistribution.expand(d, proposed_batch_shape)
              else:
                  with xfail_if_not_implemented():
                      n = d.expand(proposed_batch_shape)
              assert n.batch_shape == proposed_batch_shape
              with xfail_if_not_implemented():
                  check_sample_shapes(d, n)
              d = n
  
imports: import numpy
  import pytest
  import torch
  import pyro
  import pyro.distributions
  from pyro.distributions import TorchDistribution
  from pyro.distributions.testing.gof import auto_goodness_of_fit
  from pyro.distributions.util import broadcast_shape
  from tests.common import TEST_FAILURE_RATE, assert_close, assert_equal, xfail_if_not_implemented
label_desc: Use image node_id 22 for calling a global function with example usage: test_subsequent_expands_ok(dist, sample_shapes, default) without return types