Skip to content

Commit 06a541b

Browse files
authored
Merge pull request #627 from lucascolley/lazy-test
TST/DOC/DEV: add missing `lazy_xp_function` calls, update contributing docs
2 parents e775855 + 84943dc commit 06a541b

3 files changed

Lines changed: 19 additions & 1 deletion

File tree

docs/contributing.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ Thanks to [all contributors](contributors.md) so far!
2020
- Import your function to `src/array_api_extra/__init__.py` and add it to
2121
`__all__` there.
2222
- Add a test class for your function in `tests/test_funcs.py`.
23+
- Ensure that `lazy_xp_function` is called on the function if lazy backends
24+
are supposed to be tested.
2325
- Add your function to `docs/api-reference.md`.
2426
- [Make a PR!](https://github.com/data-apis/array-api-extra/pulls)
2527

src/array_api_extra/_delegation.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,6 +1128,15 @@ def union1d(a: Array, b: Array, /, *, xp: ModuleType | None = None) -> Array:
11281128
-------
11291129
Array
11301130
Unique, sorted union of the input arrays.
1131+
1132+
See Also
1133+
--------
1134+
jax.numpy.union1d : Corresponding function in JAX.
1135+
1136+
Notes
1137+
-----
1138+
This function is not compatible with `jax.jit`.
1139+
See the docstring of the corresponding JAX function for more information.
11311140
"""
11321141
if xp is None:
11331142
xp = array_namespace(a, b)

tests/test_funcs.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,27 @@
5151
from array_api_extra.testing import lazy_xp_function
5252

5353
lazy_xp_function(apply_where)
54+
lazy_xp_function(argpartition)
5455
lazy_xp_function(atleast_nd)
56+
lazy_xp_function(broadcast_shapes)
5557
lazy_xp_function(cov)
5658
lazy_xp_function(create_diagonal)
59+
lazy_xp_function(default_dtype)
5760
lazy_xp_function(expand_dims)
61+
lazy_xp_function(isclose)
62+
lazy_xp_function(isin)
5863
lazy_xp_function(kron)
5964
lazy_xp_function(nan_to_num)
6065
lazy_xp_function(nunique)
6166
lazy_xp_function(one_hot)
6267
lazy_xp_function(pad)
68+
lazy_xp_function(partition)
6369
# FIXME calls in1d which calls xp.unique_values without size
6470
lazy_xp_function(setdiff1d, jax_jit=False)
71+
lazy_xp_function(sinc)
72+
lazy_xp_function(union1d, jax_jit=False)
6573
lazy_xp_function(xpx_searchsorted)
6674
lazy_xp_function(_funcs_searchsorted)
67-
lazy_xp_function(sinc)
6875

6976

7077
class TestApplyWhere:

0 commit comments

Comments
 (0)