@@ -1018,11 +1018,38 @@ def test_int64_add_overflow():
10181018 nanops ._checked_add_with_arr (np .array ([n , n ]), np .array ([n , n ]))
10191019 with tm .assertRaisesRegexp (OverflowError , msg ):
10201020 nanops ._checked_add_with_arr (np .array ([m , n ]), np .array ([n , n ]))
1021+ with tm .assertRaisesRegexp (OverflowError , msg ):
1022+ nanops ._checked_add_with_arr (np .array ([m , m ]), np .array ([m , m ]),
1023+ arr_mask = np .array ([False , True ]))
1024+ with tm .assertRaisesRegexp (OverflowError , msg ):
1025+ nanops ._checked_add_with_arr (np .array ([m , m ]), np .array ([m , m ]),
1026+ b_mask = np .array ([False , True ]))
1027+ with tm .assertRaisesRegexp (OverflowError , msg ):
1028+ nanops ._checked_add_with_arr (np .array ([m , m ]), np .array ([m , m ]),
1029+ arr_mask = np .array ([False , True ]),
1030+ b_mask = np .array ([False , True ]))
10211031 with tm .assertRaisesRegexp (OverflowError , msg ):
10221032 with tm .assert_produces_warning (RuntimeWarning ):
10231033 nanops ._checked_add_with_arr (np .array ([m , m ]),
10241034 np .array ([np .nan , m ]))
10251035
1036+ # Check that the nan boolean arrays override whether or not
1037+ # the addition overflows. We don't check the result but just
1038+ # the fact that an OverflowError is not raised.
1039+ with tm .assertRaises (AssertionError ):
1040+ with tm .assertRaisesRegexp (OverflowError , msg ):
1041+ nanops ._checked_add_with_arr (np .array ([m , m ]), np .array ([m , m ]),
1042+ arr_mask = np .array ([True , True ]))
1043+ with tm .assertRaises (AssertionError ):
1044+ with tm .assertRaisesRegexp (OverflowError , msg ):
1045+ nanops ._checked_add_with_arr (np .array ([m , m ]), np .array ([m , m ]),
1046+ b_mask = np .array ([True , True ]))
1047+ with tm .assertRaises (AssertionError ):
1048+ with tm .assertRaisesRegexp (OverflowError , msg ):
1049+ nanops ._checked_add_with_arr (np .array ([m , m ]), np .array ([m , m ]),
1050+ arr_mask = np .array ([True , False ]),
1051+ b_mask = np .array ([False , True ]))
1052+
10261053
10271054if __name__ == '__main__' :
10281055 import nose
0 commit comments