Skip to content

Fixes for 2023.12 tests #262

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 26 commits into from
Jun 25, 2024
Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
825949e
Fix accumulation_result_dtype for 2023.12 logic
asmeurer May 6, 2024
9aad419
Merge branch 'master' into 2023-fixes
asmeurer May 14, 2024
4a0d975
Fix the searchsorted test (and add a TODO)
asmeurer May 14, 2024
b7065de
Enable fft in the stubs
asmeurer May 15, 2024
6737695
Properly include __array_namespace_info__ in the stubs
asmeurer May 15, 2024
5aa865d
Test info functions in the signature tests
asmeurer May 15, 2024
ebb4f37
Skip cumulative_sum in the nan propogation special case test
asmeurer May 16, 2024
5e62058
Print the function name for non-machine readable special cases
asmeurer May 16, 2024
c8c9498
Enable dtype checks in sum and prod for 2023.12
asmeurer May 16, 2024
8a50ebc
Add shape, dtype, and value testing for cumulative_sum
asmeurer May 17, 2024
303d756
Merge branch 'master' into 2023-fixes
asmeurer May 23, 2024
bb33ff2
Fix flake8 issue
asmeurer May 23, 2024
a04ff8f
Fix test_cumulative_sum @given inputs
asmeurer May 23, 2024
6362204
Add missing tests for unstack()
asmeurer May 30, 2024
0f311e2
Fix formatting of greater than or equal sign
asmeurer Jun 5, 2024
279677d
Print the array module version in the tests header
asmeurer Jun 5, 2024
aafb6a1
Fix scalars() to not generate integers for floating-point dtypes
asmeurer Jun 5, 2024
bf3b773
Generate keyword arguments in test_clip()
asmeurer Jun 5, 2024
930932a
Add helper function is_scalar
asmeurer Jun 5, 2024
5993eca
Fix potentially undefined variable
asmeurer Jun 5, 2024
873eb64
Fix spelling
asmeurer Jun 5, 2024
4f0214e
Add value testing for clip()
asmeurer Jun 5, 2024
b311c83
Merge branch 'master' into 2023-fixes
asmeurer Jun 7, 2024
1b10ebf
Add the remainder of the value testing for clip()
asmeurer Jun 7, 2024
ceb63ea
Support int dtypes in test_clip and some portability fixes
asmeurer Jun 7, 2024
7ce5eb3
Fix input dtypes for test_clip
asmeurer Jun 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions array_api_tests/test_operators_and_elementwise_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,7 @@ def test_ceil(x):


@pytest.mark.min_version("2023.12")
@given(x=hh.arrays(dtype=hh.real_floating_dtypes, shape=hh.shapes()), data=st.data())
@given(x=hh.arrays(dtype=hh.int_dtypes, shape=hh.shapes()), data=st.data())
def test_clip(x, data):
# TODO: test min/max kwargs, adjust values testing accordingly

Expand All @@ -951,7 +951,7 @@ def test_clip(x, data):
), label="max")

# min > max is undefined (but allow nans)
assume(min is None or max is None or not xp.any(xp.asarray(min > max)))
assume(min is None or max is None or not xp.any(xp.asarray(min) > xp.asarray(max)))

kw = data.draw(
hh.specified_kwargs(
Expand Down Expand Up @@ -1035,13 +1035,14 @@ def refimpl(_x, _min, _max):
max_val = max if dh.is_scalar(max) else max[max_idx]
max_val = stype(max_val)
expected = refimpl(x_val, min_val, max_val)
out_val = stype(out[o_idx])
if math.isnan(expected):
assert math.isnan(out[o_idx]), (
assert math.isnan(out_val), (
f"out[{o_idx}]={out[o_idx]} but should be nan [clip()]\n"
f"x[{x_idx}]={x_val}, min[{min_idx}]={min_val}, max[{max_idx}]={max_val}"
)
else:
assert out[o_idx] == expected, (
assert out_val == expected, (
f"out[{o_idx}]={out[o_idx]} but should be {expected} [clip()]\n"
f"x[{x_idx}]={x_val}, min[{min_idx}]={min_val}, max[{max_idx}]={max_val}"
)
Expand Down
Loading