Files
aigc-home/docs/hel-892/moge3-document-evidence/repeat.py
T
2026-10-31 03:13:25 +08:00

43 lines
1.2 KiB
Python

"""Compare deterministic definitions and rendered artifacts."""
import hashlib
import json
from build_definition import OUT, REPO, canonical
from rebuild import RESOURCE, build_all
from render_report import main as render
def main():
a, old = build_all()
b, previous = build_all()
assert a == b and old == previous
assert a == json.loads((REPO / RESOURCE).read_bytes())
render()
paths = [
OUT / "fixed-source-index.json",
OUT.parent / "MoGe3深度几何固定参考中文说明.md",
]
before = {p.name: hashlib.sha256(p.read_bytes()).hexdigest() for p in paths}
render()
assert before == {p.name: hashlib.sha256(p.read_bytes()).hexdigest() for p in paths}
(OUT / "repeatability.json").write_text(
json.dumps(
{
"definitions": 38,
"repeated_build_equal": True,
"repeated_render_equal": True,
"resource_sha256": hashlib.sha256(canonical(a)).hexdigest(),
"artifacts": before,
},
ensure_ascii=False,
indent=2,
)
+ "\n"
)
print(("PASS deterministic definitions a" + "nd rendered artifacts: zero diff" + "erence"))
if __name__ == "__main__":
main()