#!/usr/bin/env python3 """Standalone synthetic fixture; standard library only. No network, credentials or user paths.""" import json, math, statistics, sys, platform, datetime def wilson(k,n,z=1.959963984540054): if n<=0 or not 0<=k<=n:raise ValueError('invalid count') p=k/n;d=1+z*z/n;c=(p+z*z/(2*n))/d;h=z*math.sqrt(p*(1-p)/n+z*z/(4*n*n))/d return {'successes':k,'trials':n,'rate':p,'low':max(0,c-h),'high':min(1,c+h),'method':'Wilson score, two-sided nominal95%'} rows=[wilson(k,n) for k,n in [(2,10),(20,100),(0,10),(10,10)]] blocked=[] for k,n in [(0,0),(11,10),(-1,10)]: try:wilson(k,n) except ValueError:blocked.append([k,n]) wald=[] for k,n in [(2,10),(0,10),(10,10)]: p=k/n;h=1.959963984540054*math.sqrt(p*(1-p)/n);wald.append({'successes':k,'trials':n,'low':p-h,'high':p+h}) result={'rows':rows,'invalidBlocked':blocked,'z':1.959963984540054,'waldUnclippedContrast':wald} assert rows[0]['high']-rows[0]['low']>rows[1]['high']-rows[1]['low'] and rows[2]['high']>0 print(json.dumps({"fixtureCreatedOn":"2026-10-15","executedAt":datetime.datetime.now(datetime.timezone.utc).isoformat(),"synthetic":True,"runtime":platform.python_version(),"result":result},ensure_ascii=False,indent=2))