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

N = 1
observations = []
def solve(d):
    return {'eligible':(list(d['visible'])), 'select-union':(list(dict.fromkeys(d['selected']+[x for x in d['visible'] if x not in d['disabled']]))), 'clear-subset':([x for x in d['selected'] if x not in d['visible'] or x in d['disabled']]), 'all-visible':(bool([x for x in d['visible'] if x not in d['disabled']]) and all(x in d['selected'] for x in d['visible'] if x not in d['disabled'])), 'mixed-visible':(0<sum(x in d['selected'] for x in d['visible'] if x not in d['disabled'])<sum(x not in d['disabled'] for x in d['visible'])), 'bulk-added-count':(sum(x not in d['selected'] and x not in d['disabled'] for x in d['visible']))}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'visible': ['a', 'b'], 'selected': [], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'z'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': []}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': True, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a', 'z'], 'clear-subset': ['z'], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0})], 2: [({'visible': ['a', 'b'], 'selected': [], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a', 'z'], 'clear-subset': ['z'], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'z', 'b'], 'clear-subset': ['z'], 'all-visible': False, 'mixed-visible': True, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a', 'b'], 'clear-subset': ['b'], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': [], 'disabled': []}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': [], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'z'], 'disabled': []}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0})], 3: [({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a', 'b'], 'clear-subset': ['b'], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': [], 'disabled': ['b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a'], 'disabled': []}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'z'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': []}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0})], 4: [({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': True, 'bulk-added-count': 1}), ({'visible': [], 'selected': ['a'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'z'], 'disabled': []}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'z'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 2}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'z', 'b'], 'clear-subset': ['z'], 'all-visible': False, 'mixed-visible': True, 'bulk-added-count': 1})], 5: [({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a', 'z'], 'clear-subset': ['z'], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'z', 'b'], 'clear-subset': ['z'], 'all-visible': False, 'mixed-visible': True, 'bulk-added-count': 1}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': True, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': [], 'disabled': ['b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a'], 'disabled': []}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0})]}
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 {'eligible':([x for x in d['visible'] if x not in d['selected']]), 'select-union':(list(dict.fromkeys(d['selected']+[x for x in d['visible'] if x not in d['disabled']]))), 'clear-subset':([x for x in d['selected'] if x not in d['visible'] or x in d['disabled']]), 'all-visible':(bool([x for x in d['visible'] if x not in d['disabled']]) and all(x in d['selected'] for x in d['visible'] if x not in d['disabled'])), 'mixed-visible':(0<sum(x in d['selected'] for x in d['visible'] if x not in d['disabled'])<sum(x not in d['disabled'] for x in d['visible'])), 'bulk-added-count':(sum(x not in d['selected'] and x not in d['disabled'] for x in d['visible']))}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'visible': ['a', 'b'], 'selected': [], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'z'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': []}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': True, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a', 'z'], 'clear-subset': ['z'], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0})], 2: [({'visible': ['a', 'b'], 'selected': [], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a', 'z'], 'clear-subset': ['z'], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'z', 'b'], 'clear-subset': ['z'], 'all-visible': False, 'mixed-visible': True, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a', 'b'], 'clear-subset': ['b'], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': [], 'disabled': []}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': [], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'z'], 'disabled': []}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0})], 3: [({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a', 'b'], 'clear-subset': ['b'], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': [], 'disabled': ['b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a'], 'disabled': []}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'z'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': []}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0})], 4: [({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': True, 'bulk-added-count': 1}), ({'visible': [], 'selected': ['a'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'z'], 'disabled': []}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'z'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 2}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'z', 'b'], 'clear-subset': ['z'], 'all-visible': False, 'mixed-visible': True, 'bulk-added-count': 1})], 5: [({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a', 'z'], 'clear-subset': ['z'], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'z', 'b'], 'clear-subset': ['z'], 'all-visible': False, 'mixed-visible': True, 'bulk-added-count': 1}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': True, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': [], 'disabled': ['b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a'], 'disabled': []}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0})]}
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:
Disabled visible choices are excluded from bulk targets is violated by the widget projection.

Bulk selection acts on eligible visible choices, preserves hidden selections and reports mixed state over the eligible visible subset only. This example checks: Disabled visible choices are excluded from bulk targets.

split: open-access


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

N = 1
observations = []
def solve(d):
    return {'eligible':([x for x in d['visible'] if x not in d['disabled']]), 'select-union':(list(d['visible'])), 'clear-subset':([x for x in d['selected'] if x not in d['visible'] or x in d['disabled']]), 'all-visible':(bool([x for x in d['visible'] if x not in d['disabled']]) and all(x in d['selected'] for x in d['visible'] if x not in d['disabled'])), 'mixed-visible':(0<sum(x in d['selected'] for x in d['visible'] if x not in d['disabled'])<sum(x not in d['disabled'] for x in d['visible'])), 'bulk-added-count':(sum(x not in d['selected'] and x not in d['disabled'] for x in d['visible']))}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'visible': [], 'selected': ['a'], 'disabled': []}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'z'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': []}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': True, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a', 'z'], 'clear-subset': ['z'], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0})], 2: [({'visible': [], 'selected': ['a'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'z', 'b'], 'clear-subset': ['z'], 'all-visible': False, 'mixed-visible': True, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a', 'b'], 'clear-subset': ['b'], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': [], 'disabled': []}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': [], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'z'], 'disabled': []}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0})], 3: [({'visible': [], 'selected': ['a'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': [], 'disabled': ['b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a'], 'disabled': []}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'z'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': []}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 1})], 4: [({'visible': [], 'selected': ['a', 'z'], 'disabled': []}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 1}), ({'visible': [], 'selected': ['a'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'z'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 2}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'z', 'b'], 'clear-subset': ['z'], 'all-visible': False, 'mixed-visible': True, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0})], 5: [({'visible': [], 'selected': ['a', 'z'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': True, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a', 'z'], 'clear-subset': ['z'], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': [], 'disabled': ['b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a'], 'disabled': []}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0})]}
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 {'eligible':([x for x in d['visible'] if x not in d['disabled']]), 'select-union':(list(dict.fromkeys(d['selected']+d['visible']))), 'clear-subset':([x for x in d['selected'] if x not in d['visible'] or x in d['disabled']]), 'all-visible':(bool([x for x in d['visible'] if x not in d['disabled']]) and all(x in d['selected'] for x in d['visible'] if x not in d['disabled'])), 'mixed-visible':(0<sum(x in d['selected'] for x in d['visible'] if x not in d['disabled'])<sum(x not in d['disabled'] for x in d['visible'])), 'bulk-added-count':(sum(x not in d['selected'] and x not in d['disabled'] for x in d['visible']))}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'visible': [], 'selected': ['a'], 'disabled': []}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'z'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': []}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': True, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a', 'z'], 'clear-subset': ['z'], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0})], 2: [({'visible': [], 'selected': ['a'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'z', 'b'], 'clear-subset': ['z'], 'all-visible': False, 'mixed-visible': True, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a', 'b'], 'clear-subset': ['b'], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': [], 'disabled': []}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': [], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'z'], 'disabled': []}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0})], 3: [({'visible': [], 'selected': ['a'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': [], 'disabled': ['b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a'], 'disabled': []}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'z'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': []}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 1})], 4: [({'visible': [], 'selected': ['a', 'z'], 'disabled': []}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 1}), ({'visible': [], 'selected': ['a'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'z'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 2}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'z', 'b'], 'clear-subset': ['z'], 'all-visible': False, 'mixed-visible': True, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0})], 5: [({'visible': [], 'selected': ['a', 'z'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': True, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a', 'z'], 'clear-subset': ['z'], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': [], 'disabled': ['b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a'], 'disabled': []}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0})]}
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:
Select-visible preserves hidden choices and excludes disabled additions is violated by the widget projection.

Bulk selection acts on eligible visible choices, preserves hidden selections and reports mixed state over the eligible visible subset only. This example checks: Select-visible preserves hidden choices and excludes disabled additions.

split: open-access


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

N = 1
observations = []
def solve(d):
    return {'eligible':([x for x in d['visible'] if x not in d['disabled']]), 'select-union':(list(dict.fromkeys(d['selected']+[x for x in d['visible'] if x not in d['disabled']]))), 'clear-subset':([]), 'all-visible':(bool([x for x in d['visible'] if x not in d['disabled']]) and all(x in d['selected'] for x in d['visible'] if x not in d['disabled'])), 'mixed-visible':(0<sum(x in d['selected'] for x in d['visible'] if x not in d['disabled'])<sum(x not in d['disabled'] for x in d['visible'])), 'bulk-added-count':(sum(x not in d['selected'] and x not in d['disabled'] for x in d['visible']))}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'visible': [], 'selected': ['a'], 'disabled': []}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'z'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': []}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': True, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a', 'z'], 'clear-subset': ['z'], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0})], 2: [({'visible': [], 'selected': ['a'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a', 'b'], 'clear-subset': ['b'], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'z', 'b'], 'clear-subset': ['z'], 'all-visible': False, 'mixed-visible': True, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': [], 'disabled': []}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': [], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'z'], 'disabled': []}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'z'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0})], 3: [({'visible': [], 'selected': ['a'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': [], 'disabled': ['b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a'], 'disabled': []}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'z'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': []}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 1})], 4: [({'visible': [], 'selected': ['a', 'z'], 'disabled': []}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'z'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 2}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'z', 'b'], 'clear-subset': ['z'], 'all-visible': False, 'mixed-visible': True, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0})], 5: [({'visible': [], 'selected': ['a', 'z'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': True, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a', 'z'], 'clear-subset': ['z'], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': [], 'disabled': ['b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a'], 'disabled': []}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0})]}
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 {'eligible':([x for x in d['visible'] if x not in d['disabled']]), 'select-union':(list(dict.fromkeys(d['selected']+[x for x in d['visible'] if x not in d['disabled']]))), 'clear-subset':([x for x in d['selected'] if x not in d['visible']]), 'all-visible':(bool([x for x in d['visible'] if x not in d['disabled']]) and all(x in d['selected'] for x in d['visible'] if x not in d['disabled'])), 'mixed-visible':(0<sum(x in d['selected'] for x in d['visible'] if x not in d['disabled'])<sum(x not in d['disabled'] for x in d['visible'])), 'bulk-added-count':(sum(x not in d['selected'] and x not in d['disabled'] for x in d['visible']))}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'visible': [], 'selected': ['a'], 'disabled': []}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'z'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': []}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': True, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a', 'z'], 'clear-subset': ['z'], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0})], 2: [({'visible': [], 'selected': ['a'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a', 'b'], 'clear-subset': ['b'], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'z', 'b'], 'clear-subset': ['z'], 'all-visible': False, 'mixed-visible': True, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': [], 'disabled': []}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': [], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'z'], 'disabled': []}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'z'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0})], 3: [({'visible': [], 'selected': ['a'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': [], 'disabled': ['b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a'], 'disabled': []}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'z'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': []}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 1})], 4: [({'visible': [], 'selected': ['a', 'z'], 'disabled': []}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'z'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 2}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'z', 'b'], 'clear-subset': ['z'], 'all-visible': False, 'mixed-visible': True, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0})], 5: [({'visible': [], 'selected': ['a', 'z'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': True, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a', 'z'], 'clear-subset': ['z'], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': [], 'disabled': ['b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a'], 'disabled': []}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0})]}
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:
Clear-visible preserves hidden and disabled selections is violated by the widget projection.

Bulk selection acts on eligible visible choices, preserves hidden selections and reports mixed state over the eligible visible subset only. This example checks: Clear-visible preserves hidden and disabled selections.

split: open-access


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

N = 1
observations = []
def solve(d):
    return {'eligible':([x for x in d['visible'] if x not in d['disabled']]), 'select-union':(list(dict.fromkeys(d['selected']+[x for x in d['visible'] if x not in d['disabled']]))), 'clear-subset':([x for x in d['selected'] if x not in d['visible'] or x in d['disabled']]), 'all-visible':(all(x in d['selected'] for x in d['visible'] if x not in d['disabled'])), 'mixed-visible':(0<sum(x in d['selected'] for x in d['visible'] if x not in d['disabled'])<sum(x not in d['disabled'] for x in d['visible'])), 'bulk-added-count':(sum(x not in d['selected'] and x not in d['disabled'] for x in d['visible']))}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'visible': [], 'selected': [], 'disabled': []}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a'], 'disabled': []}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'z'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': []}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': True, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a', 'z'], 'clear-subset': ['z'], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0})], 2: [({'visible': [], 'selected': [], 'disabled': ['b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'z'], 'disabled': []}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'z', 'b'], 'clear-subset': ['z'], 'all-visible': False, 'mixed-visible': True, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a', 'b'], 'clear-subset': ['b'], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': [], 'disabled': []}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': [], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0})], 3: [({'visible': [], 'selected': [], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': []}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': [], 'disabled': ['b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a'], 'disabled': []}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'z'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 1})], 4: [({'visible': [], 'selected': ['a'], 'disabled': []}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'z'], 'disabled': []}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'z'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 2}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'z', 'b'], 'clear-subset': ['z'], 'all-visible': False, 'mixed-visible': True, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0})], 5: [({'visible': [], 'selected': ['a'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': [], 'disabled': []}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': True, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a', 'z'], 'clear-subset': ['z'], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': [], 'disabled': ['b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0})]}
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 {'eligible':([x for x in d['visible'] if x not in d['disabled']]), 'select-union':(list(dict.fromkeys(d['selected']+[x for x in d['visible'] if x not in d['disabled']]))), 'clear-subset':([x for x in d['selected'] if x not in d['visible'] or x in d['disabled']]), 'all-visible':(all(x in d['selected'] for x in d['visible'])), 'mixed-visible':(0<sum(x in d['selected'] for x in d['visible'] if x not in d['disabled'])<sum(x not in d['disabled'] for x in d['visible'])), 'bulk-added-count':(sum(x not in d['selected'] and x not in d['disabled'] for x in d['visible']))}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'visible': [], 'selected': [], 'disabled': []}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a'], 'disabled': []}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'z'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': []}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': True, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a', 'z'], 'clear-subset': ['z'], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0})], 2: [({'visible': [], 'selected': [], 'disabled': ['b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'z'], 'disabled': []}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'z', 'b'], 'clear-subset': ['z'], 'all-visible': False, 'mixed-visible': True, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a', 'b'], 'clear-subset': ['b'], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': [], 'disabled': []}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': [], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0})], 3: [({'visible': [], 'selected': [], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': []}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': [], 'disabled': ['b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a'], 'disabled': []}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'z'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 1})], 4: [({'visible': [], 'selected': ['a'], 'disabled': []}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'z'], 'disabled': []}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'z'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 2}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'z', 'b'], 'clear-subset': ['z'], 'all-visible': False, 'mixed-visible': True, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'z'], 'clear-subset': ['a', 'z'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0})], 5: [({'visible': [], 'selected': ['a'], 'disabled': ['b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': [], 'disabled': []}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': [], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': False, 'mixed-visible': True, 'bulk-added-count': 1}), ({'visible': ['a', 'b'], 'selected': ['a'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a'], 'clear-subset': ['a'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'z'], 'disabled': ['b']}, {'eligible': ['a'], 'select-union': ['a', 'z'], 'clear-subset': ['z'], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': []}, {'eligible': ['a', 'b'], 'select-union': ['a', 'b'], 'clear-subset': [], 'all-visible': True, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': ['a', 'b'], 'selected': ['a', 'b'], 'disabled': ['a', 'b']}, {'eligible': [], 'select-union': ['a', 'b'], 'clear-subset': ['a', 'b'], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0}), ({'visible': [], 'selected': [], 'disabled': ['b']}, {'eligible': [], 'select-union': [], 'clear-subset': [], 'all-visible': False, 'mixed-visible': False, 'bulk-added-count': 0})]}
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:
An empty eligible set is not displayed as all selected is violated by the widget projection.

Bulk selection acts on eligible visible choices, preserves hidden selections and reports mixed state over the eligible visible subset only. This example checks: An empty eligible set is not displayed as all selected.

split: open-access