diff options
author | ahaldane <ealloc@gmail.com> | 2015-09-25 08:27:46 -0400 |
---|---|---|
committer | ahaldane <ealloc@gmail.com> | 2015-09-25 08:27:46 -0400 |
commit | 1765438b5f68eeb5c9b920e8df2760dc8e908cae (patch) | |
tree | 9318c76ea015b62fedd5fdecf1f390e17bfc2e3f /numpy | |
parent | 941a4e037d394dada43e3c2beef1e650d5505742 (diff) | |
parent | 4a9ad17e58a042931798c32b39b137f52abc3aed (diff) | |
download | numpy-1765438b5f68eeb5c9b920e8df2760dc8e908cae.tar.gz |
Merge pull request #6355 from jjhelmus/ma_zero_shape
BUG: numpy.ma functions can be called with only keyword arguments
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/ma/core.py | 4 | ||||
-rw-r--r-- | numpy/ma/tests/test_core.py | 12 |
2 files changed, 14 insertions, 2 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py index ca6698492..61f0c12a8 100644 --- a/numpy/ma/core.py +++ b/numpy/ma/core.py @@ -7536,7 +7536,7 @@ class _convert2ma: doc = sig + doc return doc - def __call__(self, a, *args, **params): + def __call__(self, *args, **params): # Find the common parameters to the call and the definition _extras = self._extras common_params = set(params).intersection(_extras) @@ -7544,7 +7544,7 @@ class _convert2ma: for p in common_params: _extras[p] = params.pop(p) # Get the result - result = self._func.__call__(a, *args, **params).view(MaskedArray) + result = self._func.__call__(*args, **params).view(MaskedArray) if "fill_value" in common_params: result.fill_value = _extras.get("fill_value", None) if "hardmask" in common_params: diff --git a/numpy/ma/tests/test_core.py b/numpy/ma/tests/test_core.py index d2b984084..aa6ce5db9 100644 --- a/numpy/ma/tests/test_core.py +++ b/numpy/ma/tests/test_core.py @@ -1670,6 +1670,18 @@ class TestFillingValues(TestCase): a = identity(3, fill_value=0., dtype=complex) assert_equal(a.fill_value, 0.) + def test_shape_argument(self): + # Test that shape can be provides as an argument + # GH issue 6106 + a = empty(shape=(3, )) + assert_equal(a.shape, (3, )) + + a = ones(shape=(3, ), dtype=float) + assert_equal(a.shape, (3, )) + + a = zeros(shape=(3, ), dtype=complex) + assert_equal(a.shape, (3, )) + def test_fillvalue_in_view(self): # Test the behavior of fill_value in view |