From f76a75c3c1f3cca054a2f04c4cdb8216e84731ca Mon Sep 17 00:00:00 2001 From: Matthew Date: Wed, 5 Jan 2022 11:45:55 +0000 Subject: [PATCH 1/2] Filter 0div int examples out for `test_remainder` --- xptests/test_elementwise_functions.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/xptests/test_elementwise_functions.py b/xptests/test_elementwise_functions.py index b0c2e8f3..4ce64fa4 100644 --- a/xptests/test_elementwise_functions.py +++ b/xptests/test_elementwise_functions.py @@ -1297,6 +1297,15 @@ def test_remainder( ): left = data.draw(left_strat, label=left_sym) right = data.draw(right_strat, label=right_sym) + if right_is_scalar: + out_dtype = left.dtype + else: + out_dtype = dh.result_type(left.dtype, right.dtype) + if dh.is_int_dtype(out_dtype): + if right_is_scalar: + assume(right != 0) + else: + assume(not ah.any(right == 0)) # TODO: rework same sign testing below to remove this if not right_is_scalar: assume(len(left.shape) <= len(right.shape)) From 8930c3b192d36e304d9f90fd5b02d97db1dc324c Mon Sep 17 00:00:00 2001 From: Matthew Date: Wed, 5 Jan 2022 11:58:56 +0000 Subject: [PATCH 2/2] Remove faulty `test_remainder` test logic --- xptests/test_elementwise_functions.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/xptests/test_elementwise_functions.py b/xptests/test_elementwise_functions.py index 4ce64fa4..cff66854 100644 --- a/xptests/test_elementwise_functions.py +++ b/xptests/test_elementwise_functions.py @@ -1306,17 +1306,10 @@ def test_remainder( assume(right != 0) else: assume(not ah.any(right == 0)) - # TODO: rework same sign testing below to remove this - if not right_is_scalar: - assume(len(left.shape) <= len(right.shape)) - res = func(left, right) + func(left, right) - if not right_is_scalar: - # res and x2 should have the same sign. - # ah.assert_same_sign returns False for nans - not_nan = ah.logical_not(ah.logical_or(ah.isnan(res), ah.isnan(left))) - ah.assert_same_sign(res[not_nan], right[not_nan]) + # TODO: test results @given(xps.arrays(dtype=xps.numeric_dtypes(), shape=hh.shapes()))