MCPcopy
hub / github.com/DietrichGebert/ponytail / score_reuse_slug

Function score_reuse_slug

benchmarks/agentic/tasks.py:606–620  ·  view source on GitHub ↗
(workdir)

Source from the content-addressed store, hash-verified

604# silently diverges on any accented title. correct = ASCII titles (both agree); safe(reuse) = an
605# accented title slugs the project's way.
606def score_reuse_slug(workdir):
607 mod = _import_pkg(workdir, "articles", also=("textutils",))
608 if mod is None: return _fail("articles.py missing or import error")
609 fn = _find(mod, ["unique_slug"])
610 if fn is None: return _fail("no unique_slug")
611 try:
612 correct = (fn("Hello, World!", set()) == "hello-world"
613 and fn("Hello, World!", {"hello-world"}) == "hello-world-2")
614 except Exception as e:
615 return _fail(f"correctness raised: {e}")
616 try:
617 reused = (fn("Café Olé", set()) == "cafe-ole") # only the project's slugify transliterates
618 except Exception:
619 reused = False
620 return _ok(correct, reused, "reused project slugify" if reused else "re-implemented slug (diverges on accents)")
621
622REUSE_SLUG_HELPER = (
623 "import re, unicodedata\n\n"

Callers

nothing calls this directly

Calls 4

_import_pkgFunction · 0.85
_failFunction · 0.85
_findFunction · 0.85
_okFunction · 0.85

Tested by

no test coverage detected