@@ -1018,11 +1018,38 @@ def test_int64_add_overflow():
1018
1018
nanops ._checked_add_with_arr (np .array ([n , n ]), np .array ([n , n ]))
1019
1019
with tm .assertRaisesRegexp (OverflowError , msg ):
1020
1020
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 ]))
1021
1031
with tm .assertRaisesRegexp (OverflowError , msg ):
1022
1032
with tm .assert_produces_warning (RuntimeWarning ):
1023
1033
nanops ._checked_add_with_arr (np .array ([m , m ]),
1024
1034
np .array ([np .nan , m ]))
1025
1035
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
+
1026
1053
1027
1054
if __name__ == '__main__' :
1028
1055
import nose
0 commit comments