def assert_mask_matches(arr, expected_mask):
 mask = np.ma.getmaskarray(arr)
 assert_equal(mask, expected_mask)

def assert_mask_matches ( arr , expected_mask ) : mask = np . ma . getmaskarray ( arr ) assert_equal ( mask , expected_mask )
asserts that the mask of arr is effectively the same as expected_mask .