broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    return {'count-prefix':('≥' if d['mode']=='lower' else ('?' if d['mode']=='unknown' else '')), 'count-text':('?' if d['mode']=='unknown' else str(d['count'])), 'zero-disable':(d['count']==0 and not d['selected']), 'total-source':(d['total']), 'approximate-badge':(d['mode']=='lower'), 'count-sort-ready':(d['mode']=='exact' and not d['loading'])}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'mode': 'lower', 'count': 0, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '≥', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 4, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 4, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '≥', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '≥', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 4, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 4, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False})], 2: [({'mode': 'lower', 'count': 0, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '≥', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': True}), ({'mode': 'exact', 'count': 4, 'selected': True, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': True}), ({'mode': 'lower', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '≥', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '≥', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 4, 'selected': False, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 4, 'selected': True, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': False, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False})], 3: [({'mode': 'lower', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '≥', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 0, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 0, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '≥', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 4, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 4, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 0, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '', 'count-text': '0', 'zero-disable': True, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False})], 4: [({'mode': 'lower', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '≥', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 0, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': True}), ({'mode': 'lower', 'count': 4, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 0, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '', 'count-text': '0', 'zero-disable': True, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': True}), ({'mode': 'exact', 'count': 4, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': True}), ({'mode': 'exact', 'count': 4, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': True})], 5: [({'mode': 'unknown', 'count': 0, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '0', 'zero-disable': True, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 4, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 4, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '≥', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False})]}
for index, (data, expected) in enumerate(fixtures[N]):
    check("contract fixture " + str(index), solve(data), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    return {'count-prefix':('≥' if d['mode']=='lower' else ('?' if d['mode']=='unknown' else '')), 'count-text':('?' if d['mode']=='unknown' else str(d['count'])), 'zero-disable':(d['mode']=='exact' and d['count']==0), 'total-source':(d['total']), 'approximate-badge':(d['mode']=='lower'), 'count-sort-ready':(d['mode']=='exact' and not d['loading'])}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'mode': 'lower', 'count': 0, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '≥', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 4, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 4, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '≥', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '≥', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 4, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 4, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False})], 2: [({'mode': 'lower', 'count': 0, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '≥', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': True}), ({'mode': 'exact', 'count': 4, 'selected': True, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': True}), ({'mode': 'lower', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '≥', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '≥', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 4, 'selected': False, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 4, 'selected': True, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': False, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False})], 3: [({'mode': 'lower', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '≥', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 0, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 0, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '≥', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 4, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 4, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 0, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '', 'count-text': '0', 'zero-disable': True, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False})], 4: [({'mode': 'lower', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '≥', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 0, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': True}), ({'mode': 'lower', 'count': 4, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 0, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '', 'count-text': '0', 'zero-disable': True, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': True}), ({'mode': 'exact', 'count': 4, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': True}), ({'mode': 'exact', 'count': 4, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': True})], 5: [({'mode': 'unknown', 'count': 0, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '0', 'zero-disable': True, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 4, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 4, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '≥', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False})]}
for index, (data, expected) in enumerate(fixtures[N]):
    check("contract fixture " + str(index), solve(data), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Only exact zero disables an unselected choice is violated by the widget projection.

Facet count presentations use exact, lower-bound or unknown modes; selected zero-count values remain represented and total counts are never inferred by adding overlapping facet buckets. This example checks: Only exact zero disables an unselected choice.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    return {'count-prefix':('≥' if d['mode']=='lower' else ('?' if d['mode']=='unknown' else '')), 'count-text':('?' if d['mode']=='unknown' else str(d['count'])), 'zero-disable':(d['mode']=='exact' and d['count']==0 and not d['selected']), 'total-source':(sum(d['buckets'])), 'approximate-badge':(d['mode']=='lower'), 'count-sort-ready':(d['mode']=='exact' and not d['loading'])}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'mode': 'exact', 'count': 0, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '', 'count-text': '0', 'zero-disable': True, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': True}), ({'mode': 'exact', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '0', 'zero-disable': True, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 4, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 4, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '≥', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '≥', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 4, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 4, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False})], 2: [({'mode': 'exact', 'count': 0, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '', 'count-text': '0', 'zero-disable': True, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': True}), ({'mode': 'exact', 'count': 4, 'selected': True, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': True}), ({'mode': 'lower', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '≥', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '≥', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 4, 'selected': False, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 4, 'selected': True, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': False, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False})], 3: [({'mode': 'exact', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '', 'count-text': '0', 'zero-disable': True, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': True}), ({'mode': 'exact', 'count': 4, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 0, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '≥', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 4, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 4, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 0, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '', 'count-text': '0', 'zero-disable': True, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False})], 4: [({'mode': 'exact', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '0', 'zero-disable': True, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 4, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': True}), ({'mode': 'lower', 'count': 4, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 0, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '', 'count-text': '0', 'zero-disable': True, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': True}), ({'mode': 'exact', 'count': 0, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': True}), ({'mode': 'exact', 'count': 4, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': True})], 5: [({'mode': 'exact', 'count': 0, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': True}), ({'mode': 'exact', 'count': 4, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '0', 'zero-disable': True, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 4, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '≥', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False})]}
for index, (data, expected) in enumerate(fixtures[N]):
    check("contract fixture " + str(index), solve(data), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    return {'count-prefix':('≥' if d['mode']=='lower' else ('?' if d['mode']=='unknown' else '')), 'count-text':('?' if d['mode']=='unknown' else str(d['count'])), 'zero-disable':(d['mode']=='exact' and d['count']==0 and not d['selected']), 'total-source':(max(d['buckets'],default=0)), 'approximate-badge':(d['mode']=='lower'), 'count-sort-ready':(d['mode']=='exact' and not d['loading'])}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'mode': 'exact', 'count': 0, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '', 'count-text': '0', 'zero-disable': True, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': True}), ({'mode': 'exact', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '0', 'zero-disable': True, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 4, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 4, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '≥', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '≥', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 4, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 4, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False})], 2: [({'mode': 'exact', 'count': 0, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '', 'count-text': '0', 'zero-disable': True, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': True}), ({'mode': 'exact', 'count': 4, 'selected': True, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': True}), ({'mode': 'lower', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '≥', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '≥', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 4, 'selected': False, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 4, 'selected': True, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': False, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False})], 3: [({'mode': 'exact', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '', 'count-text': '0', 'zero-disable': True, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': True}), ({'mode': 'exact', 'count': 4, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 0, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '≥', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 4, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 4, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 0, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '', 'count-text': '0', 'zero-disable': True, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False})], 4: [({'mode': 'exact', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '0', 'zero-disable': True, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 4, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': True}), ({'mode': 'lower', 'count': 4, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 0, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '', 'count-text': '0', 'zero-disable': True, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': True}), ({'mode': 'exact', 'count': 0, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': True}), ({'mode': 'exact', 'count': 4, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': True})], 5: [({'mode': 'exact', 'count': 0, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': True}), ({'mode': 'exact', 'count': 4, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '0', 'zero-disable': True, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 4, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '≥', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False})]}
for index, (data, expected) in enumerate(fixtures[N]):
    check("contract fixture " + str(index), solve(data), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Facet summary totals use supplied distinct-result totals is violated by the widget projection.

Facet count presentations use exact, lower-bound or unknown modes; selected zero-count values remain represented and total counts are never inferred by adding overlapping facet buckets. This example checks: Facet summary totals use supplied distinct-result totals.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    return {'count-prefix':('≥' if d['mode']=='lower' else ('?' if d['mode']=='unknown' else '')), 'count-text':('?' if d['mode']=='unknown' else str(d['count'])), 'zero-disable':(d['mode']=='exact' and d['count']==0 and not d['selected']), 'total-source':(d['total']), 'approximate-badge':(d['mode']!='exact'), 'count-sort-ready':(d['mode']=='exact' and not d['loading'])}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'mode': 'unknown', 'count': 0, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '≥', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 4, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 4, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '≥', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 4, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 4, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False})], 2: [({'mode': 'unknown', 'count': 0, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '≥', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 4, 'selected': True, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': True}), ({'mode': 'lower', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '≥', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 4, 'selected': False, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 4, 'selected': True, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': False, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': True, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False})], 3: [({'mode': 'unknown', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 4, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 0, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '≥', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 4, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 0, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '', 'count-text': '0', 'zero-disable': True, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 0, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False})], 4: [({'mode': 'unknown', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 4, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 0, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '', 'count-text': '0', 'zero-disable': True, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': True}), ({'mode': 'exact', 'count': 0, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': True}), ({'mode': 'exact', 'count': 4, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': True}), ({'mode': 'exact', 'count': 4, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': True})], 5: [({'mode': 'unknown', 'count': 0, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 4, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '0', 'zero-disable': True, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 4, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 4, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False})]}
for index, (data, expected) in enumerate(fixtures[N]):
    check("contract fixture " + str(index), solve(data), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    return {'count-prefix':('≥' if d['mode']=='lower' else ('?' if d['mode']=='unknown' else '')), 'count-text':('?' if d['mode']=='unknown' else str(d['count'])), 'zero-disable':(d['mode']=='exact' and d['count']==0 and not d['selected']), 'total-source':(d['total']), 'approximate-badge':(d['count']>d['total']), 'count-sort-ready':(d['mode']=='exact' and not d['loading'])}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'mode': 'unknown', 'count': 0, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '≥', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 4, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 4, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '≥', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 4, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 4, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False})], 2: [({'mode': 'unknown', 'count': 0, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '≥', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 4, 'selected': True, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': True}), ({'mode': 'lower', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '≥', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 4, 'selected': False, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 4, 'selected': True, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': False, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': True, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False})], 3: [({'mode': 'unknown', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 4, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 0, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '≥', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 4, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 0, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '', 'count-text': '0', 'zero-disable': True, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 0, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': True}, {'count-prefix': '', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False})], 4: [({'mode': 'unknown', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 4, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 0, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '', 'count-text': '0', 'zero-disable': True, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': True}), ({'mode': 'exact', 'count': 0, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': True}), ({'mode': 'exact', 'count': 4, 'selected': False, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': True}), ({'mode': 'exact', 'count': 4, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': True})], 5: [({'mode': 'unknown', 'count': 0, 'selected': True, 'total': 5, 'buckets': [3, 4], 'loading': False}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'lower', 'count': 4, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '≥', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': True, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'unknown', 'count': 4, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '?', 'count-text': '?', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 0, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '0', 'zero-disable': True, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 0, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '0', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 4, 'selected': False, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False}), ({'mode': 'exact', 'count': 4, 'selected': True, 'total': 5, 'buckets': [1], 'loading': True}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': False})]}
for index, (data, expected) in enumerate(fixtures[N]):
    check("contract fixture " + str(index), solve(data), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Approximation badges identify lower-bound count mode is violated by the widget projection.

Facet count presentations use exact, lower-bound or unknown modes; selected zero-count values remain represented and total counts are never inferred by adding overlapping facet buckets. This example checks: Approximation badges identify lower-bound count mode.

split: open-access