code: def test_crs_errors():
      import pytest
  
      # Invalid 'x' shape
      pytest.raises(ValueError, cr, np.arange(16).reshape((4, 4)), df=4)
      pytest.raises(
          ValueError,
          CR().transform,
          np.arange(16).reshape((4, 4)),
          df=4,
      )
      # Should provide at least 'df' or 'knots'
      pytest.raises(ValueError, cr, np.arange(50))
      # Invalid constraints shape
      pytest.raises(
          ValueError,
          cr,
          np.arange(50),
          df=4,
          constraints=np.arange(27).reshape((3, 3, 3)),
      )
      # Invalid nb of columns in constraints
      # (should have df + 1 = 5, but 6 provided)
      pytest.raises(
          ValueError, cr, np.arange(50), df=4, constraints=np.arange(6)
      )
      # Too small 'df' for natural cubic spline
      pytest.raises(ValueError, cr, np.arange(50), df=1)
      # Too small 'df' for cyclic cubic spline
      pytest.raises(ValueError, cc, np.arange(50), df=0)
  
imports: import numpy
  from patsy.util import have_pandas, atleast_2d_column_default, no_pickling, assert_no_pickling, safe_string_eq
  from patsy.state import stateful_transform
label_desc: Use image node_id 18 for calling a global function with example usage: test_crs_errors() without return types