Skip to content

Commit cfaab8b

Browse files
committed
Make xp mandatory
1 parent 1ae1abf commit cfaab8b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/array_api_extra/_lib/_funcs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -741,9 +741,9 @@ def kron(
741741
def nan_to_num(
742742
x: Array,
743743
/,
744-
*,
745744
fill_value: int | float | complex = 0.0,
746-
xp: ModuleType | None = None,
745+
*,
746+
xp: ModuleType,
747747
) -> Array:
748748
"""See docstring in `array_api_extra._delegation.py`."""
749749
xp = array_namespace(x) if xp is None else xp

tests/test_funcs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,7 @@ def test_xp(self, xp: ModuleType):
946946
class TestNumToNan:
947947
def test_bool(self, xp: ModuleType) -> None:
948948
a = xp.asarray([True])
949-
xp_assert_equal(nan_to_num(a), a)
949+
xp_assert_equal(nan_to_num(a, xp=xp), a)
950950

951951
def test_scalar_pos_inf(self, xp: ModuleType, infinity: float) -> None:
952952
a = xp.inf
@@ -963,7 +963,7 @@ def test_scalar_nan(self, xp: ModuleType) -> None:
963963
def test_real(self, xp: ModuleType, infinity: float) -> None:
964964
a = xp.asarray([xp.inf, -xp.inf, xp.nan, -128, 128])
965965
xp_assert_equal(
966-
nan_to_num(a),
966+
nan_to_num(a, xp=xp),
967967
xp.asarray(
968968
[
969969
infinity,

0 commit comments

Comments
 (0)