summaryrefslogtreecommitdiff
path: root/numpy/lib/tests
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2018-07-30 22:49:15 -0700
committerEric Wieser <wieser.eric@gmail.com>2018-07-30 22:49:15 -0700
commit455b5c567f75486b121c33f82bcb8f8da9683b5a (patch)
tree912ab603643d9d265126d69096de78f21dc96812 /numpy/lib/tests
parent766d82f85ac04ffd9ba32e0266bc270acfe7ed60 (diff)
downloadnumpy-455b5c567f75486b121c33f82bcb8f8da9683b5a.tar.gz
TST: Add tests for expand_dims
Diffstat (limited to 'numpy/lib/tests')
-rw-r--r--numpy/lib/tests/test_shape_base.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_shape_base.py b/numpy/lib/tests/test_shape_base.py
index c95894f94..6d24dd624 100644
--- a/numpy/lib/tests/test_shape_base.py
+++ b/numpy/lib/tests/test_shape_base.py
@@ -293,6 +293,15 @@ class TestExpandDims(object):
assert_warns(DeprecationWarning, expand_dims, a, -6)
assert_warns(DeprecationWarning, expand_dims, a, 5)
+ def test_subclasses(self):
+ a = np.arange(10).reshape((2, 5))
+ a = np.ma.array(a, mask=a%3 == 0)
+
+ expanded = np.expand_dims(a, axis=1)
+ assert_(isinstance(expanded, np.ma.MaskedArray))
+ assert_equal(expanded.shape, (2, 1, 5))
+ assert_equal(expanded.mask.shape, (2, 1, 5))
+
class TestArraySplit(object):
def test_integer_0_split(self):