code: def test_discrete_basic(distname, arg, first_case):
      try:
          distfn = getattr(stats, distname)
      except TypeError:
          distfn = distname
          distname = "sample distribution"
      np.random.seed(9765456)
      rvs = distfn.rvs(size=2000, *arg)
      supp = np.unique(rvs)
      m, v = distfn.stats(*arg)
      check_cdf_ppf(distfn, arg, supp, distname + " cdf_ppf")
  
      check_pmf_cdf(distfn, arg, distname)
      check_oth(distfn, arg, supp, distname + " oth")
      check_edge_support(distfn, arg)
  
      alpha = 0.01
      check_discrete_chisquare(
          distfn, arg, rvs, alpha, distname + " chisquare"
      )
  
      if first_case:
          locscale_defaults = (0,)
          meths = [
              distfn.pmf,
              distfn.logpmf,
              distfn.cdf,
              distfn.logcdf,
              distfn.logsf,
          ]
          # make sure arguments are within support
          # for some distributions, this needs to be overridden
          spec_k = {
              "randint": 11,
              "hypergeom": 4,
              "bernoulli": 0,
              "nchypergeom_wallenius": 6,
          }
          k = spec_k.get(distname, 1)
          check_named_args(distfn, k, arg, locscale_defaults, meths)
          if distname != "sample distribution":
              check_scale_docstring(distfn)
          check_random_state_property(distfn, arg)
          check_pickling(distfn, arg)
          check_freezing(distfn, arg)
  
          # Entropy
          check_entropy(distfn, arg, distname)
          if distfn.__class__._entropy != stats.rv_discrete._entropy:
              check_private_entropy(distfn, arg, stats.rv_discrete)
  
imports: import numpy.testing
  from numpy.testing import assert_allclose
  import numpy
  import pytest
  from scipy import stats
  from .common_tests import check_normalization, check_moment, check_mean_expect, check_var_expect, check_skew_expect, check_kurt_expect, check_entropy, check_private_entropy, check_edge_support, check_named_args, check_random_state_property, check_pickling, check_rvs_broadcast, check_freezing
  from scipy.stats._distr_params import distdiscrete, invdistdiscrete
  from scipy.stats._distn_infrastructure import rv_discrete_frozen
label_desc: Use image node_id 2 for calling a global function with example usage: test_discrete_basic(distname, arg, first_case) without return types