diff --git a/biggus/tests/test_integration.py b/biggus/tests/test_integration.py index ac3c345..5a30b85 100644 --- a/biggus/tests/test_integration.py +++ b/biggus/tests/test_integration.py @@ -49,6 +49,16 @@ def test_mean_of_mean(self): result = mean2.ndarray() np.testing.assert_array_equal(result, expected) + def test_masked_array_numpy_first_biggus_second(self): + # Ensure that an operation where the biggus array is second (i.e. + # calling the special method of the numpy array not the biggus array, + # returns the expected type). + arr = np.ma.array([1, 2, 3], mask=[False, True, False]) + barr = biggus.NumpyArrayAdapter(arr) + target_type = type(np.array([[ 1.]]) * arr) + resulting_type = type(np.array([[ 1.]]) * barr) + self.assertIs(resulting_type, target_type) + if __name__ == '__main__': unittest.main()