diff options
author | Ralf Gommers <ralf.gommers@gmail.com> | 2018-07-31 11:15:30 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-31 11:15:30 -0700 |
commit | b0832bd6d28c4ec109184c37673984cdc677156c (patch) | |
tree | 880e44d48ddbf4909d50acb718d2bccbe05a19be /numpy/lib/tests | |
parent | a591b4abca82df4361a34d7e4388335958c42808 (diff) | |
parent | 455b5c567f75486b121c33f82bcb8f8da9683b5a (diff) | |
download | numpy-b0832bd6d28c4ec109184c37673984cdc677156c.tar.gz |
Merge pull request #11638 from eric-wieser/remove-ma.expand_dims
ENH: Make expand_dims work on subclasses
Diffstat (limited to 'numpy/lib/tests')
-rw-r--r-- | numpy/lib/tests/test_shape_base.py | 9 |
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): |