Skip to content

Commit b08b33f

Browse files
authored
Merge pull request #58 from honno/remainder-0div
Filter zero division examples for `test_remainder`
2 parents c5b3d62 + 8930c3b commit b08b33f

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

xptests/test_elementwise_functions.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1297,17 +1297,19 @@ def test_remainder(
12971297
):
12981298
left = data.draw(left_strat, label=left_sym)
12991299
right = data.draw(right_strat, label=right_sym)
1300-
# TODO: rework same sign testing below to remove this
1301-
if not right_is_scalar:
1302-
assume(len(left.shape) <= len(right.shape))
1300+
if right_is_scalar:
1301+
out_dtype = left.dtype
1302+
else:
1303+
out_dtype = dh.result_type(left.dtype, right.dtype)
1304+
if dh.is_int_dtype(out_dtype):
1305+
if right_is_scalar:
1306+
assume(right != 0)
1307+
else:
1308+
assume(not ah.any(right == 0))
13031309

1304-
res = func(left, right)
1310+
func(left, right)
13051311

1306-
if not right_is_scalar:
1307-
# res and x2 should have the same sign.
1308-
# ah.assert_same_sign returns False for nans
1309-
not_nan = ah.logical_not(ah.logical_or(ah.isnan(res), ah.isnan(left)))
1310-
ah.assert_same_sign(res[not_nan], right[not_nan])
1312+
# TODO: test results
13111313

13121314

13131315
@given(xps.arrays(dtype=xps.numeric_dtypes(), shape=hh.shapes()))

0 commit comments

Comments
 (0)