nickh007 commited on
Commit
bb197df
·
verified ·
1 Parent(s): b6deb57

Sync from source tree: docs/tests drift since 2026-07-29

Browse files
Files changed (1) hide show
  1. tests/test_dataset.py +51 -3
tests/test_dataset.py CHANGED
@@ -293,8 +293,56 @@ def test_readme_marks_the_two_figures_it_cannot_reproduce():
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(encoding="utf-8")
 
 
 
 
 
 
 
 
 
 
 
 
 
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ import re
297
+
298
  readme = (HERE / "README.md").read_text(encoding="utf-8")
299
+ markers = ("not part of this release", "cannot re-derive")
300
+ at = [m.start() for k in markers for m in re.finditer(re.escape(k), readme)]
301
+ assert at, "the card carries no non-reproducibility disclosure at all"
302
+
303
+ # Two failure modes to close, both found by adversarial review of an
304
+ # earlier version of this guard:
305
+ # * a figure quoted somewhere far from any disclosure (e.g. a summary
306
+ # table appended to the end of the card) -- so check EVERY occurrence,
307
+ # not just the first;
308
+ # * one disclosure sentence covering both figures, so that deleting it
309
+ # silently un-discloses two numbers -- so require distinct markers.
310
+ WINDOW = 500 # every real mention today sits within 358 characters
311
+ nearest = {}
312
  for figure in ("0.081%", "0.9053"):
313
+ hits = list(re.finditer(re.escape(figure), readme))
314
+ assert hits, f"{figure} vanished; drop this guard with it"
315
+ for m in hits:
316
+ d = min(abs(m.start() - x) for x in at)
317
+ assert d <= WINDOW, (
318
+ f"{figure} is quoted at character {m.start()} with no "
319
+ f"disclosure within {WINDOW} characters (nearest is {d} away)"
320
+ )
321
+ nearest[figure] = min(at, key=lambda x: min(abs(m.start() - x) for m in hits))
322
+
323
+ assert len(set(nearest.values())) == 2, (
324
+ "both figures lean on the same disclosure sentence; each needs its own, "
325
+ "or removing one silently un-discloses the other"
326
+ )
327
+
328
+
329
+ def test_citation_points_at_a_home_that_exists():
330
+ """CITATION.cff pointed at a GitHub repo that was never created.
331
+
332
+ The dataset is published on the Hub, not on GitHub, so `repository-code`
333
+ named a URL that 404s -- on the one file whose entire job is telling people
334
+ where this came from. Checked offline by shape: a citation may only name a
335
+ host this project actually publishes to.
336
+ """
337
+ import re
338
+
339
+ cff = (HERE / "CITATION.cff").read_text(encoding="utf-8")
340
+ m = re.search(r'repository-code:\s*"?([^"\n]+)', cff)
341
+ assert m, "CITATION.cff names no repository-code"
342
+ url = m.group(1).strip()
343
+ assert url.startswith(
344
+ ("https://huggingface.co/datasets/nickh007/", "https://github.com/nickharris808/")
345
+ ), f"citation points somewhere this project does not publish: {url}"
346
+ assert "github.com/nickharris808/screening-ceiling" not in url, (
347
+ "that GitHub repo does not exist; this dataset lives on the Hub"
348
+ )