summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_shape_base.py
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2017-01-03 00:56:10 +0000
committerEric Wieser <wieser.eric@gmail.com>2017-02-11 21:09:09 +0000
commit9f362bfb3f99c0bcb30e9bd6e568e40ae5a0cf7b (patch)
treefdc72ba99dca4388e1c45aeb5f217c86928a2f65 /numpy/lib/tests/test_shape_base.py
parentb10b6c290ded55e410543b9d09686042be3db6ec (diff)
downloadnumpy-9f362bfb3f99c0bcb30e9bd6e568e40ae5a0cf7b.tar.gz
BUG: Work around evil matrix.__array_prepare__
Diffstat (limited to 'numpy/lib/tests/test_shape_base.py')
-rw-r--r--numpy/lib/tests/test_shape_base.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/numpy/lib/tests/test_shape_base.py b/numpy/lib/tests/test_shape_base.py
index 7bf2b4a81..111f302aa 100644
--- a/numpy/lib/tests/test_shape_base.py
+++ b/numpy/lib/tests/test_shape_base.py
@@ -28,14 +28,20 @@ class TestApplyAlongAxis(TestCase):
[[27, 30, 33], [36, 39, 42], [45, 48, 51]])
def test_preserve_subclass(self):
+ # this test is particularly malicious because matrix
+ # refuses to become 1d
def double(row):
return row * 2
m = np.matrix([[0, 1], [2, 3]])
+ expected = np.matrix([[0, 2], [4, 6]])
+
result = apply_along_axis(double, 0, m)
assert_(isinstance(result, np.matrix))
- assert_array_equal(
- result, np.matrix([[0, 2], [4, 6]])
- )
+ assert_array_equal(result, expected)
+
+ result = apply_along_axis(double, 1, m)
+ assert_(isinstance(result, np.matrix))
+ assert_array_equal(result, expected)
def test_subclass(self):
class MinimalSubclass(np.ndarray):