Skip to content

Commit

Permalink
test: better handling of mahalanobis (#211)
Browse files Browse the repository at this point in the history
* test: skip test if Mahalanobis fails

* test: revert previous commit & pick right function
  • Loading branch information
deepcharles authored Oct 4, 2021
1 parent 2128977 commit ef08bf4
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tests/test_costs.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,17 @@ def test_costs_1D_noisy_names(signal_bkps_1D_noisy, cost_name):
def test_costs_5D_names(signal_bkps_5D, cost_name):
signal, bkps = signal_bkps_5D
cost = cost_factory(cost_name)
cost.fit(signal)
try:
cost.fit(signal)
except np.linalg.LinAlgError as e:
if cost_name == "mahalanobis":
reason_msg = (
"The Mahalanobis metric matrix cannot be computed "
"because the signal has a singular covariance matrix"
)
pytest.skip(reason_msg)
else:
raise
cost.error(0, 100)
cost.error(100, signal.shape[0])
cost.error(10, 50)
Expand Down

0 comments on commit ef08bf4

Please sign in to comment.