'A consistent return shape must be returned for both sparse and dense.'

def test_digitize_1d_array(self):

    x = np.array([0, 1, 1, 0, np.nan, 0, 1])
    x_sparse = csr_matrix(x)
    bins = np.arange((-2), 2)
    x_shape = x.shape
    np.testing.assert_array_equal([np.digitize(x.flatten(), bins).reshape(x_shape)], digitize(x, bins), 'Digitize    fails    on    1d    dense    data')
    np.testing.assert_array_equal([np.digitize(x.flatten(), bins).reshape(x_shape)], digitize(x_sparse, bins), 'Digitize    fails    on    1d    sparse    data')
