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

N = 1
observations = []
def solve(d):
    return {'lower-clamp':(min(d['new'],d['hi']) if d['lock'] and d['hi'] is not None else d['new']), 'upper-clamp':(max(d['new'],d['lo']) if d['lock'] and d['lo'] is not None else d['new']), 'linked-upper':(d['hi']+d['new']-d['lo'] if d['linked'] and d['hi'] is not None and d['lo'] is not None else d['hi']), 'linked-lower':(d['lo']+d['new']-d['hi'] if d['linked'] and d['hi'] is not None and d['lo'] is not None else d['lo']), 'link-enabled':(d['lo'] is not None and d['hi'] is not None), 'reversal-warning':(d['lo'] is not None and d['hi'] is not None and d['lo']>=d['hi'])}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'lo': 5, 'hi': 5, 'new': -1, 'lock': False, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 5, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': -1, 'lock': True, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': 5, 'linked-upper': -4, 'linked-lower': 2, 'link-enabled': True, 'reversal-warning': True}), ({'lo': None, 'hi': None, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 2, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': 7, 'lock': True, 'linked': False}, {'lower-clamp': 5, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 2, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 4, 'linked-lower': -6, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 7, 'lock': True, 'linked': False}, {'lower-clamp': 5, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False})], 2: [({'lo': 5, 'hi': 5, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': -1, 'linked-lower': -1, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': 1, 'lock': True, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 5, 'linked-upper': 2, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': True}), ({'lo': None, 'hi': 2, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 2, 'new': 7, 'lock': True, 'linked': True}, {'lower-clamp': 2, 'upper-clamp': 7, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': 7, 'lock': False, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': 0, 'linked-upper': 2, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 7, 'lock': True, 'linked': True}, {'lower-clamp': 2, 'upper-clamp': 7, 'linked-upper': 9, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 7, 'lock': False, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False})], 3: [({'lo': 5, 'hi': 5, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': 5, 'linked-upper': 5, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': 7, 'lock': False, 'linked': True}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 4, 'linked-lower': 10, 'link-enabled': True, 'reversal-warning': True}), ({'lo': None, 'hi': 2, 'new': 7, 'lock': False, 'linked': True}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': 1, 'lock': True, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': -1, 'lock': True, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': 0, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': -1, 'lock': False, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 2, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 7, 'lock': False, 'linked': True}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 9, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 1, 'lock': True, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': -1, 'lock': True, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': 5, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': -1, 'lock': False, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 2, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': True})], 4: [({'lo': 5, 'hi': 5, 'new': -1, 'lock': True, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': 5, 'linked-upper': -1, 'linked-lower': -1, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': -1, 'lock': False, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 2, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': True}), ({'lo': None, 'hi': 5, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': 7, 'lock': True, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 3, 'linked-lower': -1, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': 7, 'lock': True, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 5, 'linked-upper': -2, 'linked-lower': 4, 'link-enabled': True, 'reversal-warning': True})], 5: [({'lo': 5, 'hi': 5, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 5, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': -1, 'lock': True, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': 5, 'linked-upper': -4, 'linked-lower': 2, 'link-enabled': True, 'reversal-warning': True}), ({'lo': None, 'hi': 5, 'new': 7, 'lock': True, 'linked': True}, {'lower-clamp': 5, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': 7, 'lock': False, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 3, 'linked-lower': -1, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': 0, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 7, 'lock': True, 'linked': True}, {'lower-clamp': 5, 'upper-clamp': 7, 'linked-upper': 12, 'linked-lower': 2, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': 7, 'lock': False, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': -2, 'linked-lower': 4, 'link-enabled': True, 'reversal-warning': True}), ({'lo': 5, 'hi': 5, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': 5, 'linked-upper': 5, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': 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 {'lower-clamp':(min(d['new'],d['hi']) if d['lock'] and d['hi'] is not None else d['new']), 'upper-clamp':(max(d['new'],d['lo']) if d['lock'] and d['lo'] is not None else d['new']), 'linked-upper':(d['hi']+d['new']-d['lo'] if d['linked'] and d['hi'] is not None and d['lo'] is not None else d['hi']), 'linked-lower':(d['lo']+d['new']-d['hi'] if d['linked'] and d['hi'] is not None and d['lo'] is not None else d['lo']), 'link-enabled':(d['lo'] is not None and d['hi'] is not None), 'reversal-warning':(False)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'lo': 5, 'hi': 5, 'new': -1, 'lock': False, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 5, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': -1, 'lock': True, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': 5, 'linked-upper': -4, 'linked-lower': 2, 'link-enabled': True, 'reversal-warning': True}), ({'lo': None, 'hi': None, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 2, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': 7, 'lock': True, 'linked': False}, {'lower-clamp': 5, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 2, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 4, 'linked-lower': -6, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 7, 'lock': True, 'linked': False}, {'lower-clamp': 5, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False})], 2: [({'lo': 5, 'hi': 5, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': -1, 'linked-lower': -1, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': 1, 'lock': True, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 5, 'linked-upper': 2, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': True}), ({'lo': None, 'hi': 2, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 2, 'new': 7, 'lock': True, 'linked': True}, {'lower-clamp': 2, 'upper-clamp': 7, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': 7, 'lock': False, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': 0, 'linked-upper': 2, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 7, 'lock': True, 'linked': True}, {'lower-clamp': 2, 'upper-clamp': 7, 'linked-upper': 9, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 7, 'lock': False, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False})], 3: [({'lo': 5, 'hi': 5, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': 5, 'linked-upper': 5, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': 7, 'lock': False, 'linked': True}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 4, 'linked-lower': 10, 'link-enabled': True, 'reversal-warning': True}), ({'lo': None, 'hi': 2, 'new': 7, 'lock': False, 'linked': True}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 2, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': None, 'hi': 5, 'new': 1, 'lock': True, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': -1, 'lock': True, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': 0, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': -1, 'lock': False, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 2, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 7, 'lock': False, 'linked': True}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': 9, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 1, 'lock': True, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': -1, 'lock': True, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': 5, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': -1, 'lock': False, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 2, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': True})], 4: [({'lo': 5, 'hi': 5, 'new': -1, 'lock': True, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': 5, 'linked-upper': -1, 'linked-lower': -1, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': -1, 'lock': False, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': 2, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': True}), ({'lo': None, 'hi': 5, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': 7, 'lock': True, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 3, 'linked-lower': -1, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': -1, 'lock': False, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': -1, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': 7, 'lock': True, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': 1, 'lock': True, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 5, 'linked-upper': -2, 'linked-lower': 4, 'link-enabled': True, 'reversal-warning': True})], 5: [({'lo': 5, 'hi': 5, 'new': 1, 'lock': False, 'linked': False}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 5, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': -1, 'lock': True, 'linked': True}, {'lower-clamp': -1, 'upper-clamp': 5, 'linked-upper': -4, 'linked-lower': 2, 'link-enabled': True, 'reversal-warning': True}), ({'lo': None, 'hi': 5, 'new': 7, 'lock': True, 'linked': True}, {'lower-clamp': 5, 'upper-clamp': 7, 'linked-upper': 5, 'linked-lower': None, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': None, 'new': 7, 'lock': False, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': 0, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 0, 'hi': 2, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': 3, 'linked-lower': -1, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': 0, 'linked-upper': 5, 'linked-lower': 0, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 0, 'hi': 5, 'new': 7, 'lock': True, 'linked': True}, {'lower-clamp': 5, 'upper-clamp': 7, 'linked-upper': 12, 'linked-lower': 2, 'link-enabled': True, 'reversal-warning': False}), ({'lo': 5, 'hi': None, 'new': 7, 'lock': False, 'linked': False}, {'lower-clamp': 7, 'upper-clamp': 7, 'linked-upper': None, 'linked-lower': 5, 'link-enabled': False, 'reversal-warning': False}), ({'lo': 5, 'hi': 2, 'new': 1, 'lock': False, 'linked': True}, {'lower-clamp': 1, 'upper-clamp': 1, 'linked-upper': -2, 'linked-lower': 4, 'link-enabled': True, 'reversal-warning': True}), ({'lo': 5, 'hi': 5, 'new': -1, 'lock': True, 'linked': False}, {'lower-clamp': -1, 'upper-clamp': 5, 'linked-upper': 5, 'linked-lower': 5, 'link-enabled': True, 'reversal-warning': 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:
Reversed draft ranges show an error while equal endpoints remain valid is violated by the widget projection.

Editing one numeric endpoint clamps only when the range lock is enabled; linked-width edits translate the opposite endpoint, and unbounded sides remain unbounded. This example checks: Reversed draft ranges show an error while equal endpoints remain valid.

split: open-access


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

N = 1
observations = []
def solve(d):
    return {'lower-index':(0), 'upper-index':(d['options'].index(d['hi']) if d['hi'] in d['options'] else None), 'range-order':(d['lo'] in d['options'] and d['hi'] in d['options'] and d['options'].index(d['lo'])<=d['options'].index(d['hi'])), 'endpoint-payload':([d['lo'],d['hi']]), 'unresolved-endpoints':([x for x in (d['lo'],d['hi']) if x not in d['options']]), 'full-domain':(bool(d['options']) and d['lo']==d['options'][0] and d['hi']==d['options'][-1])}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'options': ['small', 'medium', 'large'], 'lo': 'medium', 'hi': 'small'}, {'lower-index': 1, 'upper-index': 0, 'range-order': False, 'endpoint-payload': ['medium', 'small'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'small', 'hi': 'small'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['small', 'small'], 'unresolved-endpoints': ['small', 'small'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'large', 'hi': 'large'}, {'lower-index': 2, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['large', 'large'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'z', 'hi': 'small'}, {'lower-index': None, 'upper-index': 0, 'range-order': False, 'endpoint-payload': ['z', 'small'], 'unresolved-endpoints': ['z'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'z', 'hi': 'a'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['z', 'a'], 'unresolved-endpoints': ['z', 'a'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'small', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['small', 'large'], 'unresolved-endpoints': ['small', 'large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'medium', 'hi': 'small'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['medium', 'small'], 'unresolved-endpoints': ['medium', 'small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'medium', 'hi': 'a'}, {'lower-index': None, 'upper-index': 1, 'range-order': False, 'endpoint-payload': ['medium', 'a'], 'unresolved-endpoints': ['medium'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'large', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['large', 'large'], 'unresolved-endpoints': ['large', 'large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'z', 'hi': 'small'}, {'lower-index': 0, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['z', 'small'], 'unresolved-endpoints': ['small'], 'full-domain': False})], 2: [({'options': ['small', 'medium', 'large'], 'lo': 'medium', 'hi': 'large'}, {'lower-index': 1, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['medium', 'large'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'medium', 'hi': 'small'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['medium', 'small'], 'unresolved-endpoints': ['medium', 'small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'small', 'hi': 'a'}, {'lower-index': None, 'upper-index': 1, 'range-order': False, 'endpoint-payload': ['small', 'a'], 'unresolved-endpoints': ['small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'medium', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['medium', 'large'], 'unresolved-endpoints': ['medium', 'large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'large', 'hi': 'small'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['large', 'small'], 'unresolved-endpoints': ['large', 'small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'large', 'hi': 'a'}, {'lower-index': None, 'upper-index': 1, 'range-order': False, 'endpoint-payload': ['large', 'a'], 'unresolved-endpoints': ['large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'z', 'hi': 'large'}, {'lower-index': 0, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['z', 'large'], 'unresolved-endpoints': ['large'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'small', 'hi': 'small'}, {'lower-index': 0, 'upper-index': 0, 'range-order': True, 'endpoint-payload': ['small', 'small'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'small', 'hi': 'a'}, {'lower-index': 0, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['small', 'a'], 'unresolved-endpoints': ['a'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'large', 'hi': 'small'}, {'lower-index': 2, 'upper-index': 0, 'range-order': False, 'endpoint-payload': ['large', 'small'], 'unresolved-endpoints': [], 'full-domain': False})], 3: [({'options': ['small', 'medium', 'large'], 'lo': 'medium', 'hi': 'a'}, {'lower-index': 1, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['medium', 'a'], 'unresolved-endpoints': ['a'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'large', 'hi': 'small'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['large', 'small'], 'unresolved-endpoints': ['large', 'small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'z', 'hi': 'small'}, {'lower-index': 0, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['z', 'small'], 'unresolved-endpoints': ['small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'z', 'hi': 'a'}, {'lower-index': 0, 'upper-index': 1, 'range-order': True, 'endpoint-payload': ['z', 'a'], 'unresolved-endpoints': [], 'full-domain': True}), ({'options': ['small', 'medium', 'large'], 'lo': 'small', 'hi': 'large'}, {'lower-index': 0, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['small', 'large'], 'unresolved-endpoints': [], 'full-domain': True}), ({'options': ['small', 'medium', 'large'], 'lo': 'medium', 'hi': 'small'}, {'lower-index': 1, 'upper-index': 0, 'range-order': False, 'endpoint-payload': ['medium', 'small'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'large', 'hi': 'large'}, {'lower-index': 2, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['large', 'large'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'z', 'hi': 'small'}, {'lower-index': None, 'upper-index': 0, 'range-order': False, 'endpoint-payload': ['z', 'small'], 'unresolved-endpoints': ['z'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'z', 'hi': 'a'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['z', 'a'], 'unresolved-endpoints': ['z', 'a'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'small', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['small', 'large'], 'unresolved-endpoints': ['small', 'large'], 'full-domain': False})], 4: [({'options': ['small', 'medium', 'large'], 'lo': 'large', 'hi': 'small'}, {'lower-index': 2, 'upper-index': 0, 'range-order': False, 'endpoint-payload': ['large', 'small'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'z', 'hi': 'small'}, {'lower-index': None, 'upper-index': 0, 'range-order': False, 'endpoint-payload': ['z', 'small'], 'unresolved-endpoints': ['z'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'medium', 'hi': 'large'}, {'lower-index': 1, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['medium', 'large'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'large', 'hi': 'a'}, {'lower-index': 2, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['large', 'a'], 'unresolved-endpoints': ['a'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'z', 'hi': 'large'}, {'lower-index': None, 'upper-index': 2, 'range-order': False, 'endpoint-payload': ['z', 'large'], 'unresolved-endpoints': ['z'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'small', 'hi': 'small'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['small', 'small'], 'unresolved-endpoints': ['small', 'small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'small', 'hi': 'a'}, {'lower-index': None, 'upper-index': 1, 'range-order': False, 'endpoint-payload': ['small', 'a'], 'unresolved-endpoints': ['small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'medium', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['medium', 'large'], 'unresolved-endpoints': ['medium', 'large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'large', 'hi': 'small'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['large', 'small'], 'unresolved-endpoints': ['large', 'small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'large', 'hi': 'a'}, {'lower-index': None, 'upper-index': 1, 'range-order': False, 'endpoint-payload': ['large', 'a'], 'unresolved-endpoints': ['large'], 'full-domain': False})], 5: [({'options': ['small', 'medium', 'large'], 'lo': 'large', 'hi': 'large'}, {'lower-index': 2, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['large', 'large'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'small', 'hi': 'small'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['small', 'small'], 'unresolved-endpoints': ['small', 'small'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'z', 'hi': 'a'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['z', 'a'], 'unresolved-endpoints': ['z', 'a'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'small', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['small', 'large'], 'unresolved-endpoints': ['small', 'large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'medium', 'hi': 'small'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['medium', 'small'], 'unresolved-endpoints': ['medium', 'small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'medium', 'hi': 'a'}, {'lower-index': None, 'upper-index': 1, 'range-order': False, 'endpoint-payload': ['medium', 'a'], 'unresolved-endpoints': ['medium'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'large', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['large', 'large'], 'unresolved-endpoints': ['large', 'large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'z', 'hi': 'small'}, {'lower-index': 0, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['z', 'small'], 'unresolved-endpoints': ['small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'z', 'hi': 'a'}, {'lower-index': 0, 'upper-index': 1, 'range-order': True, 'endpoint-payload': ['z', 'a'], 'unresolved-endpoints': [], 'full-domain': True}), ({'options': ['small', 'medium', 'large'], 'lo': 'small', 'hi': 'large'}, {'lower-index': 0, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['small', 'large'], 'unresolved-endpoints': [], 'full-domain': True})]}
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 {'lower-index':(d['options'].index(d['lo']) if d['lo'] in d['options'] else 0), 'upper-index':(d['options'].index(d['hi']) if d['hi'] in d['options'] else None), 'range-order':(d['lo'] in d['options'] and d['hi'] in d['options'] and d['options'].index(d['lo'])<=d['options'].index(d['hi'])), 'endpoint-payload':([d['lo'],d['hi']]), 'unresolved-endpoints':([x for x in (d['lo'],d['hi']) if x not in d['options']]), 'full-domain':(bool(d['options']) and d['lo']==d['options'][0] and d['hi']==d['options'][-1])}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'options': ['small', 'medium', 'large'], 'lo': 'medium', 'hi': 'small'}, {'lower-index': 1, 'upper-index': 0, 'range-order': False, 'endpoint-payload': ['medium', 'small'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'small', 'hi': 'small'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['small', 'small'], 'unresolved-endpoints': ['small', 'small'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'large', 'hi': 'large'}, {'lower-index': 2, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['large', 'large'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'z', 'hi': 'small'}, {'lower-index': None, 'upper-index': 0, 'range-order': False, 'endpoint-payload': ['z', 'small'], 'unresolved-endpoints': ['z'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'z', 'hi': 'a'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['z', 'a'], 'unresolved-endpoints': ['z', 'a'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'small', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['small', 'large'], 'unresolved-endpoints': ['small', 'large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'medium', 'hi': 'small'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['medium', 'small'], 'unresolved-endpoints': ['medium', 'small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'medium', 'hi': 'a'}, {'lower-index': None, 'upper-index': 1, 'range-order': False, 'endpoint-payload': ['medium', 'a'], 'unresolved-endpoints': ['medium'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'large', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['large', 'large'], 'unresolved-endpoints': ['large', 'large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'z', 'hi': 'small'}, {'lower-index': 0, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['z', 'small'], 'unresolved-endpoints': ['small'], 'full-domain': False})], 2: [({'options': ['small', 'medium', 'large'], 'lo': 'medium', 'hi': 'large'}, {'lower-index': 1, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['medium', 'large'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'medium', 'hi': 'small'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['medium', 'small'], 'unresolved-endpoints': ['medium', 'small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'small', 'hi': 'a'}, {'lower-index': None, 'upper-index': 1, 'range-order': False, 'endpoint-payload': ['small', 'a'], 'unresolved-endpoints': ['small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'medium', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['medium', 'large'], 'unresolved-endpoints': ['medium', 'large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'large', 'hi': 'small'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['large', 'small'], 'unresolved-endpoints': ['large', 'small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'large', 'hi': 'a'}, {'lower-index': None, 'upper-index': 1, 'range-order': False, 'endpoint-payload': ['large', 'a'], 'unresolved-endpoints': ['large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'z', 'hi': 'large'}, {'lower-index': 0, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['z', 'large'], 'unresolved-endpoints': ['large'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'small', 'hi': 'small'}, {'lower-index': 0, 'upper-index': 0, 'range-order': True, 'endpoint-payload': ['small', 'small'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'small', 'hi': 'a'}, {'lower-index': 0, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['small', 'a'], 'unresolved-endpoints': ['a'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'large', 'hi': 'small'}, {'lower-index': 2, 'upper-index': 0, 'range-order': False, 'endpoint-payload': ['large', 'small'], 'unresolved-endpoints': [], 'full-domain': False})], 3: [({'options': ['small', 'medium', 'large'], 'lo': 'medium', 'hi': 'a'}, {'lower-index': 1, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['medium', 'a'], 'unresolved-endpoints': ['a'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'large', 'hi': 'small'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['large', 'small'], 'unresolved-endpoints': ['large', 'small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'z', 'hi': 'small'}, {'lower-index': 0, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['z', 'small'], 'unresolved-endpoints': ['small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'z', 'hi': 'a'}, {'lower-index': 0, 'upper-index': 1, 'range-order': True, 'endpoint-payload': ['z', 'a'], 'unresolved-endpoints': [], 'full-domain': True}), ({'options': ['small', 'medium', 'large'], 'lo': 'small', 'hi': 'large'}, {'lower-index': 0, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['small', 'large'], 'unresolved-endpoints': [], 'full-domain': True}), ({'options': ['small', 'medium', 'large'], 'lo': 'medium', 'hi': 'small'}, {'lower-index': 1, 'upper-index': 0, 'range-order': False, 'endpoint-payload': ['medium', 'small'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'large', 'hi': 'large'}, {'lower-index': 2, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['large', 'large'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'z', 'hi': 'small'}, {'lower-index': None, 'upper-index': 0, 'range-order': False, 'endpoint-payload': ['z', 'small'], 'unresolved-endpoints': ['z'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'z', 'hi': 'a'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['z', 'a'], 'unresolved-endpoints': ['z', 'a'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'small', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['small', 'large'], 'unresolved-endpoints': ['small', 'large'], 'full-domain': False})], 4: [({'options': ['small', 'medium', 'large'], 'lo': 'large', 'hi': 'small'}, {'lower-index': 2, 'upper-index': 0, 'range-order': False, 'endpoint-payload': ['large', 'small'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'z', 'hi': 'small'}, {'lower-index': None, 'upper-index': 0, 'range-order': False, 'endpoint-payload': ['z', 'small'], 'unresolved-endpoints': ['z'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'medium', 'hi': 'large'}, {'lower-index': 1, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['medium', 'large'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'large', 'hi': 'a'}, {'lower-index': 2, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['large', 'a'], 'unresolved-endpoints': ['a'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'z', 'hi': 'large'}, {'lower-index': None, 'upper-index': 2, 'range-order': False, 'endpoint-payload': ['z', 'large'], 'unresolved-endpoints': ['z'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'small', 'hi': 'small'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['small', 'small'], 'unresolved-endpoints': ['small', 'small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'small', 'hi': 'a'}, {'lower-index': None, 'upper-index': 1, 'range-order': False, 'endpoint-payload': ['small', 'a'], 'unresolved-endpoints': ['small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'medium', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['medium', 'large'], 'unresolved-endpoints': ['medium', 'large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'large', 'hi': 'small'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['large', 'small'], 'unresolved-endpoints': ['large', 'small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'large', 'hi': 'a'}, {'lower-index': None, 'upper-index': 1, 'range-order': False, 'endpoint-payload': ['large', 'a'], 'unresolved-endpoints': ['large'], 'full-domain': False})], 5: [({'options': ['small', 'medium', 'large'], 'lo': 'large', 'hi': 'large'}, {'lower-index': 2, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['large', 'large'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'small', 'hi': 'small'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['small', 'small'], 'unresolved-endpoints': ['small', 'small'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'z', 'hi': 'a'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['z', 'a'], 'unresolved-endpoints': ['z', 'a'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'small', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['small', 'large'], 'unresolved-endpoints': ['small', 'large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'medium', 'hi': 'small'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['medium', 'small'], 'unresolved-endpoints': ['medium', 'small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'medium', 'hi': 'a'}, {'lower-index': None, 'upper-index': 1, 'range-order': False, 'endpoint-payload': ['medium', 'a'], 'unresolved-endpoints': ['medium'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'large', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['large', 'large'], 'unresolved-endpoints': ['large', 'large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'z', 'hi': 'small'}, {'lower-index': 0, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['z', 'small'], 'unresolved-endpoints': ['small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'z', 'hi': 'a'}, {'lower-index': 0, 'upper-index': 1, 'range-order': True, 'endpoint-payload': ['z', 'a'], 'unresolved-endpoints': [], 'full-domain': True}), ({'options': ['small', 'medium', 'large'], 'lo': 'small', 'hi': 'large'}, {'lower-index': 0, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['small', 'large'], 'unresolved-endpoints': [], 'full-domain': True})]}
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:
Missing lower option identities do not silently become the first option is violated by the widget projection.

A discrete range selector uses ordered option indices, preserves endpoint option identities across rerender, and renders unavailable selected options as unresolved. This example checks: Missing lower option identities do not silently become the first option.

split: open-access


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

N = 1
observations = []
def solve(d):
    return {'lower-index':(d['options'].index(d['lo']) if d['lo'] in d['options'] else None), 'upper-index':(len(d['options'])-1), 'range-order':(d['lo'] in d['options'] and d['hi'] in d['options'] and d['options'].index(d['lo'])<=d['options'].index(d['hi'])), 'endpoint-payload':([d['lo'],d['hi']]), 'unresolved-endpoints':([x for x in (d['lo'],d['hi']) if x not in d['options']]), 'full-domain':(bool(d['options']) and d['lo']==d['options'][0] and d['hi']==d['options'][-1])}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'options': ['small', 'medium', 'large'], 'lo': 'small', 'hi': 'small'}, {'lower-index': 0, 'upper-index': 0, 'range-order': True, 'endpoint-payload': ['small', 'small'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'z', 'hi': 'a'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['z', 'a'], 'unresolved-endpoints': ['z', 'a'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'large', 'hi': 'large'}, {'lower-index': 2, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['large', 'large'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'z', 'hi': 'small'}, {'lower-index': None, 'upper-index': 0, 'range-order': False, 'endpoint-payload': ['z', 'small'], 'unresolved-endpoints': ['z'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'small', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['small', 'large'], 'unresolved-endpoints': ['small', 'large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'medium', 'hi': 'small'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['medium', 'small'], 'unresolved-endpoints': ['medium', 'small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'medium', 'hi': 'a'}, {'lower-index': None, 'upper-index': 1, 'range-order': False, 'endpoint-payload': ['medium', 'a'], 'unresolved-endpoints': ['medium'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'large', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['large', 'large'], 'unresolved-endpoints': ['large', 'large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'z', 'hi': 'small'}, {'lower-index': 0, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['z', 'small'], 'unresolved-endpoints': ['small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'z', 'hi': 'a'}, {'lower-index': 0, 'upper-index': 1, 'range-order': True, 'endpoint-payload': ['z', 'a'], 'unresolved-endpoints': [], 'full-domain': True})], 2: [({'options': ['small', 'medium', 'large'], 'lo': 'small', 'hi': 'a'}, {'lower-index': 0, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['small', 'a'], 'unresolved-endpoints': ['a'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'medium', 'hi': 'small'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['medium', 'small'], 'unresolved-endpoints': ['medium', 'small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'small', 'hi': 'a'}, {'lower-index': None, 'upper-index': 1, 'range-order': False, 'endpoint-payload': ['small', 'a'], 'unresolved-endpoints': ['small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'medium', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['medium', 'large'], 'unresolved-endpoints': ['medium', 'large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'large', 'hi': 'small'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['large', 'small'], 'unresolved-endpoints': ['large', 'small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'large', 'hi': 'a'}, {'lower-index': None, 'upper-index': 1, 'range-order': False, 'endpoint-payload': ['large', 'a'], 'unresolved-endpoints': ['large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'z', 'hi': 'large'}, {'lower-index': 0, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['z', 'large'], 'unresolved-endpoints': ['large'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'small', 'hi': 'small'}, {'lower-index': 0, 'upper-index': 0, 'range-order': True, 'endpoint-payload': ['small', 'small'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'medium', 'hi': 'large'}, {'lower-index': 1, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['medium', 'large'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'large', 'hi': 'small'}, {'lower-index': 2, 'upper-index': 0, 'range-order': False, 'endpoint-payload': ['large', 'small'], 'unresolved-endpoints': [], 'full-domain': False})], 3: [({'options': ['small', 'medium', 'large'], 'lo': 'medium', 'hi': 'small'}, {'lower-index': 1, 'upper-index': 0, 'range-order': False, 'endpoint-payload': ['medium', 'small'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'large', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['large', 'large'], 'unresolved-endpoints': ['large', 'large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'z', 'hi': 'small'}, {'lower-index': 0, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['z', 'small'], 'unresolved-endpoints': ['small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'z', 'hi': 'a'}, {'lower-index': 0, 'upper-index': 1, 'range-order': True, 'endpoint-payload': ['z', 'a'], 'unresolved-endpoints': [], 'full-domain': True}), ({'options': ['small', 'medium', 'large'], 'lo': 'small', 'hi': 'large'}, {'lower-index': 0, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['small', 'large'], 'unresolved-endpoints': [], 'full-domain': True}), ({'options': ['small', 'medium', 'large'], 'lo': 'medium', 'hi': 'a'}, {'lower-index': 1, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['medium', 'a'], 'unresolved-endpoints': ['a'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'large', 'hi': 'large'}, {'lower-index': 2, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['large', 'large'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'z', 'hi': 'small'}, {'lower-index': None, 'upper-index': 0, 'range-order': False, 'endpoint-payload': ['z', 'small'], 'unresolved-endpoints': ['z'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'z', 'hi': 'a'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['z', 'a'], 'unresolved-endpoints': ['z', 'a'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'small', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['small', 'large'], 'unresolved-endpoints': ['small', 'large'], 'full-domain': False})], 4: [({'options': ['small', 'medium', 'large'], 'lo': 'medium', 'hi': 'a'}, {'lower-index': 1, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['medium', 'a'], 'unresolved-endpoints': ['a'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'small', 'hi': 'a'}, {'lower-index': 0, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['small', 'a'], 'unresolved-endpoints': ['a'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'medium', 'hi': 'large'}, {'lower-index': 1, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['medium', 'large'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'large', 'hi': 'small'}, {'lower-index': 2, 'upper-index': 0, 'range-order': False, 'endpoint-payload': ['large', 'small'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'large', 'hi': 'a'}, {'lower-index': 2, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['large', 'a'], 'unresolved-endpoints': ['a'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'z', 'hi': 'large'}, {'lower-index': None, 'upper-index': 2, 'range-order': False, 'endpoint-payload': ['z', 'large'], 'unresolved-endpoints': ['z'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'small', 'hi': 'small'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['small', 'small'], 'unresolved-endpoints': ['small', 'small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'small', 'hi': 'a'}, {'lower-index': None, 'upper-index': 1, 'range-order': False, 'endpoint-payload': ['small', 'a'], 'unresolved-endpoints': ['small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'medium', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['medium', 'large'], 'unresolved-endpoints': ['medium', 'large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'large', 'hi': 'small'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['large', 'small'], 'unresolved-endpoints': ['large', 'small'], 'full-domain': False})], 5: [({'options': ['small', 'medium', 'large'], 'lo': 'large', 'hi': 'small'}, {'lower-index': 2, 'upper-index': 0, 'range-order': False, 'endpoint-payload': ['large', 'small'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'z', 'hi': 'a'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['z', 'a'], 'unresolved-endpoints': ['z', 'a'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'small', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['small', 'large'], 'unresolved-endpoints': ['small', 'large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'medium', 'hi': 'small'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['medium', 'small'], 'unresolved-endpoints': ['medium', 'small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'medium', 'hi': 'a'}, {'lower-index': None, 'upper-index': 1, 'range-order': False, 'endpoint-payload': ['medium', 'a'], 'unresolved-endpoints': ['medium'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'large', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['large', 'large'], 'unresolved-endpoints': ['large', 'large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'z', 'hi': 'small'}, {'lower-index': 0, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['z', 'small'], 'unresolved-endpoints': ['small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'z', 'hi': 'a'}, {'lower-index': 0, 'upper-index': 1, 'range-order': True, 'endpoint-payload': ['z', 'a'], 'unresolved-endpoints': [], 'full-domain': True}), ({'options': ['small', 'medium', 'large'], 'lo': 'small', 'hi': 'large'}, {'lower-index': 0, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['small', 'large'], 'unresolved-endpoints': [], 'full-domain': True}), ({'options': ['small', 'medium', 'large'], 'lo': 'medium', 'hi': 'small'}, {'lower-index': 1, 'upper-index': 0, 'range-order': False, 'endpoint-payload': ['medium', 'small'], 'unresolved-endpoints': [], 'full-domain': 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 {'lower-index':(d['options'].index(d['lo']) if d['lo'] in d['options'] else None), 'upper-index':(d['options'].index(d['hi']) if d['hi'] in d['options'] else len(d['options'])-1), 'range-order':(d['lo'] in d['options'] and d['hi'] in d['options'] and d['options'].index(d['lo'])<=d['options'].index(d['hi'])), 'endpoint-payload':([d['lo'],d['hi']]), 'unresolved-endpoints':([x for x in (d['lo'],d['hi']) if x not in d['options']]), 'full-domain':(bool(d['options']) and d['lo']==d['options'][0] and d['hi']==d['options'][-1])}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'options': ['small', 'medium', 'large'], 'lo': 'small', 'hi': 'small'}, {'lower-index': 0, 'upper-index': 0, 'range-order': True, 'endpoint-payload': ['small', 'small'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'z', 'hi': 'a'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['z', 'a'], 'unresolved-endpoints': ['z', 'a'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'large', 'hi': 'large'}, {'lower-index': 2, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['large', 'large'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'z', 'hi': 'small'}, {'lower-index': None, 'upper-index': 0, 'range-order': False, 'endpoint-payload': ['z', 'small'], 'unresolved-endpoints': ['z'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'small', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['small', 'large'], 'unresolved-endpoints': ['small', 'large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'medium', 'hi': 'small'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['medium', 'small'], 'unresolved-endpoints': ['medium', 'small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'medium', 'hi': 'a'}, {'lower-index': None, 'upper-index': 1, 'range-order': False, 'endpoint-payload': ['medium', 'a'], 'unresolved-endpoints': ['medium'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'large', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['large', 'large'], 'unresolved-endpoints': ['large', 'large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'z', 'hi': 'small'}, {'lower-index': 0, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['z', 'small'], 'unresolved-endpoints': ['small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'z', 'hi': 'a'}, {'lower-index': 0, 'upper-index': 1, 'range-order': True, 'endpoint-payload': ['z', 'a'], 'unresolved-endpoints': [], 'full-domain': True})], 2: [({'options': ['small', 'medium', 'large'], 'lo': 'small', 'hi': 'a'}, {'lower-index': 0, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['small', 'a'], 'unresolved-endpoints': ['a'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'medium', 'hi': 'small'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['medium', 'small'], 'unresolved-endpoints': ['medium', 'small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'small', 'hi': 'a'}, {'lower-index': None, 'upper-index': 1, 'range-order': False, 'endpoint-payload': ['small', 'a'], 'unresolved-endpoints': ['small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'medium', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['medium', 'large'], 'unresolved-endpoints': ['medium', 'large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'large', 'hi': 'small'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['large', 'small'], 'unresolved-endpoints': ['large', 'small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'large', 'hi': 'a'}, {'lower-index': None, 'upper-index': 1, 'range-order': False, 'endpoint-payload': ['large', 'a'], 'unresolved-endpoints': ['large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'z', 'hi': 'large'}, {'lower-index': 0, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['z', 'large'], 'unresolved-endpoints': ['large'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'small', 'hi': 'small'}, {'lower-index': 0, 'upper-index': 0, 'range-order': True, 'endpoint-payload': ['small', 'small'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'medium', 'hi': 'large'}, {'lower-index': 1, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['medium', 'large'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'large', 'hi': 'small'}, {'lower-index': 2, 'upper-index': 0, 'range-order': False, 'endpoint-payload': ['large', 'small'], 'unresolved-endpoints': [], 'full-domain': False})], 3: [({'options': ['small', 'medium', 'large'], 'lo': 'medium', 'hi': 'small'}, {'lower-index': 1, 'upper-index': 0, 'range-order': False, 'endpoint-payload': ['medium', 'small'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'large', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['large', 'large'], 'unresolved-endpoints': ['large', 'large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'z', 'hi': 'small'}, {'lower-index': 0, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['z', 'small'], 'unresolved-endpoints': ['small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'z', 'hi': 'a'}, {'lower-index': 0, 'upper-index': 1, 'range-order': True, 'endpoint-payload': ['z', 'a'], 'unresolved-endpoints': [], 'full-domain': True}), ({'options': ['small', 'medium', 'large'], 'lo': 'small', 'hi': 'large'}, {'lower-index': 0, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['small', 'large'], 'unresolved-endpoints': [], 'full-domain': True}), ({'options': ['small', 'medium', 'large'], 'lo': 'medium', 'hi': 'a'}, {'lower-index': 1, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['medium', 'a'], 'unresolved-endpoints': ['a'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'large', 'hi': 'large'}, {'lower-index': 2, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['large', 'large'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'z', 'hi': 'small'}, {'lower-index': None, 'upper-index': 0, 'range-order': False, 'endpoint-payload': ['z', 'small'], 'unresolved-endpoints': ['z'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'z', 'hi': 'a'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['z', 'a'], 'unresolved-endpoints': ['z', 'a'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'small', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['small', 'large'], 'unresolved-endpoints': ['small', 'large'], 'full-domain': False})], 4: [({'options': ['small', 'medium', 'large'], 'lo': 'medium', 'hi': 'a'}, {'lower-index': 1, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['medium', 'a'], 'unresolved-endpoints': ['a'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'small', 'hi': 'a'}, {'lower-index': 0, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['small', 'a'], 'unresolved-endpoints': ['a'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'medium', 'hi': 'large'}, {'lower-index': 1, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['medium', 'large'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'large', 'hi': 'small'}, {'lower-index': 2, 'upper-index': 0, 'range-order': False, 'endpoint-payload': ['large', 'small'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'large', 'hi': 'a'}, {'lower-index': 2, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['large', 'a'], 'unresolved-endpoints': ['a'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'z', 'hi': 'large'}, {'lower-index': None, 'upper-index': 2, 'range-order': False, 'endpoint-payload': ['z', 'large'], 'unresolved-endpoints': ['z'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'small', 'hi': 'small'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['small', 'small'], 'unresolved-endpoints': ['small', 'small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'small', 'hi': 'a'}, {'lower-index': None, 'upper-index': 1, 'range-order': False, 'endpoint-payload': ['small', 'a'], 'unresolved-endpoints': ['small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'medium', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['medium', 'large'], 'unresolved-endpoints': ['medium', 'large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'large', 'hi': 'small'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['large', 'small'], 'unresolved-endpoints': ['large', 'small'], 'full-domain': False})], 5: [({'options': ['small', 'medium', 'large'], 'lo': 'large', 'hi': 'small'}, {'lower-index': 2, 'upper-index': 0, 'range-order': False, 'endpoint-payload': ['large', 'small'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'z', 'hi': 'a'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['z', 'a'], 'unresolved-endpoints': ['z', 'a'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'small', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['small', 'large'], 'unresolved-endpoints': ['small', 'large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'medium', 'hi': 'small'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['medium', 'small'], 'unresolved-endpoints': ['medium', 'small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'medium', 'hi': 'a'}, {'lower-index': None, 'upper-index': 1, 'range-order': False, 'endpoint-payload': ['medium', 'a'], 'unresolved-endpoints': ['medium'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'large', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['large', 'large'], 'unresolved-endpoints': ['large', 'large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'z', 'hi': 'small'}, {'lower-index': 0, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['z', 'small'], 'unresolved-endpoints': ['small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'z', 'hi': 'a'}, {'lower-index': 0, 'upper-index': 1, 'range-order': True, 'endpoint-payload': ['z', 'a'], 'unresolved-endpoints': [], 'full-domain': True}), ({'options': ['small', 'medium', 'large'], 'lo': 'small', 'hi': 'large'}, {'lower-index': 0, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['small', 'large'], 'unresolved-endpoints': [], 'full-domain': True}), ({'options': ['small', 'medium', 'large'], 'lo': 'medium', 'hi': 'small'}, {'lower-index': 1, 'upper-index': 0, 'range-order': False, 'endpoint-payload': ['medium', 'small'], 'unresolved-endpoints': [], 'full-domain': 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:
Missing upper identities do not silently become the final option is violated by the widget projection.

A discrete range selector uses ordered option indices, preserves endpoint option identities across rerender, and renders unavailable selected options as unresolved. This example checks: Missing upper identities do not silently become the final option.

split: open-access


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

N = 1
observations = []
def solve(d):
    return {'lower-index':(d['options'].index(d['lo']) if d['lo'] in d['options'] else None), 'upper-index':(d['options'].index(d['hi']) if d['hi'] in d['options'] else None), 'range-order':(d['lo']<=d['hi']), 'endpoint-payload':([d['lo'],d['hi']]), 'unresolved-endpoints':([x for x in (d['lo'],d['hi']) if x not in d['options']]), 'full-domain':(bool(d['options']) and d['lo']==d['options'][0] and d['hi']==d['options'][-1])}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'options': ['small', 'medium', 'large'], 'lo': 'small', 'hi': 'large'}, {'lower-index': 0, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['small', 'large'], 'unresolved-endpoints': [], 'full-domain': True}), ({'options': ['small', 'medium', 'large'], 'lo': 'large', 'hi': 'large'}, {'lower-index': 2, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['large', 'large'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'z', 'hi': 'small'}, {'lower-index': None, 'upper-index': 0, 'range-order': False, 'endpoint-payload': ['z', 'small'], 'unresolved-endpoints': ['z'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'z', 'hi': 'a'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['z', 'a'], 'unresolved-endpoints': ['z', 'a'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'small', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['small', 'large'], 'unresolved-endpoints': ['small', 'large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'medium', 'hi': 'small'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['medium', 'small'], 'unresolved-endpoints': ['medium', 'small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'medium', 'hi': 'a'}, {'lower-index': None, 'upper-index': 1, 'range-order': False, 'endpoint-payload': ['medium', 'a'], 'unresolved-endpoints': ['medium'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'large', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['large', 'large'], 'unresolved-endpoints': ['large', 'large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'z', 'hi': 'small'}, {'lower-index': 0, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['z', 'small'], 'unresolved-endpoints': ['small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'z', 'hi': 'a'}, {'lower-index': 0, 'upper-index': 1, 'range-order': True, 'endpoint-payload': ['z', 'a'], 'unresolved-endpoints': [], 'full-domain': True})], 2: [({'options': ['small', 'medium', 'large'], 'lo': 'medium', 'hi': 'small'}, {'lower-index': 1, 'upper-index': 0, 'range-order': False, 'endpoint-payload': ['medium', 'small'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'small', 'hi': 'small'}, {'lower-index': 0, 'upper-index': 0, 'range-order': True, 'endpoint-payload': ['small', 'small'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'small', 'hi': 'a'}, {'lower-index': None, 'upper-index': 1, 'range-order': False, 'endpoint-payload': ['small', 'a'], 'unresolved-endpoints': ['small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'medium', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['medium', 'large'], 'unresolved-endpoints': ['medium', 'large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'large', 'hi': 'small'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['large', 'small'], 'unresolved-endpoints': ['large', 'small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'large', 'hi': 'a'}, {'lower-index': None, 'upper-index': 1, 'range-order': False, 'endpoint-payload': ['large', 'a'], 'unresolved-endpoints': ['large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'z', 'hi': 'large'}, {'lower-index': 0, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['z', 'large'], 'unresolved-endpoints': ['large'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'small', 'hi': 'a'}, {'lower-index': 0, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['small', 'a'], 'unresolved-endpoints': ['a'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'medium', 'hi': 'large'}, {'lower-index': 1, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['medium', 'large'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'large', 'hi': 'small'}, {'lower-index': 2, 'upper-index': 0, 'range-order': False, 'endpoint-payload': ['large', 'small'], 'unresolved-endpoints': [], 'full-domain': False})], 3: [({'options': ['small', 'medium', 'large'], 'lo': 'medium', 'hi': 'large'}, {'lower-index': 1, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['medium', 'large'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'large', 'hi': 'large'}, {'lower-index': 2, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['large', 'large'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'z', 'hi': 'small'}, {'lower-index': 0, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['z', 'small'], 'unresolved-endpoints': ['small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'z', 'hi': 'a'}, {'lower-index': 0, 'upper-index': 1, 'range-order': True, 'endpoint-payload': ['z', 'a'], 'unresolved-endpoints': [], 'full-domain': True}), ({'options': ['small', 'medium', 'large'], 'lo': 'small', 'hi': 'large'}, {'lower-index': 0, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['small', 'large'], 'unresolved-endpoints': [], 'full-domain': True}), ({'options': ['small', 'medium', 'large'], 'lo': 'medium', 'hi': 'small'}, {'lower-index': 1, 'upper-index': 0, 'range-order': False, 'endpoint-payload': ['medium', 'small'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'medium', 'hi': 'a'}, {'lower-index': 1, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['medium', 'a'], 'unresolved-endpoints': ['a'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'z', 'hi': 'small'}, {'lower-index': None, 'upper-index': 0, 'range-order': False, 'endpoint-payload': ['z', 'small'], 'unresolved-endpoints': ['z'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'z', 'hi': 'a'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['z', 'a'], 'unresolved-endpoints': ['z', 'a'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'small', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['small', 'large'], 'unresolved-endpoints': ['small', 'large'], 'full-domain': False})], 4: [({'options': ['small', 'medium', 'large'], 'lo': 'large', 'hi': 'small'}, {'lower-index': 2, 'upper-index': 0, 'range-order': False, 'endpoint-payload': ['large', 'small'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'small', 'hi': 'small'}, {'lower-index': 0, 'upper-index': 0, 'range-order': True, 'endpoint-payload': ['small', 'small'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'medium', 'hi': 'large'}, {'lower-index': 1, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['medium', 'large'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'large', 'hi': 'a'}, {'lower-index': 2, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['large', 'a'], 'unresolved-endpoints': ['a'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'z', 'hi': 'large'}, {'lower-index': None, 'upper-index': 2, 'range-order': False, 'endpoint-payload': ['z', 'large'], 'unresolved-endpoints': ['z'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'small', 'hi': 'small'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['small', 'small'], 'unresolved-endpoints': ['small', 'small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'small', 'hi': 'a'}, {'lower-index': None, 'upper-index': 1, 'range-order': False, 'endpoint-payload': ['small', 'a'], 'unresolved-endpoints': ['small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'medium', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['medium', 'large'], 'unresolved-endpoints': ['medium', 'large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'large', 'hi': 'small'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['large', 'small'], 'unresolved-endpoints': ['large', 'small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'large', 'hi': 'a'}, {'lower-index': None, 'upper-index': 1, 'range-order': False, 'endpoint-payload': ['large', 'a'], 'unresolved-endpoints': ['large'], 'full-domain': False})], 5: [({'options': ['z', 'a'], 'lo': 'small', 'hi': 'small'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['small', 'small'], 'unresolved-endpoints': ['small', 'small'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'large', 'hi': 'large'}, {'lower-index': 2, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['large', 'large'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'z', 'hi': 'a'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['z', 'a'], 'unresolved-endpoints': ['z', 'a'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'small', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['small', 'large'], 'unresolved-endpoints': ['small', 'large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'medium', 'hi': 'small'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['medium', 'small'], 'unresolved-endpoints': ['medium', 'small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'medium', 'hi': 'a'}, {'lower-index': None, 'upper-index': 1, 'range-order': False, 'endpoint-payload': ['medium', 'a'], 'unresolved-endpoints': ['medium'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'large', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['large', 'large'], 'unresolved-endpoints': ['large', 'large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'z', 'hi': 'small'}, {'lower-index': 0, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['z', 'small'], 'unresolved-endpoints': ['small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'z', 'hi': 'a'}, {'lower-index': 0, 'upper-index': 1, 'range-order': True, 'endpoint-payload': ['z', 'a'], 'unresolved-endpoints': [], 'full-domain': True}), ({'options': ['small', 'medium', 'large'], 'lo': 'small', 'hi': 'large'}, {'lower-index': 0, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['small', 'large'], 'unresolved-endpoints': [], 'full-domain': True})]}
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 {'lower-index':(d['options'].index(d['lo']) if d['lo'] in d['options'] else None), 'upper-index':(d['options'].index(d['hi']) if d['hi'] in d['options'] else None), 'range-order':(d['lo'] in d['options'] and d['hi'] in d['options'] and d['options'].index(d['lo'])<d['options'].index(d['hi'])), 'endpoint-payload':([d['lo'],d['hi']]), 'unresolved-endpoints':([x for x in (d['lo'],d['hi']) if x not in d['options']]), 'full-domain':(bool(d['options']) and d['lo']==d['options'][0] and d['hi']==d['options'][-1])}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'options': ['small', 'medium', 'large'], 'lo': 'small', 'hi': 'large'}, {'lower-index': 0, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['small', 'large'], 'unresolved-endpoints': [], 'full-domain': True}), ({'options': ['small', 'medium', 'large'], 'lo': 'large', 'hi': 'large'}, {'lower-index': 2, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['large', 'large'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'z', 'hi': 'small'}, {'lower-index': None, 'upper-index': 0, 'range-order': False, 'endpoint-payload': ['z', 'small'], 'unresolved-endpoints': ['z'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'z', 'hi': 'a'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['z', 'a'], 'unresolved-endpoints': ['z', 'a'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'small', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['small', 'large'], 'unresolved-endpoints': ['small', 'large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'medium', 'hi': 'small'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['medium', 'small'], 'unresolved-endpoints': ['medium', 'small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'medium', 'hi': 'a'}, {'lower-index': None, 'upper-index': 1, 'range-order': False, 'endpoint-payload': ['medium', 'a'], 'unresolved-endpoints': ['medium'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'large', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['large', 'large'], 'unresolved-endpoints': ['large', 'large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'z', 'hi': 'small'}, {'lower-index': 0, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['z', 'small'], 'unresolved-endpoints': ['small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'z', 'hi': 'a'}, {'lower-index': 0, 'upper-index': 1, 'range-order': True, 'endpoint-payload': ['z', 'a'], 'unresolved-endpoints': [], 'full-domain': True})], 2: [({'options': ['small', 'medium', 'large'], 'lo': 'medium', 'hi': 'small'}, {'lower-index': 1, 'upper-index': 0, 'range-order': False, 'endpoint-payload': ['medium', 'small'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'small', 'hi': 'small'}, {'lower-index': 0, 'upper-index': 0, 'range-order': True, 'endpoint-payload': ['small', 'small'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'small', 'hi': 'a'}, {'lower-index': None, 'upper-index': 1, 'range-order': False, 'endpoint-payload': ['small', 'a'], 'unresolved-endpoints': ['small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'medium', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['medium', 'large'], 'unresolved-endpoints': ['medium', 'large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'large', 'hi': 'small'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['large', 'small'], 'unresolved-endpoints': ['large', 'small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'large', 'hi': 'a'}, {'lower-index': None, 'upper-index': 1, 'range-order': False, 'endpoint-payload': ['large', 'a'], 'unresolved-endpoints': ['large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'z', 'hi': 'large'}, {'lower-index': 0, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['z', 'large'], 'unresolved-endpoints': ['large'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'small', 'hi': 'a'}, {'lower-index': 0, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['small', 'a'], 'unresolved-endpoints': ['a'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'medium', 'hi': 'large'}, {'lower-index': 1, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['medium', 'large'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'large', 'hi': 'small'}, {'lower-index': 2, 'upper-index': 0, 'range-order': False, 'endpoint-payload': ['large', 'small'], 'unresolved-endpoints': [], 'full-domain': False})], 3: [({'options': ['small', 'medium', 'large'], 'lo': 'medium', 'hi': 'large'}, {'lower-index': 1, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['medium', 'large'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'large', 'hi': 'large'}, {'lower-index': 2, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['large', 'large'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'z', 'hi': 'small'}, {'lower-index': 0, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['z', 'small'], 'unresolved-endpoints': ['small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'z', 'hi': 'a'}, {'lower-index': 0, 'upper-index': 1, 'range-order': True, 'endpoint-payload': ['z', 'a'], 'unresolved-endpoints': [], 'full-domain': True}), ({'options': ['small', 'medium', 'large'], 'lo': 'small', 'hi': 'large'}, {'lower-index': 0, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['small', 'large'], 'unresolved-endpoints': [], 'full-domain': True}), ({'options': ['small', 'medium', 'large'], 'lo': 'medium', 'hi': 'small'}, {'lower-index': 1, 'upper-index': 0, 'range-order': False, 'endpoint-payload': ['medium', 'small'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'medium', 'hi': 'a'}, {'lower-index': 1, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['medium', 'a'], 'unresolved-endpoints': ['a'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'z', 'hi': 'small'}, {'lower-index': None, 'upper-index': 0, 'range-order': False, 'endpoint-payload': ['z', 'small'], 'unresolved-endpoints': ['z'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'z', 'hi': 'a'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['z', 'a'], 'unresolved-endpoints': ['z', 'a'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'small', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['small', 'large'], 'unresolved-endpoints': ['small', 'large'], 'full-domain': False})], 4: [({'options': ['small', 'medium', 'large'], 'lo': 'large', 'hi': 'small'}, {'lower-index': 2, 'upper-index': 0, 'range-order': False, 'endpoint-payload': ['large', 'small'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'small', 'hi': 'small'}, {'lower-index': 0, 'upper-index': 0, 'range-order': True, 'endpoint-payload': ['small', 'small'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'medium', 'hi': 'large'}, {'lower-index': 1, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['medium', 'large'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'large', 'hi': 'a'}, {'lower-index': 2, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['large', 'a'], 'unresolved-endpoints': ['a'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'z', 'hi': 'large'}, {'lower-index': None, 'upper-index': 2, 'range-order': False, 'endpoint-payload': ['z', 'large'], 'unresolved-endpoints': ['z'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'small', 'hi': 'small'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['small', 'small'], 'unresolved-endpoints': ['small', 'small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'small', 'hi': 'a'}, {'lower-index': None, 'upper-index': 1, 'range-order': False, 'endpoint-payload': ['small', 'a'], 'unresolved-endpoints': ['small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'medium', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['medium', 'large'], 'unresolved-endpoints': ['medium', 'large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'large', 'hi': 'small'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['large', 'small'], 'unresolved-endpoints': ['large', 'small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'large', 'hi': 'a'}, {'lower-index': None, 'upper-index': 1, 'range-order': False, 'endpoint-payload': ['large', 'a'], 'unresolved-endpoints': ['large'], 'full-domain': False})], 5: [({'options': ['z', 'a'], 'lo': 'small', 'hi': 'small'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['small', 'small'], 'unresolved-endpoints': ['small', 'small'], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'large', 'hi': 'large'}, {'lower-index': 2, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['large', 'large'], 'unresolved-endpoints': [], 'full-domain': False}), ({'options': ['small', 'medium', 'large'], 'lo': 'z', 'hi': 'a'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['z', 'a'], 'unresolved-endpoints': ['z', 'a'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'small', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['small', 'large'], 'unresolved-endpoints': ['small', 'large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'medium', 'hi': 'small'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['medium', 'small'], 'unresolved-endpoints': ['medium', 'small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'medium', 'hi': 'a'}, {'lower-index': None, 'upper-index': 1, 'range-order': False, 'endpoint-payload': ['medium', 'a'], 'unresolved-endpoints': ['medium'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'large', 'hi': 'large'}, {'lower-index': None, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['large', 'large'], 'unresolved-endpoints': ['large', 'large'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'z', 'hi': 'small'}, {'lower-index': 0, 'upper-index': None, 'range-order': False, 'endpoint-payload': ['z', 'small'], 'unresolved-endpoints': ['small'], 'full-domain': False}), ({'options': ['z', 'a'], 'lo': 'z', 'hi': 'a'}, {'lower-index': 0, 'upper-index': 1, 'range-order': True, 'endpoint-payload': ['z', 'a'], 'unresolved-endpoints': [], 'full-domain': True}), ({'options': ['small', 'medium', 'large'], 'lo': 'small', 'hi': 'large'}, {'lower-index': 0, 'upper-index': 2, 'range-order': True, 'endpoint-payload': ['small', 'large'], 'unresolved-endpoints': [], 'full-domain': True})]}
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:
Discrete range order follows option order and permits a single option is violated by the widget projection.

A discrete range selector uses ordered option indices, preserves endpoint option identities across rerender, and renders unavailable selected options as unresolved. This example checks: Discrete range order follows option order and permits a single option.

split: open-access