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']=='lower'), 'count-sort-ready':(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': [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': [3, 4], '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': False}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': True}), ({'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}), ({'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': 'lower', 'count': 0, 'selected': True, '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': 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': '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': 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': 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': 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': 'lower', 'count': 4, 'selected': False, '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': '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)

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']=='lower'), 'count-sort-ready':(d['mode']=='exact')}
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': [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': [3, 4], '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': False}, {'count-prefix': '', 'count-text': '4', 'zero-disable': False, 'total-source': 5, 'approximate-badge': False, 'count-sort-ready': True}), ({'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}), ({'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': 'lower', 'count': 0, 'selected': True, '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': 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': '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': 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': 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': 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': 'lower', 'count': 4, 'selected': False, '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': '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:
Count-based sorting activates only on settled exact counts 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: Count-based sorting activates only on settled exact counts.

split: open-access


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

N = 1
observations = []
def solve(d):
    return {'literal-preview':(d['text'].replace('*','')), 'trim-policy':(d['text'].strip() if d['trim'] else d['text']), 'case-policy':(d['text'].casefold() if d['fold'] else d['text']), 'mode-caption':({'eq':'is exactly','prefix':'starts with','contains':'contains'}[d['mode']]), 'empty-permitted':(d['text']!='' or d['mode']=='eq'), 'case-serialization':({'case_sensitive':not d['fold']})}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'text': 'a*b', 'trim': False, 'fold': False, 'mode': 'eq'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'a%b', 'trim': False, 'fold': True, 'mode': 'eq'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': '', 'trim': True, 'fold': False, 'mode': 'prefix'}, {'literal-preview': '', 'trim-policy': '', 'case-policy': '', 'mode-caption': 'starts with', 'empty-permitted': False, 'case-serialization': {'case_sensitive': True}}), ({'text': ' Ab ', 'trim': False, 'fold': False, 'mode': 'eq'}, {'literal-preview': ' Ab ', 'trim-policy': ' Ab ', 'case-policy': ' Ab ', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': ' Ab ', 'trim': False, 'fold': True, 'mode': 'contains'}, {'literal-preview': ' Ab ', 'trim-policy': ' Ab ', 'case-policy': ' ab ', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': ' Ab ', 'trim': True, 'fold': True, 'mode': 'prefix'}, {'literal-preview': ' Ab ', 'trim-policy': 'Ab', 'case-policy': ' ab ', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a*b', 'trim': False, 'fold': True, 'mode': 'eq'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a*b', 'trim': True, 'fold': False, 'mode': 'contains'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'a%b', 'trim': False, 'fold': False, 'mode': 'prefix'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'a%b', 'trim': True, 'fold': False, 'mode': 'eq'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}})], 2: [({'text': 'a*b', 'trim': False, 'fold': False, 'mode': 'prefix'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'a%b', 'trim': True, 'fold': False, 'mode': 'eq'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': ' Ab ', 'trim': False, 'fold': False, 'mode': 'contains'}, {'literal-preview': ' Ab ', 'trim-policy': ' Ab ', 'case-policy': ' Ab ', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': ' Ab ', 'trim': True, 'fold': False, 'mode': 'prefix'}, {'literal-preview': ' Ab ', 'trim-policy': 'Ab', 'case-policy': ' Ab ', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'a*b', 'trim': False, 'fold': False, 'mode': 'eq'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'a*b', 'trim': False, 'fold': True, 'mode': 'contains'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a*b', 'trim': True, 'fold': True, 'mode': 'prefix'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a%b', 'trim': False, 'fold': True, 'mode': 'eq'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a%b', 'trim': True, 'fold': False, 'mode': 'contains'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'Straße', 'trim': False, 'fold': False, 'mode': 'prefix'}, {'literal-preview': 'Straße', 'trim-policy': 'Straße', 'case-policy': 'Straße', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}})], 3: [({'text': 'a*b', 'trim': False, 'fold': False, 'mode': 'contains'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'a%b', 'trim': True, 'fold': True, 'mode': 'eq'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': ' Ab ', 'trim': True, 'fold': True, 'mode': 'eq'}, {'literal-preview': ' Ab ', 'trim-policy': 'Ab', 'case-policy': ' ab ', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a*b', 'trim': True, 'fold': False, 'mode': 'prefix'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'a%b', 'trim': False, 'fold': False, 'mode': 'eq'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'a%b', 'trim': False, 'fold': True, 'mode': 'contains'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a%b', 'trim': True, 'fold': True, 'mode': 'prefix'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'Straße', 'trim': False, 'fold': True, 'mode': 'eq'}, {'literal-preview': 'Straße', 'trim-policy': 'Straße', 'case-policy': 'strasse', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'Straße', 'trim': True, 'fold': False, 'mode': 'contains'}, {'literal-preview': 'Straße', 'trim-policy': 'Straße', 'case-policy': 'Straße', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': '', 'trim': False, 'fold': False, 'mode': 'prefix'}, {'literal-preview': '', 'trim-policy': '', 'case-policy': '', 'mode-caption': 'starts with', 'empty-permitted': False, 'case-serialization': {'case_sensitive': True}})], 4: [({'text': 'a*b', 'trim': False, 'fold': True, 'mode': 'eq'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a%b', 'trim': False, 'fold': False, 'mode': 'eq'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'a*b', 'trim': False, 'fold': True, 'mode': 'prefix'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a*b', 'trim': True, 'fold': True, 'mode': 'eq'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a%b', 'trim': False, 'fold': False, 'mode': 'contains'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'a%b', 'trim': True, 'fold': False, 'mode': 'prefix'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'Straße', 'trim': False, 'fold': False, 'mode': 'eq'}, {'literal-preview': 'Straße', 'trim-policy': 'Straße', 'case-policy': 'Straße', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'Straße', 'trim': False, 'fold': True, 'mode': 'contains'}, {'literal-preview': 'Straße', 'trim-policy': 'Straße', 'case-policy': 'strasse', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'Straße', 'trim': True, 'fold': True, 'mode': 'prefix'}, {'literal-preview': 'Straße', 'trim-policy': 'Straße', 'case-policy': 'strasse', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': '', 'trim': False, 'fold': True, 'mode': 'eq'}, {'literal-preview': '', 'trim-policy': '', 'case-policy': '', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}})], 5: [({'text': 'a*b', 'trim': False, 'fold': True, 'mode': 'prefix'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a%b', 'trim': False, 'fold': True, 'mode': 'eq'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a*b', 'trim': True, 'fold': True, 'mode': 'contains'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a%b', 'trim': False, 'fold': True, 'mode': 'prefix'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a%b', 'trim': True, 'fold': True, 'mode': 'eq'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'Straße', 'trim': False, 'fold': False, 'mode': 'contains'}, {'literal-preview': 'Straße', 'trim-policy': 'Straße', 'case-policy': 'Straße', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'Straße', 'trim': True, 'fold': False, 'mode': 'prefix'}, {'literal-preview': 'Straße', 'trim-policy': 'Straße', 'case-policy': 'Straße', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': '', 'trim': False, 'fold': False, 'mode': 'eq'}, {'literal-preview': '', 'trim-policy': '', 'case-policy': '', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': '', 'trim': False, 'fold': True, 'mode': 'contains'}, {'literal-preview': '', 'trim-policy': '', 'case-policy': '', 'mode-caption': 'contains', 'empty-permitted': False, 'case-serialization': {'case_sensitive': False}}), ({'text': '', 'trim': True, 'fold': True, 'mode': 'prefix'}, {'literal-preview': '', 'trim-policy': '', 'case-policy': '', 'mode-caption': 'starts with', 'empty-permitted': False, 'case-serialization': {'case_sensitive': 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 {'literal-preview':(d['text'].replace('%','')), 'trim-policy':(d['text'].strip() if d['trim'] else d['text']), 'case-policy':(d['text'].casefold() if d['fold'] else d['text']), 'mode-caption':({'eq':'is exactly','prefix':'starts with','contains':'contains'}[d['mode']]), 'empty-permitted':(d['text']!='' or d['mode']=='eq'), 'case-serialization':({'case_sensitive':not d['fold']})}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'text': 'a*b', 'trim': False, 'fold': False, 'mode': 'eq'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'a%b', 'trim': False, 'fold': True, 'mode': 'eq'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': '', 'trim': True, 'fold': False, 'mode': 'prefix'}, {'literal-preview': '', 'trim-policy': '', 'case-policy': '', 'mode-caption': 'starts with', 'empty-permitted': False, 'case-serialization': {'case_sensitive': True}}), ({'text': ' Ab ', 'trim': False, 'fold': False, 'mode': 'eq'}, {'literal-preview': ' Ab ', 'trim-policy': ' Ab ', 'case-policy': ' Ab ', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': ' Ab ', 'trim': False, 'fold': True, 'mode': 'contains'}, {'literal-preview': ' Ab ', 'trim-policy': ' Ab ', 'case-policy': ' ab ', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': ' Ab ', 'trim': True, 'fold': True, 'mode': 'prefix'}, {'literal-preview': ' Ab ', 'trim-policy': 'Ab', 'case-policy': ' ab ', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a*b', 'trim': False, 'fold': True, 'mode': 'eq'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a*b', 'trim': True, 'fold': False, 'mode': 'contains'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'a%b', 'trim': False, 'fold': False, 'mode': 'prefix'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'a%b', 'trim': True, 'fold': False, 'mode': 'eq'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}})], 2: [({'text': 'a*b', 'trim': False, 'fold': False, 'mode': 'prefix'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'a%b', 'trim': True, 'fold': False, 'mode': 'eq'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': ' Ab ', 'trim': False, 'fold': False, 'mode': 'contains'}, {'literal-preview': ' Ab ', 'trim-policy': ' Ab ', 'case-policy': ' Ab ', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': ' Ab ', 'trim': True, 'fold': False, 'mode': 'prefix'}, {'literal-preview': ' Ab ', 'trim-policy': 'Ab', 'case-policy': ' Ab ', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'a*b', 'trim': False, 'fold': False, 'mode': 'eq'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'a*b', 'trim': False, 'fold': True, 'mode': 'contains'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a*b', 'trim': True, 'fold': True, 'mode': 'prefix'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a%b', 'trim': False, 'fold': True, 'mode': 'eq'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a%b', 'trim': True, 'fold': False, 'mode': 'contains'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'Straße', 'trim': False, 'fold': False, 'mode': 'prefix'}, {'literal-preview': 'Straße', 'trim-policy': 'Straße', 'case-policy': 'Straße', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}})], 3: [({'text': 'a*b', 'trim': False, 'fold': False, 'mode': 'contains'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'a%b', 'trim': True, 'fold': True, 'mode': 'eq'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': ' Ab ', 'trim': True, 'fold': True, 'mode': 'eq'}, {'literal-preview': ' Ab ', 'trim-policy': 'Ab', 'case-policy': ' ab ', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a*b', 'trim': True, 'fold': False, 'mode': 'prefix'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'a%b', 'trim': False, 'fold': False, 'mode': 'eq'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'a%b', 'trim': False, 'fold': True, 'mode': 'contains'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a%b', 'trim': True, 'fold': True, 'mode': 'prefix'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'Straße', 'trim': False, 'fold': True, 'mode': 'eq'}, {'literal-preview': 'Straße', 'trim-policy': 'Straße', 'case-policy': 'strasse', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'Straße', 'trim': True, 'fold': False, 'mode': 'contains'}, {'literal-preview': 'Straße', 'trim-policy': 'Straße', 'case-policy': 'Straße', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': '', 'trim': False, 'fold': False, 'mode': 'prefix'}, {'literal-preview': '', 'trim-policy': '', 'case-policy': '', 'mode-caption': 'starts with', 'empty-permitted': False, 'case-serialization': {'case_sensitive': True}})], 4: [({'text': 'a*b', 'trim': False, 'fold': True, 'mode': 'eq'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a%b', 'trim': False, 'fold': False, 'mode': 'eq'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'a*b', 'trim': False, 'fold': True, 'mode': 'prefix'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a*b', 'trim': True, 'fold': True, 'mode': 'eq'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a%b', 'trim': False, 'fold': False, 'mode': 'contains'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'a%b', 'trim': True, 'fold': False, 'mode': 'prefix'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'Straße', 'trim': False, 'fold': False, 'mode': 'eq'}, {'literal-preview': 'Straße', 'trim-policy': 'Straße', 'case-policy': 'Straße', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'Straße', 'trim': False, 'fold': True, 'mode': 'contains'}, {'literal-preview': 'Straße', 'trim-policy': 'Straße', 'case-policy': 'strasse', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'Straße', 'trim': True, 'fold': True, 'mode': 'prefix'}, {'literal-preview': 'Straße', 'trim-policy': 'Straße', 'case-policy': 'strasse', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': '', 'trim': False, 'fold': True, 'mode': 'eq'}, {'literal-preview': '', 'trim-policy': '', 'case-policy': '', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}})], 5: [({'text': 'a*b', 'trim': False, 'fold': True, 'mode': 'prefix'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a%b', 'trim': False, 'fold': True, 'mode': 'eq'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a*b', 'trim': True, 'fold': True, 'mode': 'contains'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a%b', 'trim': False, 'fold': True, 'mode': 'prefix'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a%b', 'trim': True, 'fold': True, 'mode': 'eq'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'Straße', 'trim': False, 'fold': False, 'mode': 'contains'}, {'literal-preview': 'Straße', 'trim-policy': 'Straße', 'case-policy': 'Straße', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'Straße', 'trim': True, 'fold': False, 'mode': 'prefix'}, {'literal-preview': 'Straße', 'trim-policy': 'Straße', 'case-policy': 'Straße', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': '', 'trim': False, 'fold': False, 'mode': 'eq'}, {'literal-preview': '', 'trim-policy': '', 'case-policy': '', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': '', 'trim': False, 'fold': True, 'mode': 'contains'}, {'literal-preview': '', 'trim-policy': '', 'case-policy': '', 'mode-caption': 'contains', 'empty-permitted': False, 'case-serialization': {'case_sensitive': False}}), ({'text': '', 'trim': True, 'fold': True, 'mode': 'prefix'}, {'literal-preview': '', 'trim-policy': '', 'case-policy': '', 'mode-caption': 'starts with', 'empty-permitted': False, 'case-serialization': {'case_sensitive': 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:
Literal text operands preserve wildcard-looking punctuation is violated by the widget projection.

Text filters distinguish exact, prefix and contains modes; literal punctuation remains literal, and trimming and case policy are explicit editor options. This example checks: Literal text operands preserve wildcard-looking punctuation.

split: open-access


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

N = 1
observations = []
def solve(d):
    return {'literal-preview':(d['text']), 'trim-policy':(d['text'].strip()), 'case-policy':(d['text'].casefold() if d['fold'] else d['text']), 'mode-caption':({'eq':'is exactly','prefix':'starts with','contains':'contains'}[d['mode']]), 'empty-permitted':(d['text']!='' or d['mode']=='eq'), 'case-serialization':({'case_sensitive':not d['fold']})}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'text': ' Ab ', 'trim': False, 'fold': False, 'mode': 'eq'}, {'literal-preview': ' Ab ', 'trim-policy': ' Ab ', 'case-policy': ' Ab ', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': ' Ab ', 'trim': True, 'fold': True, 'mode': 'eq'}, {'literal-preview': ' Ab ', 'trim-policy': 'Ab', 'case-policy': ' ab ', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': '', 'trim': True, 'fold': False, 'mode': 'prefix'}, {'literal-preview': '', 'trim-policy': '', 'case-policy': '', 'mode-caption': 'starts with', 'empty-permitted': False, 'case-serialization': {'case_sensitive': True}}), ({'text': ' Ab ', 'trim': False, 'fold': True, 'mode': 'contains'}, {'literal-preview': ' Ab ', 'trim-policy': ' Ab ', 'case-policy': ' ab ', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': ' Ab ', 'trim': True, 'fold': True, 'mode': 'prefix'}, {'literal-preview': ' Ab ', 'trim-policy': 'Ab', 'case-policy': ' ab ', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a*b', 'trim': False, 'fold': True, 'mode': 'eq'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a*b', 'trim': True, 'fold': False, 'mode': 'contains'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'a%b', 'trim': False, 'fold': False, 'mode': 'prefix'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'a%b', 'trim': True, 'fold': False, 'mode': 'eq'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'a%b', 'trim': True, 'fold': True, 'mode': 'contains'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}})], 2: [({'text': ' Ab ', 'trim': False, 'fold': False, 'mode': 'prefix'}, {'literal-preview': ' Ab ', 'trim-policy': ' Ab ', 'case-policy': ' Ab ', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': ' Ab ', 'trim': True, 'fold': False, 'mode': 'eq'}, {'literal-preview': ' Ab ', 'trim-policy': 'Ab', 'case-policy': ' Ab ', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': ' Ab ', 'trim': False, 'fold': False, 'mode': 'contains'}, {'literal-preview': ' Ab ', 'trim-policy': ' Ab ', 'case-policy': ' Ab ', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': ' Ab ', 'trim': True, 'fold': False, 'mode': 'prefix'}, {'literal-preview': ' Ab ', 'trim-policy': 'Ab', 'case-policy': ' Ab ', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'a*b', 'trim': False, 'fold': False, 'mode': 'eq'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'a*b', 'trim': False, 'fold': True, 'mode': 'contains'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a*b', 'trim': True, 'fold': True, 'mode': 'prefix'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a%b', 'trim': False, 'fold': True, 'mode': 'eq'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a%b', 'trim': True, 'fold': False, 'mode': 'contains'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'Straße', 'trim': False, 'fold': False, 'mode': 'prefix'}, {'literal-preview': 'Straße', 'trim-policy': 'Straße', 'case-policy': 'Straße', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}})], 3: [({'text': ' Ab ', 'trim': False, 'fold': False, 'mode': 'contains'}, {'literal-preview': ' Ab ', 'trim-policy': ' Ab ', 'case-policy': ' Ab ', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': ' Ab ', 'trim': True, 'fold': True, 'mode': 'eq'}, {'literal-preview': ' Ab ', 'trim-policy': 'Ab', 'case-policy': ' ab ', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a*b', 'trim': False, 'fold': False, 'mode': 'contains'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'a*b', 'trim': True, 'fold': False, 'mode': 'prefix'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'a%b', 'trim': False, 'fold': False, 'mode': 'eq'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'a%b', 'trim': False, 'fold': True, 'mode': 'contains'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a%b', 'trim': True, 'fold': True, 'mode': 'prefix'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'Straße', 'trim': False, 'fold': True, 'mode': 'eq'}, {'literal-preview': 'Straße', 'trim-policy': 'Straße', 'case-policy': 'strasse', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'Straße', 'trim': True, 'fold': False, 'mode': 'contains'}, {'literal-preview': 'Straße', 'trim-policy': 'Straße', 'case-policy': 'Straße', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': '', 'trim': False, 'fold': False, 'mode': 'prefix'}, {'literal-preview': '', 'trim-policy': '', 'case-policy': '', 'mode-caption': 'starts with', 'empty-permitted': False, 'case-serialization': {'case_sensitive': True}})], 4: [({'text': ' Ab ', 'trim': False, 'fold': True, 'mode': 'eq'}, {'literal-preview': ' Ab ', 'trim-policy': ' Ab ', 'case-policy': ' ab ', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': ' Ab ', 'trim': True, 'fold': False, 'mode': 'eq'}, {'literal-preview': ' Ab ', 'trim-policy': 'Ab', 'case-policy': ' Ab ', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'a*b', 'trim': False, 'fold': True, 'mode': 'prefix'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a*b', 'trim': True, 'fold': True, 'mode': 'eq'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a%b', 'trim': False, 'fold': False, 'mode': 'contains'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'a%b', 'trim': True, 'fold': False, 'mode': 'prefix'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'Straße', 'trim': False, 'fold': False, 'mode': 'eq'}, {'literal-preview': 'Straße', 'trim-policy': 'Straße', 'case-policy': 'Straße', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'Straße', 'trim': False, 'fold': True, 'mode': 'contains'}, {'literal-preview': 'Straße', 'trim-policy': 'Straße', 'case-policy': 'strasse', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'Straße', 'trim': True, 'fold': True, 'mode': 'prefix'}, {'literal-preview': 'Straße', 'trim-policy': 'Straße', 'case-policy': 'strasse', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': '', 'trim': False, 'fold': True, 'mode': 'eq'}, {'literal-preview': '', 'trim-policy': '', 'case-policy': '', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}})], 5: [({'text': ' Ab ', 'trim': False, 'fold': True, 'mode': 'prefix'}, {'literal-preview': ' Ab ', 'trim-policy': ' Ab ', 'case-policy': ' ab ', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': ' Ab ', 'trim': True, 'fold': True, 'mode': 'eq'}, {'literal-preview': ' Ab ', 'trim-policy': 'Ab', 'case-policy': ' ab ', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a*b', 'trim': True, 'fold': True, 'mode': 'contains'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a%b', 'trim': False, 'fold': True, 'mode': 'prefix'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a%b', 'trim': True, 'fold': True, 'mode': 'eq'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'Straße', 'trim': False, 'fold': False, 'mode': 'contains'}, {'literal-preview': 'Straße', 'trim-policy': 'Straße', 'case-policy': 'Straße', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'Straße', 'trim': True, 'fold': False, 'mode': 'prefix'}, {'literal-preview': 'Straße', 'trim-policy': 'Straße', 'case-policy': 'Straße', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': '', 'trim': False, 'fold': False, 'mode': 'eq'}, {'literal-preview': '', 'trim-policy': '', 'case-policy': '', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': '', 'trim': False, 'fold': True, 'mode': 'contains'}, {'literal-preview': '', 'trim-policy': '', 'case-policy': '', 'mode-caption': 'contains', 'empty-permitted': False, 'case-serialization': {'case_sensitive': False}}), ({'text': '', 'trim': True, 'fold': True, 'mode': 'prefix'}, {'literal-preview': '', 'trim-policy': '', 'case-policy': '', 'mode-caption': 'starts with', 'empty-permitted': False, 'case-serialization': {'case_sensitive': 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 {'literal-preview':(d['text']), 'trim-policy':(d['text']), 'case-policy':(d['text'].casefold() if d['fold'] else d['text']), 'mode-caption':({'eq':'is exactly','prefix':'starts with','contains':'contains'}[d['mode']]), 'empty-permitted':(d['text']!='' or d['mode']=='eq'), 'case-serialization':({'case_sensitive':not d['fold']})}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'text': ' Ab ', 'trim': False, 'fold': False, 'mode': 'eq'}, {'literal-preview': ' Ab ', 'trim-policy': ' Ab ', 'case-policy': ' Ab ', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': ' Ab ', 'trim': True, 'fold': True, 'mode': 'eq'}, {'literal-preview': ' Ab ', 'trim-policy': 'Ab', 'case-policy': ' ab ', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': '', 'trim': True, 'fold': False, 'mode': 'prefix'}, {'literal-preview': '', 'trim-policy': '', 'case-policy': '', 'mode-caption': 'starts with', 'empty-permitted': False, 'case-serialization': {'case_sensitive': True}}), ({'text': ' Ab ', 'trim': False, 'fold': True, 'mode': 'contains'}, {'literal-preview': ' Ab ', 'trim-policy': ' Ab ', 'case-policy': ' ab ', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': ' Ab ', 'trim': True, 'fold': True, 'mode': 'prefix'}, {'literal-preview': ' Ab ', 'trim-policy': 'Ab', 'case-policy': ' ab ', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a*b', 'trim': False, 'fold': True, 'mode': 'eq'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a*b', 'trim': True, 'fold': False, 'mode': 'contains'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'a%b', 'trim': False, 'fold': False, 'mode': 'prefix'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'a%b', 'trim': True, 'fold': False, 'mode': 'eq'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'a%b', 'trim': True, 'fold': True, 'mode': 'contains'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}})], 2: [({'text': ' Ab ', 'trim': False, 'fold': False, 'mode': 'prefix'}, {'literal-preview': ' Ab ', 'trim-policy': ' Ab ', 'case-policy': ' Ab ', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': ' Ab ', 'trim': True, 'fold': False, 'mode': 'eq'}, {'literal-preview': ' Ab ', 'trim-policy': 'Ab', 'case-policy': ' Ab ', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': ' Ab ', 'trim': False, 'fold': False, 'mode': 'contains'}, {'literal-preview': ' Ab ', 'trim-policy': ' Ab ', 'case-policy': ' Ab ', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': ' Ab ', 'trim': True, 'fold': False, 'mode': 'prefix'}, {'literal-preview': ' Ab ', 'trim-policy': 'Ab', 'case-policy': ' Ab ', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'a*b', 'trim': False, 'fold': False, 'mode': 'eq'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'a*b', 'trim': False, 'fold': True, 'mode': 'contains'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a*b', 'trim': True, 'fold': True, 'mode': 'prefix'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a%b', 'trim': False, 'fold': True, 'mode': 'eq'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a%b', 'trim': True, 'fold': False, 'mode': 'contains'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'Straße', 'trim': False, 'fold': False, 'mode': 'prefix'}, {'literal-preview': 'Straße', 'trim-policy': 'Straße', 'case-policy': 'Straße', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}})], 3: [({'text': ' Ab ', 'trim': False, 'fold': False, 'mode': 'contains'}, {'literal-preview': ' Ab ', 'trim-policy': ' Ab ', 'case-policy': ' Ab ', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': ' Ab ', 'trim': True, 'fold': True, 'mode': 'eq'}, {'literal-preview': ' Ab ', 'trim-policy': 'Ab', 'case-policy': ' ab ', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a*b', 'trim': False, 'fold': False, 'mode': 'contains'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'a*b', 'trim': True, 'fold': False, 'mode': 'prefix'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'a%b', 'trim': False, 'fold': False, 'mode': 'eq'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'a%b', 'trim': False, 'fold': True, 'mode': 'contains'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a%b', 'trim': True, 'fold': True, 'mode': 'prefix'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'Straße', 'trim': False, 'fold': True, 'mode': 'eq'}, {'literal-preview': 'Straße', 'trim-policy': 'Straße', 'case-policy': 'strasse', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'Straße', 'trim': True, 'fold': False, 'mode': 'contains'}, {'literal-preview': 'Straße', 'trim-policy': 'Straße', 'case-policy': 'Straße', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': '', 'trim': False, 'fold': False, 'mode': 'prefix'}, {'literal-preview': '', 'trim-policy': '', 'case-policy': '', 'mode-caption': 'starts with', 'empty-permitted': False, 'case-serialization': {'case_sensitive': True}})], 4: [({'text': ' Ab ', 'trim': False, 'fold': True, 'mode': 'eq'}, {'literal-preview': ' Ab ', 'trim-policy': ' Ab ', 'case-policy': ' ab ', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': ' Ab ', 'trim': True, 'fold': False, 'mode': 'eq'}, {'literal-preview': ' Ab ', 'trim-policy': 'Ab', 'case-policy': ' Ab ', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'a*b', 'trim': False, 'fold': True, 'mode': 'prefix'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a*b', 'trim': True, 'fold': True, 'mode': 'eq'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a%b', 'trim': False, 'fold': False, 'mode': 'contains'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'a%b', 'trim': True, 'fold': False, 'mode': 'prefix'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'Straße', 'trim': False, 'fold': False, 'mode': 'eq'}, {'literal-preview': 'Straße', 'trim-policy': 'Straße', 'case-policy': 'Straße', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'Straße', 'trim': False, 'fold': True, 'mode': 'contains'}, {'literal-preview': 'Straße', 'trim-policy': 'Straße', 'case-policy': 'strasse', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'Straße', 'trim': True, 'fold': True, 'mode': 'prefix'}, {'literal-preview': 'Straße', 'trim-policy': 'Straße', 'case-policy': 'strasse', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': '', 'trim': False, 'fold': True, 'mode': 'eq'}, {'literal-preview': '', 'trim-policy': '', 'case-policy': '', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}})], 5: [({'text': ' Ab ', 'trim': False, 'fold': True, 'mode': 'prefix'}, {'literal-preview': ' Ab ', 'trim-policy': ' Ab ', 'case-policy': ' ab ', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': ' Ab ', 'trim': True, 'fold': True, 'mode': 'eq'}, {'literal-preview': ' Ab ', 'trim-policy': 'Ab', 'case-policy': ' ab ', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a*b', 'trim': True, 'fold': True, 'mode': 'contains'}, {'literal-preview': 'a*b', 'trim-policy': 'a*b', 'case-policy': 'a*b', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a%b', 'trim': False, 'fold': True, 'mode': 'prefix'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'a%b', 'trim': True, 'fold': True, 'mode': 'eq'}, {'literal-preview': 'a%b', 'trim-policy': 'a%b', 'case-policy': 'a%b', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': False}}), ({'text': 'Straße', 'trim': False, 'fold': False, 'mode': 'contains'}, {'literal-preview': 'Straße', 'trim-policy': 'Straße', 'case-policy': 'Straße', 'mode-caption': 'contains', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': 'Straße', 'trim': True, 'fold': False, 'mode': 'prefix'}, {'literal-preview': 'Straße', 'trim-policy': 'Straße', 'case-policy': 'Straße', 'mode-caption': 'starts with', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': '', 'trim': False, 'fold': False, 'mode': 'eq'}, {'literal-preview': '', 'trim-policy': '', 'case-policy': '', 'mode-caption': 'is exactly', 'empty-permitted': True, 'case-serialization': {'case_sensitive': True}}), ({'text': '', 'trim': False, 'fold': True, 'mode': 'contains'}, {'literal-preview': '', 'trim-policy': '', 'case-policy': '', 'mode-caption': 'contains', 'empty-permitted': False, 'case-serialization': {'case_sensitive': False}}), ({'text': '', 'trim': True, 'fold': True, 'mode': 'prefix'}, {'literal-preview': '', 'trim-policy': '', 'case-policy': '', 'mode-caption': 'starts with', 'empty-permitted': False, 'case-serialization': {'case_sensitive': 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:
Text normalization honors the selected trim policy is violated by the widget projection.

Text filters distinguish exact, prefix and contains modes; literal punctuation remains literal, and trimming and case policy are explicit editor options. This example checks: Text normalization honors the selected trim policy.

split: open-access