nickh007 commited on
Commit
2897ee3
·
verified ·
1 Parent(s): 6d01956

Mark the figures the release cannot reproduce

Browse files
Files changed (1) hide show
  1. tests/test_dataset.py +31 -0
tests/test_dataset.py CHANGED
@@ -267,3 +267,34 @@ def test_readme_figures_match_the_data():
267
  assert f"{t['certified_leaves_total']:,}" in readme
268
  assert f"{t['processed_leaves_total']:,}" in readme
269
  assert f"{t['forced_pairwise_overprediction_pct']:.6f}"[:9] in readme
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
267
  assert f"{t['certified_leaves_total']:,}" in readme
268
  assert f"{t['processed_leaves_total']:,}" in readme
269
  assert f"{t['forced_pairwise_overprediction_pct']:.6f}"[:9] in readme
270
+
271
+
272
+ @pytest.mark.parametrize("samples,expected", [
273
+ (25, "0.902144353337"),
274
+ (100, "0.903775408593"),
275
+ ])
276
+ def test_readme_sampling_ladder_reproduces(samples, expected):
277
+ """The card quotes a sampling ladder; a reader will run it, so it must hold.
278
+
279
+ 400 samples is quoted too but takes ~6 s, so it is exercised by the
280
+ quoted-string check below rather than re-run on every commit.
281
+ """
282
+ worst, violations = verify.check_regions(
283
+ load_regions(), load_theorem()["k_bar"], samples,
284
+ random.Random(7), verbose=False)
285
+ assert f"{worst:.12f}" == expected
286
+ assert violations == []
287
+ assert expected in (HERE / "README.md").read_text()
288
+
289
+
290
+ def test_readme_marks_the_two_figures_it_cannot_reproduce():
291
+ """0.081% and 0.9053 come from tooling that is not in this release.
292
+
293
+ Every other number on the card re-derives from the published files. These
294
+ two do not, and a reader has no way to tell them apart unless we say so.
295
+ """
296
+ readme = (HERE / "README.md").read_text()
297
+ for figure in ("0.081%", "0.9053"):
298
+ assert figure in readme, f"{figure} vanished; drop this guard with it"
299
+ assert "not part of this release" in readme
300
+ assert "cannot re-derive it from what is published here" in readme