From d2fe73ab60e88bd62ea062ceaa3ca7a0fb5cca1b Mon Sep 17 00:00:00 2001 From: Eiko Date: Tue, 17 Mar 2026 16:41:07 +0000 Subject: [PATCH] fix:Fix the random prop_sampleM test failure by using a 99.99% confidence interval on a Bernoulli distribution. Since quickCheck already runs 100 tests, this aims for 1/10000, which corresponds to z-score of 3.89. Should fix the random CI failure in the prop_sampleM test. --- tests/Monad.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/Monad.hs b/tests/Monad.hs index 03e93902..e2b8bd87 100644 --- a/tests/Monad.hs +++ b/tests/Monad.hs @@ -22,6 +22,8 @@ prop_sampleM df = monadic' $ do let finalRowCount = D.nRows finalDf let realRate = roundToTwoPlaces $ fromIntegral finalRowCount / fromIntegral rowCount let diff = abs $ expectedRate - realRate - assert (diff <= 0.11) + -- calculates the 99.99% confidence interval (quickcheck runs 100 tests, aim for 1/10000) + let tolerance = 3.89 * sqrt (expectedRate * (1 - expectedRate) / fromIntegral rowCount) + assert (diff <= tolerance) tests = [prop_sampleM]