Skip to content

Commit aea50d9

Browse files
committed
Add test function to catch divide-by-zero warning
1 parent f154e2e commit aea50d9

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/test_ostinato.py

+10
Original file line numberDiff line numberDiff line change
@@ -249,3 +249,13 @@ def test_extract_several_consensus_ostinatoed(dask_cluster):
249249
Ts_ref[i][np.isfinite(Ts_ref[i])],
250250
Ts_comp[i][np.isfinite(Ts_comp[i])],
251251
)
252+
253+
254+
@pytest.mark.filterwarnings(
255+
"error:divide by zero encountered in divide", category=RuntimeWarning
256+
)
257+
def test_ostinato_divide_by_zero():
258+
Ts = [np.random.rand(n) for n in [64, 128, 256]]
259+
m = 5
260+
Ts[0][:m] = np.nan
261+
stumpy.ostinato(Ts, m)

0 commit comments

Comments
 (0)