Skip to content

Commit

Permalink
Add test function to catch divide-by-zero warning
Browse files Browse the repository at this point in the history
  • Loading branch information
NimaSarajpoor committed Jul 25, 2024
1 parent f154e2e commit aea50d9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/test_ostinato.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,3 +249,13 @@ def test_extract_several_consensus_ostinatoed(dask_cluster):
Ts_ref[i][np.isfinite(Ts_ref[i])],
Ts_comp[i][np.isfinite(Ts_comp[i])],
)


@pytest.mark.filterwarnings(
"error:divide by zero encountered in divide", category=RuntimeWarning
)
def test_ostinato_divide_by_zero():
Ts = [np.random.rand(n) for n in [64, 128, 256]]
m = 5
Ts[0][:m] = np.nan
stumpy.ostinato(Ts, m)

0 comments on commit aea50d9

Please sign in to comment.