Skip to content

Commit da17bf4

Browse files
committed
use the new decorator
1 parent 761795c commit da17bf4

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tests/core/test_algorithm.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
11
import importlib.util
2+
import types
23

34
import numpy as np
45
import pytest
6+
from tests.conftest import array_api_compatible
57

68
from glass.core.algorithm import nnls as nnls_glass
79

810
# check if scipy is available for testing
911
HAVE_SCIPY = importlib.util.find_spec("scipy") is not None
1012

1113

14+
@array_api_compatible
1215
@pytest.mark.skipif(not HAVE_SCIPY, reason="test requires SciPy")
13-
def test_nnls(rng: np.random.Generator) -> None:
16+
def test_nnls(rng: np.random.Generator, xp: types.ModuleType) -> None:
1417
from scipy.optimize import nnls as nnls_scipy
1518

1619
# cross-check output with scipy's nnls
1720

18-
a = rng.standard_normal((100, 20))
19-
b = rng.standard_normal((100,))
21+
a = xp.asarray(rng.standard_normal((100, 20)))
22+
b = xp.asarray(rng.standard_normal((100,)))
2023

2124
x_glass = nnls_glass(a, b)
2225
x_scipy, _ = nnls_scipy(a, b)

0 commit comments

Comments
 (0)