docstr: Test that design_matrix(x) is equivalent to BSpline(..)(x).
docstr_tok: ["Test","that","design_matrix","(","x",")","is","equivalent","to","BSpline","(","..",")","(","x",")","."]
code: def test_design_matrix_same_as_BSpline_call(self, xp, scp):
      """Test that design_matrix(x) is equivalent to BSpline(..)(x)."""
      ret = []
  
      has_extrapolate = True
      for mod in [cupyx.scipy.interpolate, interpolate]:
          sig = inspect.signature(mod.BSpline.design_matrix)
          has_extrapolate = has_extrapolate and (
              "extrapolate" in sig.parameters
          )
  
      kwargs = {}
      if has_extrapolate:
          kwargs = {"extrapolate": self.extrapolate}
  
      for k in range(0, 5):
          x = testing.shaped_random(
              (10 * (k + 1),), xp, scale=1, seed=1234
          )
          xmin, xmax = xp.amin(x), xp.amax(x)
  
          t = xp.r_[
              xp.linspace(xmin - 2, xmin - 1, k),
              xp.linspace(xmin, xmax, 2 * (k + 1)),
              xp.linspace(xmax + 1, xmax + 2, k),
          ]
          c = xp.eye(len(t) - k - 1)
          bspline = scp.interpolate.BSpline(t, c, k, self.extrapolate)
          ret.append(bspline(x))
          ret.append(
              scp.interpolate.BSpline.design_matrix(
                  x, t, k, **kwargs
              ).todense()
          )
  
          # extrapolation regime
          if has_extrapolate:
              x = xp.array([xmin - 10, xmin - 1, xmax + 1.5, xmax + 10])
              if not self.extrapolate:
                  with pytest.raises(ValueError):
                      scp.interpolate.BSpline.design_matrix(
                          x, t, k, self.extrapolate
                      )
              else:
                  ret.append(bspline(x))
                  ret.append(
                      scp.interpolate.BSpline.design_matrix(
                          x, t, k, self.extrapolate
                      ).todense()
                  )
  
      return ret
  
imports: import pytest
  import inspect
  from cupy import testing
  from cupy_backends.cuda.api import driver
  from cupy_backends.cuda.api import runtime
  import numpy
  import cupyx.scipy.interpolate
label_desc: Use image node_id 29 for calling the TestBSpline obj's underlying member method code with example usage: obj.test_design_matrix_same_as_BSpline_call(xp, scp) and returns: ret