From cfa824d7dbdd1446058795b36d7c71e44b59d617 Mon Sep 17 00:00:00 2001 From: morenol <22335041+morenol@users.noreply.github.com> Date: Tue, 20 Sep 2022 12:12:09 -0400 Subject: [PATCH] Provide better output in flaky tests (#163) --- src/svm/svc.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/svm/svc.rs b/src/svm/svc.rs index 74f31c7..87fb743 100644 --- a/src/svm/svc.rs +++ b/src/svm/svc.rs @@ -776,8 +776,13 @@ mod tests { ) .and_then(|lr| lr.predict(&x)) .unwrap(); + let acc = accuracy(&y_hat, &y); - assert!(accuracy(&y_hat, &y) >= 0.9); + assert!( + acc >= 0.9, + "accuracy ({}) is not larger or equal to 0.9", + acc + ); } #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)] @@ -860,7 +865,13 @@ mod tests { .and_then(|lr| lr.predict(&x)) .unwrap(); - assert!(accuracy(&y_hat, &y) >= 0.9); + let acc = accuracy(&y_hat, &y); + + assert!( + acc >= 0.9, + "accuracy ({}) is not larger or equal to 0.9", + acc + ); } #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]