@@ -65,6 +65,8 @@ def test_polynomial_features():
6565 X_poly = interact .fit_transform (X )
6666 assert_array_almost_equal (X_poly , P2 [:, [0 , 1 , 2 , 4 ]])
6767
68+ assert_raises (ValueError , interact .transform , X [:, 1 :])
69+
6870
6971def test_scaler_1d ():
7072 """Test scaling of dataset along single axis"""
@@ -92,6 +94,9 @@ def test_scaler_1d():
9294 assert_array_almost_equal (X_scaled .mean (axis = 0 ), 0.0 )
9395 assert_array_almost_equal (X_scaled .std (axis = 0 ), 1.0 )
9496
97+ X = np .ones (5 )
98+ assert_array_equal (scale (X , with_mean = False ), X )
99+
95100
96101def test_scaler_2d_arrays ():
97102 """Test scaling of 2d array along first axis"""
@@ -511,8 +516,12 @@ def test_normalizer_l2():
511516 assert_almost_equal (la .norm (X_norm [3 ]), 0.0 )
512517
513518
514- def test_normalize_errors ():
515- """Check that invalid arguments yield ValueError"""
519+ def test_normalize ():
520+ """Test normalize function"""
521+ # Only tests functionality not used by the tests for Normalizer.
522+ X = np .random .RandomState (37 ).randn (3 , 2 )
523+ assert_array_equal (normalize (X , copy = False ),
524+ normalize (X .T , axis = 0 , copy = False ).T )
516525 assert_raises (ValueError , normalize , [[0 ]], axis = 2 )
517526 assert_raises (ValueError , normalize , [[0 ]], norm = 'l3' )
518527
0 commit comments