code: def test_variance(stability, scale):
      skew = dist.Uniform(-1, 1).sample((10,))
      loc = torch.randn(10)
      d = dist.Stable(stability, skew, scale, loc)
      if stability < 2:
          assert torch.isinf(d.variance).all()
      else:
          expected = d.sample((100000,)).var(0)
          assert_close(d.variance, expected, rtol=0.02)
  
file_path: pyro/tests/distributions/test_stable.py
imports: import warnings
  import pytest
  import torch
  from scipy.integrate.quadpack import IntegrationWarning
  from scipy.stats import ks_2samp, kstest, levy_stable
  import pyro.distributions
  import pyro.distributions.stable
  from tests.common import assert_close
label_desc: Use image node_id 7 for calling a global function with example usage: test_variance(stability, scale) without return types