summaryrefslogtreecommitdiff
path: root/numpy/ma/tests/test_extras.py
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2019-11-27 23:17:29 +0000
committerSebastian Berg <sebastian@sipsolutions.net>2019-12-02 12:39:08 -0600
commit14bcfd9cfe0deb4e6499b398d7eba4d7e3dd7fe8 (patch)
tree3207856bd571ea24b16a0c66014c8c4e78eb1ca0 /numpy/ma/tests/test_extras.py
parentd1d9dd58e2de5f3b69c02b104e1daaeec1f38d9f (diff)
downloadnumpy-14bcfd9cfe0deb4e6499b398d7eba4d7e3dd7fe8.tar.gz
DEP: Deprecate the axis argument to masked_rows and masked_cols
This argument isn't used, and is confusing. (Small test added by seberg)
Diffstat (limited to 'numpy/ma/tests/test_extras.py')
-rw-r--r--numpy/ma/tests/test_extras.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/numpy/ma/tests/test_extras.py b/numpy/ma/tests/test_extras.py
index 836770378..c75c47801 100644
--- a/numpy/ma/tests/test_extras.py
+++ b/numpy/ma/tests/test_extras.py
@@ -11,6 +11,7 @@ from __future__ import division, absolute_import, print_function
import warnings
import itertools
+import pytest
import numpy as np
from numpy.testing import (
@@ -552,6 +553,18 @@ class TestCompressFunctions(object):
assert_(mask_rowcols(x, 0).mask.all())
assert_(mask_rowcols(x, 1).mask.all())
+ @pytest.mark.parametrize("axis", [None, 0, 1])
+ @pytest.mark.parametrize(["func", "rowcols_axis"],
+ [(np.ma.mask_rows, 0), (np.ma.mask_cols, 1)])
+ def test_mask_row_cols_axis_deprecation(self, axis, func, rowcols_axis):
+ # Test deprecation of the axis argument to `mask_rows` and `mask_cols`
+ x = array(np.arange(9).reshape(3, 3),
+ mask=[[1, 0, 0], [0, 0, 0], [0, 0, 0]])
+
+ with assert_warns(DeprecationWarning):
+ res = func(x, axis=axis)
+ assert_equal(res, mask_rowcols(x, rowcols_axis))
+
def test_dot(self):
# Tests dot product
n = np.arange(1, 7)