code: def test_bs_errors():
      import pytest
  
      x = np.linspace(-10, 10, 20)
      # error checks:
      # out of bounds
      pytest.raises(NotImplementedError, bs, x, 3, lower_bound=0)
      pytest.raises(NotImplementedError, bs, x, 3, upper_bound=0)
      # must specify df or knots
      pytest.raises(ValueError, bs, x)
      # df/knots match/mismatch (with and without intercept)
      #   match:
      bs(x, df=10, include_intercept=False, knots=[0] * 7)
      bs(x, df=10, include_intercept=True, knots=[0] * 6)
      bs(x, df=10, include_intercept=False, knots=[0] * 9, degree=1)
      bs(x, df=10, include_intercept=True, knots=[0] * 8, degree=1)
      #   too many knots:
      pytest.raises(
          ValueError,
          bs,
          x,
          df=10,
          include_intercept=False,
          knots=[0] * 8,
      )
      pytest.raises(
          ValueError,
          bs,
          x,
          df=10,
          include_intercept=True,
          knots=[0] * 7,
      )
      pytest.raises(
          ValueError,
          bs,
          x,
          df=10,
          include_intercept=False,
          knots=[0] * 10,
          degree=1,
      )
      pytest.raises(
          ValueError,
          bs,
          x,
          df=10,
          include_intercept=True,
          knots=[0] * 9,
          degree=1,
      )
      #   too few knots:
      pytest.raises(
          ValueError,
          bs,
          x,
          df=10,
          include_intercept=False,
          knots=[0] * 6,
      )
      pytest.raises(
          ValueError,
          bs,
          x,
          df=10,
          include_intercept=True,
          knots=[0] * 5,
      )
      pytest.raises(
          ValueError,
          bs,
          x,
          df=10,
          include_intercept=False,
          knots=[0] * 8,
          degree=1,
      )
      pytest.raises(
          ValueError,
          bs,
          x,
          df=10,
          include_intercept=True,
          knots=[0] * 7,
          degree=1,
      )
      # df too small
      pytest.raises(ValueError, bs, x, df=1, degree=3)
      pytest.raises(ValueError, bs, x, df=3, degree=5)
      # bad degree
      pytest.raises(ValueError, bs, x, df=10, degree=-1)
      pytest.raises(ValueError, bs, x, df=10, degree=1.5)
      # upper_bound < lower_bound
      pytest.raises(ValueError, bs, x, 3, lower_bound=1, upper_bound=-1)
      # multidimensional input
      pytest.raises(ValueError, bs, np.column_stack((x, x)), 3)
      # unsorted knots are okay, and get sorted
      assert np.array_equal(bs(x, knots=[1, 4]), bs(x, knots=[4, 1]))
      # 2d knots
      pytest.raises(ValueError, bs, x, knots=[[0], [20]])
      # knots > upper_bound
      pytest.raises(ValueError, bs, x, knots=[0, 20])
      pytest.raises(ValueError, bs, x, knots=[0, 4], upper_bound=3)
      # knots < lower_bound
      pytest.raises(ValueError, bs, x, knots=[-20, 0])
      pytest.raises(ValueError, bs, x, knots=[-4, 0], lower_bound=-3)
  
file_path: patsy/patsy/splines.py
imports: import numpy
  from patsy.util import have_pandas, no_pickling, assert_no_pickling
  from patsy.state import stateful_transform
label_desc: Use image node_id 6 for calling a global function with example usage: test_bs_errors() without return types