Skip to content

Commit

Permalink
bump coverage for core.algorithms
Browse files Browse the repository at this point in the history
  • Loading branch information
Saransh-cpp committed Sep 24, 2024
1 parent 32b181a commit 89ec3fb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion glass/core/algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import numpy as np

if TYPE_CHECKING:
from numpy.typing import ArrayLike
from numpy.typing import ArrayLike # pragma: no cover


def nnls(
Expand Down
10 changes: 10 additions & 0 deletions tests/core/test_algorithm.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import pytest


def test_nnls(rng):
import numpy as np
from scipy.optimize import nnls as nnls_scipy
Expand All @@ -11,3 +14,10 @@ def test_nnls(rng):
x_scipy, _ = nnls_scipy(a, b)

assert np.allclose(x_glass, x_scipy)

with pytest.raises(ValueError, match="input `a` is not a matrix"):
nnls_glass(b, a)
with pytest.raises(ValueError, match="input `b` is not a vector"):
nnls_glass(a, a)
with pytest.raises(ValueError, match="the shapes of `a` and `b` do not match"):
nnls_glass(a.T, b)

0 comments on commit 89ec3fb

Please sign in to comment.