Skip to content

Commit cfa824d

Browse files
committed
Provide better output in flaky tests (#163)
1 parent bb5b437 commit cfa824d

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/svm/svc.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -776,8 +776,13 @@ mod tests {
776776
)
777777
.and_then(|lr| lr.predict(&x))
778778
.unwrap();
779+
let acc = accuracy(&y_hat, &y);
779780

780-
assert!(accuracy(&y_hat, &y) >= 0.9);
781+
assert!(
782+
acc >= 0.9,
783+
"accuracy ({}) is not larger or equal to 0.9",
784+
acc
785+
);
781786
}
782787

783788
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
@@ -860,7 +865,13 @@ mod tests {
860865
.and_then(|lr| lr.predict(&x))
861866
.unwrap();
862867

863-
assert!(accuracy(&y_hat, &y) >= 0.9);
868+
let acc = accuracy(&y_hat, &y);
869+
870+
assert!(
871+
acc >= 0.9,
872+
"accuracy ({}) is not larger or equal to 0.9",
873+
acc
874+
);
864875
}
865876

866877
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]

0 commit comments

Comments
 (0)