Skip to content

Commit 072e17e

Browse files
committed
Test statistics.util.stats with unit weights and nans
1 parent c135859 commit 072e17e

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Orange/tests/test_statistics.py

+11
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,17 @@ def test_stats_weights(self):
135135
X = np.arange(4).reshape(2, 2).astype(object)
136136
np.testing.assert_equal(stats(X, weights), stats(X))
137137

138+
def test_stats_nans_neutral_weights(self):
139+
X = np.arange(4).reshape(2, 2).astype(float)
140+
X[0, 0] = np.nan
141+
np.testing.assert_equal(stats(X, weights=np.array([1, 1])), stats(X))
142+
143+
def test_stats_nans_neutral_weights_sparse(self):
144+
X = np.arange(4).reshape(2, 2).astype(float)
145+
X = csr_matrix(X)
146+
X[0, 0] = np.nan
147+
np.testing.assert_equal(stats(X, weights=np.array([1, 1])), stats(X))
148+
138149
def test_stats_weights_sparse(self):
139150
X = np.arange(4).reshape(2, 2).astype(float)
140151
X = csr_matrix(X)

0 commit comments

Comments
 (0)