Skip to content

TST: test coverage for vendored functions #93

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 2 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion src/array_api_extra/_lib/_utils/_compat.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ def is_cupy_namespace(xp: ModuleType, /) -> bool: ...
def is_dask_namespace(xp: ModuleType, /) -> bool: ...
def is_jax_namespace(xp: ModuleType, /) -> bool: ...
def is_numpy_namespace(xp: ModuleType, /) -> bool: ...
def is_pydata_sparse_namespace(xp: ModuleType, /) -> bool: ...
def is_torch_namespace(xp: ModuleType, /) -> bool: ...
def is_jax_array(x: object, /) -> bool: ...
def is_pydata_sparse_namespace(xp: ModuleType, /) -> bool: ...
def is_writeable_array(x: object, /) -> bool: ...
def size(x: Array, /) -> int | None: ...
6 changes: 4 additions & 2 deletions vendor_tests/test_vendor.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ def test_vendor_compat():
array_namespace,
device,
is_cupy_namespace,
is_dask_namespace,
is_jax_array,
is_jax_namespace,
is_pydata_sparse_namespace,
Expand All @@ -18,12 +19,13 @@ def test_vendor_compat():
x = xp.asarray([1, 2, 3])
assert array_namespace(x) is xp
device(x)
assert not is_jax_array(x)
assert is_writeable_array(x)
assert not is_cupy_namespace(xp)
assert not is_dask_namespace(xp)
assert not is_jax_array(x)
assert not is_jax_namespace(xp)
assert not is_pydata_sparse_namespace(xp)
assert not is_torch_namespace(xp)
assert is_writeable_array(x)
assert size(x) == 3


Expand Down
Loading