From e17b27269765c799627664d6f25e23ebfd900b3d Mon Sep 17 00:00:00 2001 From: Evgeni Burovski Date: Sat, 17 Jan 2026 21:32:00 +0100 Subject: [PATCH] ENH: test clip(float_array, min=int_scalar, max=int_scalar) --- .../test_operators_and_elementwise_functions.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/array_api_tests/test_operators_and_elementwise_functions.py b/array_api_tests/test_operators_and_elementwise_functions.py index c19fe3cd..1652a9d9 100644 --- a/array_api_tests/test_operators_and_elementwise_functions.py +++ b/array_api_tests/test_operators_and_elementwise_functions.py @@ -1067,14 +1067,20 @@ def test_clip(x, data): base_shape=x.shape), label="min.shape, max.shape") + # for min,max being scalars: clip(float_array, min=int_scalar, max=int_scalar) + if x.dtype in dh.real_float_dtypes: + scalar_strategy = st.sampled_from([xp.int32, x.dtype]) + else: + scalar_strategy = st.just(x.dtype) + min = data.draw(st.one_of( st.none(), - hh.scalars(dtypes=st.just(x.dtype)), + hh.scalars(dtypes=scalar_strategy), hh.arrays(dtype=st.just(x.dtype), shape=shape1), ), label="min") max = data.draw(st.one_of( st.none(), - hh.scalars(dtypes=st.just(x.dtype)), + hh.scalars(dtypes=scalar_strategy), hh.arrays(dtype=st.just(x.dtype), shape=shape2), ), label="max")