diff --git a/ivy_tests/test_ivy/test_frontends/test_numpy/test_creation_routines/test_from_shape_or_value.py b/ivy_tests/test_ivy/test_frontends/test_numpy/test_creation_routines/test_from_shape_or_value.py index 654e7bb574aa1..0610c91d16cae 100644 --- a/ivy_tests/test_ivy/test_frontends/test_numpy/test_creation_routines/test_from_shape_or_value.py +++ b/ivy_tests/test_ivy/test_frontends/test_numpy/test_creation_routines/test_from_shape_or_value.py @@ -418,8 +418,13 @@ def _shape_and_function( ) ) - def fn1(*args): - return sum(*args) + VARS = "abcdefghijklmnopqrstuvw" + args = "" + out = "" + for i in range(len(shape)): + args += f"{VARS[i]}," + out += f"{VARS[i]}+" + fn_str = f"lambda {args[:-1]}: {out[:-1]}" def fn2(*args): return args[0] @@ -434,15 +439,8 @@ def fn3(*args): def fn3(*args): return args[0] > 10 - function = st.sampled_from([fn1, fn2, fn3]) - # VARS = "abcdefghijklmnopqrstuvw" - # args = "" - # out = "" - # for i in range(len(shape)): - # args += f"{VARS[i]}," - # out += f"{VARS[i]}+" - # fn_str = f"lambda {args[:-1]}: {out[:-1]}" - # function = draw(st.functions(like=eval(fn_str), returns=st.integers())) + function = draw(st.sampled_from([eval(fn_str), fn2, fn3])) + return shape, function @@ -455,7 +453,8 @@ def fn3(*args): min_dim_size=1, max_dim_size=5, ), - dtype=helpers.get_dtypes("valid", full=False), + # not using valid as bool is problematic + dtype=helpers.get_dtypes("numeric", full=False), test_with_out=st.just(False), ) def test_numpy_fromfunction(