Datasets:
Download source/tests/test_pilot_fixed.py from Syndicate604/skills-desk: direct link, hf CLI and curl.
- Browser
- Download file 1.03 kB
-
https://huggingface.co/datasets/Syndicate604/skills-desk/resolve/main/source/tests/test_pilot_fixed.py
- Command line
-
hf download hf://datasets/Syndicate604/skills-desk/source/tests/test_pilot_fixed.py
-
curl -L -o test_pilot_fixed.py https://huggingface.co/datasets/Syndicate604/skills-desk/resolve/main/source/tests/test_pilot_fixed.py
1.03 kB
| """The ten pilot tasks (L1) are a recorded experiment: their instances must not change. The | |
| fingerprints were computed inside the pilot image (sha256:7158ba87...).""" | |
| import hashlib | |
| import json | |
| import os | |
| import random | |
| import pytest | |
| from terminal_desk.families import ALL_FAMILIES, instance_seed | |
| PINNED = json.load(open(os.path.join(os.path.dirname(__file__), "fixtures", "pilot_fingerprints.json"))) | |
| def fingerprint(task_id: str) -> str: | |
| base = task_id.rsplit("-i", 1)[0] if "-i" in task_id.rsplit("-L", 1)[1] else task_id | |
| fid, lv = base.rsplit("-L", 1) | |
| b = ALL_FAMILIES[fid].build(int(lv), random.Random(instance_seed(task_id))) | |
| h = hashlib.sha256(b.instruction.encode()) | |
| for name in sorted(b.files): | |
| c = b.files[name] | |
| h.update(name.encode()) | |
| h.update(c if isinstance(c, bytes) else c.encode()) | |
| return h.hexdigest()[:16] | |
| def test_pilot_instance_unchanged(task_id): | |
| assert fingerprint(task_id) == PINNED[task_id] | |