code: def check(self):
      np.random.seed(1234)
  
      # Generate values for the arguments
      argarr = get_args(self.arg_spec, self.n)
  
      # Check
      old_dps, old_prec = mpmath.mp.dps, mpmath.mp.prec
      try:
          if self.dps is not None:
              dps_list = [self.dps]
          else:
              dps_list = [20]
          if self.prec is not None:
              mpmath.mp.prec = self.prec
  
          # Proper casting of mpmath input and output types. Using
          # native mpmath types as inputs gives improved precision
          # in some cases.
          if np.issubdtype(argarr.dtype, np.complexfloating):
              pytype = mpc2complex
  
              def mptype(x):
                  return mpmath.mpc(complex(x))
  
          else:
  
              def mptype(x):
                  return mpmath.mpf(float(x))
  
              def pytype(x):
                  if abs(x.imag) > 1e-16 * (1 + abs(x.real)):
                      return np.nan
                  else:
                      return mpf2float(x.real)
  
          # Try out different dps until one (or none) works
          for j, dps in enumerate(dps_list):
              mpmath.mp.dps = dps
  
              try:
                  assert_func_equal(
                      self.scipy_func,
                      lambda *a: pytype(
                          self.mpmath_func(*map(mptype, a))
                      ),
                      argarr,
                      vectorized=False,
                      rtol=self.rtol,
                      atol=self.atol,
                      ignore_inf_sign=self.ignore_inf_sign,
                      distinguish_nan_and_inf=self.distinguish_nan_and_inf,
                      nan_ok=self.nan_ok,
                      param_filter=self.param_filter,
                  )
                  break
              except AssertionError:
                  if j >= len(dps_list) - 1:
                      # reraise the Exception
                      tp, value, tb = sys.exc_info()
                      if value.__traceback__ is not tb:
                          raise value.with_traceback(tb)
                      raise value
      finally:
          mpmath.mp.dps, mpmath.mp.prec = old_dps, old_prec
  
imports: import os
  import sys
  import time
  import numpy
  from numpy.testing import assert_
  import pytest
  from scipy.special._testutils import assert_func_equal
label_desc: Use image node_id 2 for calling the MpmathData obj's underlying member method code with example usage: obj.check() and returns: mpmath, mpmath, np, mpf2float