summaryrefslogtreecommitdiff
path: root/numpy/ma/tests
diff options
context:
space:
mode:
authorpierregm <pierregm@localhost>2009-02-10 00:42:40 +0000
committerpierregm <pierregm@localhost>2009-02-10 00:42:40 +0000
commitb3e5fdf55bb9a16f8fe78e11b2a9c5f9dd72f5c1 (patch)
tree31745b92059500adab156e2bacff541f77f7588b /numpy/ma/tests
parent114c5c609e55f0863a30b1edff7b1c7bf783263f (diff)
downloadnumpy-b3e5fdf55bb9a16f8fe78e11b2a9c5f9dd72f5c1.tar.gz
* prevent modifications to the mask to be back-propagated w/ __array_wrap__
Diffstat (limited to 'numpy/ma/tests')
-rw-r--r--numpy/ma/tests/test_core.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/numpy/ma/tests/test_core.py b/numpy/ma/tests/test_core.py
index c92c650b4..59acf6cfe 100644
--- a/numpy/ma/tests/test_core.py
+++ b/numpy/ma/tests/test_core.py
@@ -1025,6 +1025,23 @@ class TestMaskedArrayArithmetic(TestCase):
assert_equal(test.mask, [False, False])
+ def test_numpyarithmetics(self):
+ "Check that the mask is not back-propagated when using numpy functions"
+ a = masked_array([-1, 0, 1, 2, 3], mask=[0, 0, 0, 0, 1])
+ control = masked_array([np.nan, np.nan, 0, np.log(2), -1],
+ mask=[1, 1, 0, 0, 1])
+ #
+ test = log(a)
+ assert_equal(test, control)
+ assert_equal(test.mask, control.mask)
+ assert_equal(a.mask, [0, 0, 0, 0, 1])
+ #
+ test = np.log(a)
+ assert_equal(test, control)
+ assert_equal(test.mask, control.mask)
+ assert_equal(a.mask, [0, 0, 0, 0, 1])
+ #
+
#------------------------------------------------------------------------------
class TestMaskedArrayAttributes(TestCase):