Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-bridge/blob/main/tests/refusals.py # omega-bridge Omega-first language interoperability: checked conversion backends and native language bindings Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-bridge / tests / refusals.py` 28 lines ยท 1625 bytes Raw Blame History 1 """Refusal parity with pinned Omega frontend and explicit backend capability errors.""" 2 import pathlib, subprocess, os, json, sys 3 root=pathlib.Path(__file__).resolve().parents[1];os.chdir(root) 4 seed=os.environ.get('OMEGA_SEED','build/bootstrap/omc') 5 rows=json.loads(pathlib.Path('tests/refusals.json').read_text()) 6 for name in ('r5b_assign','r5b_cycle'): 7 rows.append(dict(name=name,source=pathlib.Path(f'tests/fixtures/{name}.om').read_text())) 8 fail=0 9 for row in rows: 10 try: 11 data=row['source'].encode() 12 p=subprocess.run([seed],input=data,capture_output=True,timeout=10) 13 if 'backend_error' in row: 14 assert p.returncode==0,('native rejected capability probe',p.returncode,p.stderr) 15 want=row['backend_error'] 16 else: 17 want=row.get('error',p.returncode) 18 if want is None: want=p.returncode 19 assert 0< p.returncode < 100 and p.returncode==want,('seed',want,p.returncode,p.stderr) 20 path=pathlib.Path('build/refusal.om');path.write_bytes(data) 21 for target in ('c','python'): 22 got=(subprocess.run(['build/toc'],input=data,capture_output=True,timeout=10) if '--baseline' in sys.argv else subprocess.run(['tools/bridge',target,str(path)],capture_output=True,timeout=10)) 23 assert got.returncode==want and not got.stdout and f'error {want}'.encode() in got.stderr,(target,want,got.returncode,got.stderr) 24 print('PASS',row['name'],want) 25 except Exception as e: 26 fail+=1;print('FAIL',row['name'],e) 27 print(f'refusal cases={len(rows)} failures={fail} RC={int(bool(fail))}') 28 sys.exit(bool(fail))