Skip to content

Commit b635fff

Browse files
committed
Use ndarrays for cos/ceil/divide tests
1 parent 9776bb6 commit b635fff

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

array_api_tests/test_elementwise_functions.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ def test_bitwise_xor(args):
331331
ans = int_to_dtype(x ^ y, dtype_nbits(a.dtype), dtype_signed(a.dtype))
332332
assert ans == res
333333

334-
@given(numeric_scalars)
334+
@given(xps.arrays(dtype=xps.numeric_dtypes(), shape=shapes))
335335
def test_ceil(x):
336336
# This test is almost identical to test_floor()
337337
a = xp.ceil(x)
@@ -342,7 +342,7 @@ def test_ceil(x):
342342
integers = isintegral(x)
343343
assert_exactly_equal(a[integers], x[integers])
344344

345-
@given(floating_scalars)
345+
@given(xps.arrays(dtype=xps.floating_dtypes(), shape=shapes))
346346
def test_cos(x):
347347
a = xp.cos(x)
348348
ONE = one(x.shape, x.dtype)
@@ -353,7 +353,7 @@ def test_cos(x):
353353
# to nan, which is already tested in the special cases.
354354
assert_exactly_equal(domain, codomain)
355355

356-
@given(floating_scalars)
356+
@given(xps.arrays(dtype=xps.floating_dtypes(), shape=shapes))
357357
def test_cosh(x):
358358
a = xp.cosh(x)
359359
INFINITY = infinity(x.shape, x.dtype)
@@ -363,9 +363,9 @@ def test_cosh(x):
363363
# mapped to nan, which is already tested in the special cases.
364364
assert_exactly_equal(domain, codomain)
365365

366-
@given(two_floating_dtypes.flatmap(lambda i: two_array_scalars(*i)))
367-
def test_divide(args):
368-
x1, x2 = args
366+
@given(two_mutual_arrays(floating_dtype_objects))
367+
def test_divide(x1_and_x2):
368+
x1, x2 = x1_and_x2
369369
sanity_check(x1, x2)
370370
xp.divide(x1, x2)
371371
# There isn't much we can test here. The spec doesn't require any behavior

0 commit comments

Comments
 (0)