code: def check_pdf_logpdf_at_endpoints(distfn, args, msg):
      # compares pdf with the log of the pdf at the (finite) end points
      points = np.array([0, 1])
      vals = distfn.ppf(points, *args)
      vals = vals[np.isfinite(vals)]
      with npt.suppress_warnings() as sup:
          # Several distributions incur divide by zero or encounter invalid values when computing
          # the pdf or logpdf at the endpoints.
          suppress_messsages = [
              "divide by zero encountered in true_divide",  # multiple distributions
              "divide by zero encountered in log",  # multiple distributions
              "divide by zero encountered in power",  # gengamma
              "invalid value encountered in add",  # genextreme
              "invalid value encountered in subtract",  # gengamma
              "invalid value encountered in multiply",  # recipinvgauss
          ]
          for msg in suppress_messsages:
              sup.filter(category=RuntimeWarning, message=msg)
  
          pdf = distfn.pdf(vals, *args)
          logpdf = distfn.logpdf(vals, *args)
          pdf = pdf[(pdf != 0) & np.isfinite(pdf)]
          logpdf = logpdf[np.isfinite(logpdf)]
          msg += " - logpdf-log(pdf) relationship"
          npt.assert_almost_equal(
              np.log(pdf), logpdf, decimal=7, err_msg=msg
          )
  
imports: import numpy
  import numpy.testing
  import pytest
  from pytest import raises
  from scipy.integrate import IntegrationWarning
  from scipy import stats
  from scipy.special import betainc
  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_entropy_vect_scale, check_edge_support, check_named_args, check_random_state_property, check_meth_dtype, check_ppf_dtype, check_cmplx_deriv, check_pickling, check_rvs_broadcast, check_freezing
  from scipy.stats._distr_params import distcont
label_desc: Use image node_id 22 for calling a global function with example usage: check_pdf_logpdf_at_endpoints(distfn, args, msg) without return types