run_verify.py

back to table · edit · history · where entries came from · files · download

1159 bytes, as of the version from 2026-11-27 21:40 (current). Recorded here, not run.

import sys,json
import numberdb.sage as numberdb
from sage.rings.padics.factory import Qp
from numberdb._write import to_text
import generate,independent_check
key=sys.stdin.read().strip()
if '=' in key and key.split('=',1)[0].isupper():key=key.split('=',1)[1].strip().strip('\'"')
numberdb.configure(api_key=key)
g=generate.PlasticRoots();report=g.verify(sample=None)
result={name:getattr(report,name) for name in ['table','checked','matched','differing','missing','extra','coarser','refined']}
assert report.checked==9 and report.matched==9 and not report.differing and not report.missing and not report.extra and not report.coarser
print('VERIFY_JSON='+json.dumps(result))
doc=json.load(open('/work/stored-document.json'))
checked=independent_check.run(doc);print('STORED_CHECK_JSON='+json.dumps(checked))
namespace={'Qp':Qp};exec(doc['Programs']['sage-branch']['code'],namespace)
assert to_text(namespace['z'])==to_text(g.value({'p':59,'k':1,'a':13},100))
assert int(namespace['z'].precision_absolute())==57
print('PROGRAM_JSON='+json.dumps({'displayed_sage_example_matches':True,'absolute_precision':57,'all_stored_entries_independently_checked':True}))