Skip to content

Commit

Permalink
TST: test coverage for vendored functions (data-apis#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
crusaderky authored Jan 15, 2025
1 parent 5f4fa99 commit ec915ff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
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

0 comments on commit ec915ff

Please sign in to comment.