Skip to content

Commit 0cc6527

Browse files
wasadeclaude
andauthored
TST: seed test_subsample to remove flaky failure (#1007)
test_subsample expects all four outcomes for O1 across 100 unseeded draws. (3, 0, 0) occurs with p=1/16 per draw, so the test fails ~0.16% of the time ((15/16)**100). It failed on the master push of afffa0c (run 37349225586) after passing on the same commit in #1006. Seed each iteration with its index so the draws are deterministic while still covering every outcome. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent afffa0c commit 0cc6527

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎biom/tests/test_table.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3309,8 +3309,10 @@ def test_subsample(self):
33093309
['S1', 'S2', 'S3'])
33103310
actual_o1 = set()
33113311
actual_o2 = set()
3312+
# (3, 0, 0) occurs with p=1/16 per draw, so unseeded, 100 draws miss
3313+
# it ~0.16% of the time. Seed per-iteration to keep it deterministic.
33123314
for i in range(100):
3313-
obs = table.subsample(3)
3315+
obs = table.subsample(3, seed=i)
33143316
actual_o1.add(tuple(obs.data('O1', 'observation')))
33153317
actual_o2.add(tuple(obs.data('O2', 'observation')))
33163318
self.assertEqual(actual_o1, {(3, 0, 0), (3, 1, 0), (3, 0, 1),

0 commit comments

Comments
 (0)