code: def test_natural_spline():
      xt = F.Term("x")
  
      ns = F.natural_spline(xt, knots=[2, 6, 9])
      xx = F.make_recarray(np.linspace(0, 10, 101), "x")
      dd = ns.design(xx, return_float=True)
      xx = xx["x"]
      assert_almost_equal(dd[:, 0], xx)
      assert_almost_equal(dd[:, 1], xx**2)
      assert_almost_equal(dd[:, 2], xx**3)
      assert_almost_equal(
          dd[:, 3], (xx - 2) ** 3 * np.greater_equal(xx, 2)
      )
      assert_almost_equal(
          dd[:, 4], (xx - 6) ** 3 * np.greater_equal(xx, 6)
      )
      assert_almost_equal(
          dd[:, 5], (xx - 9) ** 3 * np.greater_equal(xx, 9)
      )
  
      ns = F.natural_spline(xt, knots=[2, 9, 6], intercept=True)
      xx = F.make_recarray(np.linspace(0, 10, 101), "x")
      dd = ns.design(xx, return_float=True)
      xx = xx["x"]
      assert_almost_equal(dd[:, 0], 1)
      assert_almost_equal(dd[:, 1], xx)
      assert_almost_equal(dd[:, 2], xx**2)
      assert_almost_equal(dd[:, 3], xx**3)
      assert_almost_equal(
          dd[:, 4], (xx - 2) ** 3 * np.greater_equal(xx, 2)
      )
      assert_almost_equal(
          dd[:, 5], (xx - 9) ** 3 * np.greater_equal(xx, 9)
      )
      assert_almost_equal(
          dd[:, 6], (xx - 6) ** 3 * np.greater_equal(xx, 6)
      )
  
imports: from warnings import catch_warnings, simplefilter
  import numpy
  import pytest
  import sympy
  from numpy.core.records import fromrecords
  from numpy.testing import assert_almost_equal, assert_array_equal
  from sympy.utilities.lambdify import implemented_function
  from nipy.utils import VisibleDeprecationWarning
  from ..None import formulae
  from ..formulae import Term, terms
label_desc: Use image node_id 29 for calling a global function with example usage: test_natural_spline() without return types