code: def check_cdf_ppf(distfn, arg, supp, msg):
      # supp is assumed to be an array of integers in the support of distfn
      # (but not necessarily all the integers in the support).
      # This test assumes that the PMF of any value in the support of the
      # distribution is greater than 1e-8.
  
      # cdf is a step function, and ppf(q) = min{k : cdf(k) >= q, k integer}
      cdf_supp = distfn.cdf(supp, *arg)
      # In very rare cases, the finite precision calculation of ppf(cdf(supp))
      # can produce an array in which an element is off by one.  We nudge the
      # CDF values down by 15 ULPs help to avoid this.
      cdf_supp0 = cdf_supp - 15 * np.spacing(cdf_supp)
      npt.assert_array_equal(
          distfn.ppf(cdf_supp0, *arg), supp, msg + "-roundtrip"
      )
      # Repeat the same calculation, but with the CDF values decreased by 1e-8.
      npt.assert_array_equal(
          distfn.ppf(distfn.cdf(supp, *arg) - 1e-8, *arg),
          supp,
          msg + "-roundtrip",
      )
  
      if not hasattr(distfn, "xk"):
          _a, _b = distfn.support(*arg)
          supp1 = supp[supp < _b]
          npt.assert_array_equal(
              distfn.ppf(distfn.cdf(supp1, *arg) + 1e-8, *arg),
              supp1 + distfn.inc,
              msg + " ppf-cdf-next",
          )
  
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 7 for calling a global function with example usage: check_cdf_ppf(distfn, arg, supp, msg) without return types