summaryrefslogtreecommitdiff
path: root/numpy/ma
diff options
context:
space:
mode:
authorClément Robert <cr52@protonmail.com>2021-08-23 16:12:55 +0200
committerClément Robert <cr52@protonmail.com>2021-08-24 23:27:37 +0200
commit4807a236befa1a4ba99d058dc7de8aa562fb2273 (patch)
tree26cf20e6bc37d47c7be37bc6b5f688dbdb43ff9e /numpy/ma
parent35070c3c2d517d996b56c5a94cb19675056c835c (diff)
downloadnumpy-4807a236befa1a4ba99d058dc7de8aa562fb2273.tar.gz
BUG: fix a regression where a masked_array's mask wouldn't update
properly when indx was itself a masked_array instance. Closes #19721. See #19244 for context.
Diffstat (limited to 'numpy/ma')
-rw-r--r--numpy/ma/tests/test_old_ma.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/numpy/ma/tests/test_old_ma.py b/numpy/ma/tests/test_old_ma.py
index 2e0097dc8..2b3034f9c 100644
--- a/numpy/ma/tests/test_old_ma.py
+++ b/numpy/ma/tests/test_old_ma.py
@@ -704,6 +704,15 @@ class TestMa:
a[c] = 5
assert_(a[2] is masked)
+ def test_assignment_by_condition_2(self):
+ # gh-19721
+ a = masked_array([0, 1], mask=[False, False])
+ b = masked_array([0, 1], mask=[True, True])
+ mask = a < 1
+ b[mask] = a[mask]
+ expected_mask = [False, True]
+ assert_equal(b.mask, expected_mask)
+
class TestUfuncs:
def setup(self):