From a32b65234aa2ea12471be8a5a70c826ca4fb0598 Mon Sep 17 00:00:00 2001 From: ilan-gold Date: Tue, 2 Jan 2024 18:18:01 -0500 Subject: [PATCH] (fix): fix tests really --- src/multi_condition_comparisions/tl/de.py | 2 ++ tests/test_edge_cases.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/multi_condition_comparisions/tl/de.py b/src/multi_condition_comparisions/tl/de.py index 55ca9dc..23a0edb 100644 --- a/src/multi_condition_comparisions/tl/de.py +++ b/src/multi_condition_comparisions/tl/de.py @@ -75,6 +75,8 @@ def _check_count_matrix(self, array: np.ndarray | spmatrix, tolerance: float = 1 else: if not array.dtype.kind == "i" or not np.all(np.abs(array - np.round(array)) < tolerance): raise ValueError("Matrix must be a count matrix.") + if (array < 0).sum() > 0: + raise ValueError("Non.zero elements of the matrix must be postiive.") return True diff --git a/tests/test_edge_cases.py b/tests/test_edge_cases.py index b1ef924..45e0084 100644 --- a/tests/test_edge_cases.py +++ b/tests/test_edge_cases.py @@ -24,7 +24,7 @@ def test_valid_count_matrix(statsmodels_stub): def test_valid_sparse_count_matrix(statsmodels_stub): """Test with a valid sparse count matrix.""" - matrix = sp.csr_matrix([[1, 0], [0, 2]]) + matrix = sp.sparse.csr_matrix([[1, 0], [0, 2]]) assert statsmodels_stub._check_count_matrix(matrix)