#NEWLINE# def test_general( self ) : #NEWLINE# #INDENT# x = np . array ( [ ( - 1 ) , 0 , 0.5 , 2 , 4 , 4.5 , 5.5 , 9 ] ) #NEWLINE# y = np . array ( [ 0 , ( - 0.5 ) , 2 , 3 , 2.5 , 1 , 1 , 0.5 ] ) #NEWLINE# x_test = np . array ( [ ( - 0.5 ) , 0.1 , 1 , 3 , 4.1 , 5 , 7 ] ) #NEWLINE# y_true = np . array ( [ ( - 2.111801336869092 ) , 0.01967703528896 , 3.164826064645384 , 3.384966086626085 , 2.210195906837064 , 0.464510284120531 , 4.956649059572205 ] ) #NEWLINE# cs = CubicSpline ( x , y ) #NEWLINE# assert_allclose ( cs ( x_test ) , y_true , rtol = 1e-12 ) #NEWLINE# Y = np . vstack ( ( y , y ) ) . T #NEWLINE# cs = CubicSpline ( x , Y ) #NEWLINE# Y_true = np . vstack ( ( y_true , y_true ) ) . T #NEWLINE# assert_allclose ( cs ( x_test ) , Y_true , rtol = 1e-12 ) #NEWLINE# Y = np . vstack ( ( y , y ) ) #NEWLINE# cs = CubicSpline ( x , Y , axis = 1 ) #NEWLINE# Y_true = np . vstack ( ( y_true , y_true ) ) #NEWLINE# assert_allclose ( cs ( x_test ) , Y_true , rtol = 1e-12 ) #NEWLINE# Y = np . empty ( ( 2 , 2 , 8 ) ) #NEWLINE# Y [ 0 , 0 , : ] = y #NEWLINE# Y [ 0 , 1 , : ] = y #NEWLINE# Y [ 1 , 0 , : ] = y #NEWLINE# Y [ 1 , 1 , : ] = y #NEWLINE# cs = CubicSpline ( x , Y , axis = ( - 1 ) ) #NEWLINE# Y_true = np . empty ( ( 2 , 2 , 7 ) ) #NEWLINE# Y_true [ 0 , 0 , : ] = cs #NEWLINE# Y_true [ 0 , 1 , : ] = y_true #NEWLINE# Y_true [ 1 , 0 , : ] = y_true #NEWLINE# Y_true [ 1 , 1 , : ] = y_true #NEWLINE# assert_allclose ( cs ( x_test ) , Y_true , rtol = 1e-12 )