feat(cv): qualify templates and reliable local import processing
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
"""Check that the benchmark's unhyphenated name words are not broken into fragments."""
|
||||
import argparse
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("directory", type=Path)
|
||||
args = parser.parse_args()
|
||||
source = json.loads((args.directory / "measurements.json").read_text(encoding="utf-8"))
|
||||
fixtures = [{"fixture": row["fixture"], "brokenWords": [word for word in row["measured"]["splitNameWords"] if "-" not in word]}
|
||||
for row in source["fixtures"]]
|
||||
result = {"total": len(fixtures), "passed": sum(not row["brokenWords"] for row in fixtures), "fixtures": fixtures,
|
||||
"limits": "Finite synthetic name fixture only; natural hyphen breaks permitted, arbitrary names/custom font sizes not guaranteed."}
|
||||
(args.directory / "name-wrap-proof.json").write_text(json.dumps(result, ensure_ascii=False, indent=2), encoding="utf-8")
|
||||
print(json.dumps(result, ensure_ascii=True))
|
||||
raise SystemExit(0 if result["passed"] == result["total"] else 1)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user