import numpy as np
import scipy.sparse as sp
from numpy.testing import assert_array_almost_equal

from sklearn.datasets import make_classification
from sklearn.utils.sparsefuncs import mean_variance_axis0


def test_mean_variance_axis0():
    X, _ = make_classification(5, 4, random_state=0)
    # Sparsify the array a little bit
    X[0, 0] = 0
    X[2, 1] = 0
    X[4, 3] = 0
    X_csr = sp.csr_matrix(X)
    X_csr[1, 0] = 0
    X[1, 0] = 0
    X_means, X_vars = mean_variance_axis0(X_csr)
    assert_array_almost_equal(X_means, np.mean(X, axis=0))
    assert_array_almost_equal(X_vars, np.var(X, axis=0))

    X_csc = sp.csc_matrix(X)
    X_csc[1, 0] = 0
    X[1, 0] = 0
    X_means, X_vars = mean_variance_axis0(X_csc)

    assert_array_almost_equal(X_means, np.mean(X, axis=0))
    assert_array_almost_equal(X_vars, np.var(X, axis=0))

@@ -381,20 +381,20 @@
   X_
-csr
+lil
  = sp.
-csr
+lil
 _mat
@@ -406,19 +406,19 @@
 )%0A    X_
-csr
+lil
 %5B1, 0%5D =
@@ -428,32 +428,66 @@
     X%5B1, 0%5D = 0%0A
+    X_csr = sp.csr_matrix(X_lil)%0A%0A
     X_means, X_v
@@ -667,45 +667,13 @@
 ix(X
-)%0A    X_csc%5B1, 0%5D = 0%0A    X%5B1, 0%5D = 0
+_lil)
 %0A   

Fix warning.