From ea927d961dfc32b6963aed3b3a10bc51c12543df Mon Sep 17 00:00:00 2001 From: Charles Harris Date: Sat, 3 Jan 2015 17:55:43 -0700 Subject: BUG: Make ravel function return 1-D arrays for matrix argument. This is a backward compatibility hack to avoid breaking scipy.sparse after fixing ravel to respect subtypes. Subtypes are still respected except in the case of matrices and subclasses of matrices. --- numpy/matrixlib/tests/test_defmatrix.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'numpy/matrixlib/tests/test_defmatrix.py') diff --git a/numpy/matrixlib/tests/test_defmatrix.py b/numpy/matrixlib/tests/test_defmatrix.py index 93843c55c..f3a8e72ca 100644 --- a/numpy/matrixlib/tests/test_defmatrix.py +++ b/numpy/matrixlib/tests/test_defmatrix.py @@ -409,7 +409,7 @@ class TestShape(TestCase): def test_numpy_ravel(self): assert_equal(np.ravel(self.a).shape, (2,)) - assert_equal(np.ravel(self.m).shape, (1, 2)) + assert_equal(np.ravel(self.m).shape, (2,)) def test_member_ravel(self): assert_equal(self.a.ravel().shape, (2,)) @@ -426,10 +426,10 @@ class TestShape(TestCase): assert_equal(np.ravel(x.T), [1, 4, 2, 5, 3, 6]) assert_equal(np.ravel(x.T, order='A'), [1, 2, 3, 4, 5, 6]) x = matrix([[1, 2, 3], [4, 5, 6]]) - assert_equal(np.ravel(x), [[1, 2, 3, 4, 5, 6]]) - assert_equal(np.ravel(x, order='F'), [[1, 4, 2, 5, 3, 6]]) - assert_equal(np.ravel(x.T), [[1, 4, 2, 5, 3, 6]]) - assert_equal(np.ravel(x.T, order='A'), [[1, 2, 3, 4, 5, 6]]) + assert_equal(np.ravel(x), [1, 2, 3, 4, 5, 6]) + assert_equal(np.ravel(x, order='F'), [1, 4, 2, 5, 3, 6]) + assert_equal(np.ravel(x.T), [1, 4, 2, 5, 3, 6]) + assert_equal(np.ravel(x.T, order='A'), [1, 2, 3, 4, 5, 6]) def test_matrix_ravel_order(self): x = matrix([[1, 2, 3], [4, 5, 6]]) -- cgit v1.2.1