@@ -5175,6 +5175,16 @@ def test_masked_array():
5175
5175
a = np .ma .array ([0 , 1 , 2 , 3 ], mask = [0 , 0 , 1 , 0 ])
5176
5176
assert_equal (np .argwhere (a ), [[1 ], [3 ]])
5177
5177
5178
+ def test_masked_array_no_copy ():
5179
+ # check nomask array is updated in place
5180
+ a = np .ma .array ([1 , 2 , 3 , 4 ])
5181
+ _ = np .ma .masked_where (a == 3 , a , copy = False )
5182
+ assert_array_equal (a .mask , [False , False , True , False ])
5183
+ # check masked array is updated in place
5184
+ a = np .ma .array ([1 , 2 , 3 , 4 ], mask = [1 , 0 , 0 , 0 ])
5185
+ _ = np .ma .masked_where (a == 3 , a , copy = False )
5186
+ assert_array_equal (a .mask , [True , False , True , False ])
5187
+
5178
5188
def test_append_masked_array ():
5179
5189
a = np .ma .masked_equal ([1 ,2 ,3 ], value = 2 )
5180
5190
b = np .ma .masked_equal ([4 ,3 ,2 ], value = 2 )
@@ -5213,7 +5223,6 @@ def test_append_masked_array_along_axis():
5213
5223
assert_array_equal (result .data , expected .data )
5214
5224
assert_array_equal (result .mask , expected .mask )
5215
5225
5216
-
5217
5226
def test_default_fill_value_complex ():
5218
5227
# regression test for Python 3, where 'unicode' was not defined
5219
5228
assert_ (default_fill_value (1 + 1j ) == 1.e20 + 0.0j )
0 commit comments