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

N = 1
observations = []
def solve(d):
    return {'quantifier-caption':({'any':'at least one','all':'every','none':'no element','empty':'empty collection','missing':'missing field'}[d['mode']]), 'element-editor':(d['mode']!='missing'), 'unary-collection-value':(d['values'] if d['mode'] in ('any','all','none') else None), 'all-empty-warning':(d['mode']=='all' and d['values']==[]), 'empty-collection-evidence':(d['present'] and d['collection']==[]), 'operator-key':('collection.'+d['mode'])}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'mode': 'empty', 'values': [], 'present': False, 'collection': None}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'none', 'values': [], 'present': True, 'collection': None}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'any', 'values': ['x'], 'present': False, 'collection': []}, {'quantifier-caption': 'at least one', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.any'}), ({'mode': 'any', 'values': ['x', 'y'], 'present': True, 'collection': None}, {'quantifier-caption': 'at least one', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.any'}), ({'mode': 'all', 'values': [], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': True, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'all', 'values': ['x', 'y'], 'present': False, 'collection': []}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'none', 'values': ['x'], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'empty', 'values': [], 'present': False, 'collection': []}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x'], 'present': True, 'collection': None}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x', 'y'], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'})], 2: [({'mode': 'empty', 'values': [], 'present': False, 'collection': []}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'none', 'values': ['x'], 'present': False, 'collection': None}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'any', 'values': ['x', 'y'], 'present': False, 'collection': ['x']}, {'quantifier-caption': 'at least one', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.any'}), ({'mode': 'all', 'values': [], 'present': True, 'collection': []}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': True, 'empty-collection-evidence': True, 'operator-key': 'collection.all'}), ({'mode': 'all', 'values': ['x', 'y'], 'present': False, 'collection': None}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'none', 'values': [], 'present': False, 'collection': ['x']}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'none', 'values': ['x'], 'present': True, 'collection': []}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': True, 'operator-key': 'collection.none'}), ({'mode': 'empty', 'values': [], 'present': False, 'collection': None}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x'], 'present': False, 'collection': ['x']}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x', 'y'], 'present': True, 'collection': []}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': True, 'operator-key': 'collection.empty'})], 3: [({'mode': 'empty', 'values': [], 'present': False, 'collection': ['x']}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'none', 'values': ['x'], 'present': True, 'collection': None}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'all', 'values': [], 'present': True, 'collection': None}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': True, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'all', 'values': ['x'], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'none', 'values': [], 'present': False, 'collection': []}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'none', 'values': ['x', 'y'], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'empty', 'values': ['x'], 'present': False, 'collection': []}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x', 'y'], 'present': True, 'collection': None}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'missing', 'values': [], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'missing field', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.missing'}), ({'mode': 'missing', 'values': ['x', 'y'], 'present': False, 'collection': []}, {'quantifier-caption': 'missing field', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.missing'})], 4: [({'mode': 'empty', 'values': [], 'present': True, 'collection': None}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'none', 'values': ['x', 'y'], 'present': False, 'collection': None}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'all', 'values': ['x'], 'present': True, 'collection': []}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': True, 'operator-key': 'collection.all'}), ({'mode': 'none', 'values': [], 'present': False, 'collection': None}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'none', 'values': ['x'], 'present': False, 'collection': ['x']}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'none', 'values': ['x', 'y'], 'present': True, 'collection': []}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': True, 'operator-key': 'collection.none'}), ({'mode': 'empty', 'values': ['x'], 'present': False, 'collection': None}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x', 'y'], 'present': False, 'collection': ['x']}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'missing', 'values': [], 'present': True, 'collection': []}, {'quantifier-caption': 'missing field', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': True, 'operator-key': 'collection.missing'}), ({'mode': 'missing', 'values': ['x', 'y'], 'present': False, 'collection': None}, {'quantifier-caption': 'missing field', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.missing'})], 5: [({'mode': 'empty', 'values': [], 'present': True, 'collection': []}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': True, 'operator-key': 'collection.empty'}), ({'mode': 'none', 'values': ['x', 'y'], 'present': True, 'collection': None}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'all', 'values': ['x', 'y'], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'none', 'values': ['x'], 'present': False, 'collection': []}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'empty', 'values': [], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x', 'y'], 'present': False, 'collection': []}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'missing', 'values': [], 'present': True, 'collection': None}, {'quantifier-caption': 'missing field', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.missing'}), ({'mode': 'missing', 'values': ['x'], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'missing field', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.missing'}), ({'mode': 'any', 'values': [], 'present': False, 'collection': []}, {'quantifier-caption': 'at least one', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.any'}), ({'mode': 'any', 'values': ['x'], 'present': True, 'collection': None}, {'quantifier-caption': 'at least one', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.any'})]}
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 {'quantifier-caption':({'any':'at least one','all':'every','none':'no element','empty':'empty collection','missing':'missing field'}[d['mode']]), 'element-editor':(d['mode'] in ('any','all')), 'unary-collection-value':(d['values'] if d['mode'] in ('any','all','none') else None), 'all-empty-warning':(d['mode']=='all' and d['values']==[]), 'empty-collection-evidence':(d['present'] and d['collection']==[]), 'operator-key':('collection.'+d['mode'])}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'mode': 'empty', 'values': [], 'present': False, 'collection': None}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'none', 'values': [], 'present': True, 'collection': None}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'any', 'values': ['x'], 'present': False, 'collection': []}, {'quantifier-caption': 'at least one', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.any'}), ({'mode': 'any', 'values': ['x', 'y'], 'present': True, 'collection': None}, {'quantifier-caption': 'at least one', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.any'}), ({'mode': 'all', 'values': [], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': True, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'all', 'values': ['x', 'y'], 'present': False, 'collection': []}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'none', 'values': ['x'], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'empty', 'values': [], 'present': False, 'collection': []}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x'], 'present': True, 'collection': None}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x', 'y'], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'})], 2: [({'mode': 'empty', 'values': [], 'present': False, 'collection': []}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'none', 'values': ['x'], 'present': False, 'collection': None}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'any', 'values': ['x', 'y'], 'present': False, 'collection': ['x']}, {'quantifier-caption': 'at least one', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.any'}), ({'mode': 'all', 'values': [], 'present': True, 'collection': []}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': True, 'empty-collection-evidence': True, 'operator-key': 'collection.all'}), ({'mode': 'all', 'values': ['x', 'y'], 'present': False, 'collection': None}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'none', 'values': [], 'present': False, 'collection': ['x']}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'none', 'values': ['x'], 'present': True, 'collection': []}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': True, 'operator-key': 'collection.none'}), ({'mode': 'empty', 'values': [], 'present': False, 'collection': None}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x'], 'present': False, 'collection': ['x']}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x', 'y'], 'present': True, 'collection': []}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': True, 'operator-key': 'collection.empty'})], 3: [({'mode': 'empty', 'values': [], 'present': False, 'collection': ['x']}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'none', 'values': ['x'], 'present': True, 'collection': None}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'all', 'values': [], 'present': True, 'collection': None}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': True, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'all', 'values': ['x'], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'none', 'values': [], 'present': False, 'collection': []}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'none', 'values': ['x', 'y'], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'empty', 'values': ['x'], 'present': False, 'collection': []}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x', 'y'], 'present': True, 'collection': None}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'missing', 'values': [], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'missing field', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.missing'}), ({'mode': 'missing', 'values': ['x', 'y'], 'present': False, 'collection': []}, {'quantifier-caption': 'missing field', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.missing'})], 4: [({'mode': 'empty', 'values': [], 'present': True, 'collection': None}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'none', 'values': ['x', 'y'], 'present': False, 'collection': None}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'all', 'values': ['x'], 'present': True, 'collection': []}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': True, 'operator-key': 'collection.all'}), ({'mode': 'none', 'values': [], 'present': False, 'collection': None}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'none', 'values': ['x'], 'present': False, 'collection': ['x']}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'none', 'values': ['x', 'y'], 'present': True, 'collection': []}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': True, 'operator-key': 'collection.none'}), ({'mode': 'empty', 'values': ['x'], 'present': False, 'collection': None}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x', 'y'], 'present': False, 'collection': ['x']}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'missing', 'values': [], 'present': True, 'collection': []}, {'quantifier-caption': 'missing field', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': True, 'operator-key': 'collection.missing'}), ({'mode': 'missing', 'values': ['x', 'y'], 'present': False, 'collection': None}, {'quantifier-caption': 'missing field', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.missing'})], 5: [({'mode': 'empty', 'values': [], 'present': True, 'collection': []}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': True, 'operator-key': 'collection.empty'}), ({'mode': 'none', 'values': ['x', 'y'], 'present': True, 'collection': None}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'all', 'values': ['x', 'y'], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'none', 'values': ['x'], 'present': False, 'collection': []}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'empty', 'values': [], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x', 'y'], 'present': False, 'collection': []}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'missing', 'values': [], 'present': True, 'collection': None}, {'quantifier-caption': 'missing field', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.missing'}), ({'mode': 'missing', 'values': ['x'], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'missing field', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.missing'}), ({'mode': 'any', 'values': [], 'present': False, 'collection': []}, {'quantifier-caption': 'at least one', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.any'}), ({'mode': 'any', 'values': ['x'], 'present': True, 'collection': None}, {'quantifier-caption': 'at least one', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.any'})]}
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:
No-element matching still has operands while empty and missing modes do not is violated by the widget projection.

Collection-valued fields expose any/all/none element match modes distinct from empty-collection and missing-field predicates; switching to unary collection modes removes element operands. This example checks: No-element matching still has operands while empty and missing modes do not.

split: open-access


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

N = 1
observations = []
def solve(d):
    return {'quantifier-caption':({'any':'at least one','all':'every','none':'no element','empty':'empty collection','missing':'missing field'}[d['mode']]), 'element-editor':(d['mode'] in ('any','all','none')), 'unary-collection-value':(d['values']), 'all-empty-warning':(d['mode']=='all' and d['values']==[]), 'empty-collection-evidence':(d['present'] and d['collection']==[]), 'operator-key':('collection.'+d['mode'])}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'mode': 'empty', 'values': [], 'present': False, 'collection': None}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': [], 'present': True, 'collection': None}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'any', 'values': ['x'], 'present': False, 'collection': []}, {'quantifier-caption': 'at least one', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.any'}), ({'mode': 'any', 'values': ['x', 'y'], 'present': True, 'collection': None}, {'quantifier-caption': 'at least one', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.any'}), ({'mode': 'all', 'values': [], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': True, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'all', 'values': ['x', 'y'], 'present': False, 'collection': []}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'none', 'values': [], 'present': True, 'collection': None}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'none', 'values': ['x'], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'empty', 'values': [], 'present': False, 'collection': []}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x'], 'present': True, 'collection': None}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'})], 2: [({'mode': 'empty', 'values': [], 'present': False, 'collection': []}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x'], 'present': False, 'collection': None}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'any', 'values': ['x', 'y'], 'present': False, 'collection': ['x']}, {'quantifier-caption': 'at least one', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.any'}), ({'mode': 'all', 'values': [], 'present': True, 'collection': []}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': True, 'empty-collection-evidence': True, 'operator-key': 'collection.all'}), ({'mode': 'all', 'values': ['x', 'y'], 'present': False, 'collection': None}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'none', 'values': [], 'present': False, 'collection': ['x']}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'none', 'values': ['x'], 'present': True, 'collection': []}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': True, 'operator-key': 'collection.none'}), ({'mode': 'empty', 'values': [], 'present': False, 'collection': None}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x'], 'present': False, 'collection': ['x']}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x', 'y'], 'present': True, 'collection': []}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': True, 'operator-key': 'collection.empty'})], 3: [({'mode': 'empty', 'values': [], 'present': False, 'collection': ['x']}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x'], 'present': True, 'collection': None}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'all', 'values': [], 'present': True, 'collection': None}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': True, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'all', 'values': ['x'], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'none', 'values': [], 'present': False, 'collection': []}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'none', 'values': ['x'], 'present': True, 'collection': None}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'none', 'values': ['x', 'y'], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'empty', 'values': ['x'], 'present': False, 'collection': []}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x', 'y'], 'present': True, 'collection': None}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'missing', 'values': [], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'missing field', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.missing'})], 4: [({'mode': 'empty', 'values': [], 'present': True, 'collection': None}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x', 'y'], 'present': False, 'collection': None}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'all', 'values': ['x'], 'present': True, 'collection': []}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': True, 'operator-key': 'collection.all'}), ({'mode': 'none', 'values': [], 'present': False, 'collection': None}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'none', 'values': ['x'], 'present': False, 'collection': ['x']}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'none', 'values': ['x', 'y'], 'present': True, 'collection': []}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': True, 'operator-key': 'collection.none'}), ({'mode': 'empty', 'values': ['x'], 'present': False, 'collection': None}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x', 'y'], 'present': False, 'collection': ['x']}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'missing', 'values': [], 'present': True, 'collection': []}, {'quantifier-caption': 'missing field', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': True, 'operator-key': 'collection.missing'}), ({'mode': 'missing', 'values': ['x', 'y'], 'present': False, 'collection': None}, {'quantifier-caption': 'missing field', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.missing'})], 5: [({'mode': 'empty', 'values': [], 'present': True, 'collection': []}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': True, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x', 'y'], 'present': True, 'collection': None}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'all', 'values': ['x', 'y'], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'none', 'values': ['x'], 'present': False, 'collection': []}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'none', 'values': ['x', 'y'], 'present': True, 'collection': None}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'empty', 'values': [], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x', 'y'], 'present': False, 'collection': []}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'missing', 'values': [], 'present': True, 'collection': None}, {'quantifier-caption': 'missing field', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.missing'}), ({'mode': 'missing', 'values': ['x'], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'missing field', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.missing'}), ({'mode': 'any', 'values': [], 'present': False, 'collection': []}, {'quantifier-caption': 'at least one', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.any'})]}
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 {'quantifier-caption':({'any':'at least one','all':'every','none':'no element','empty':'empty collection','missing':'missing field'}[d['mode']]), 'element-editor':(d['mode'] in ('any','all','none')), 'unary-collection-value':(d['values'] if d['mode']!='missing' else None), 'all-empty-warning':(d['mode']=='all' and d['values']==[]), 'empty-collection-evidence':(d['present'] and d['collection']==[]), 'operator-key':('collection.'+d['mode'])}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'mode': 'empty', 'values': [], 'present': False, 'collection': None}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': [], 'present': True, 'collection': None}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'any', 'values': ['x'], 'present': False, 'collection': []}, {'quantifier-caption': 'at least one', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.any'}), ({'mode': 'any', 'values': ['x', 'y'], 'present': True, 'collection': None}, {'quantifier-caption': 'at least one', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.any'}), ({'mode': 'all', 'values': [], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': True, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'all', 'values': ['x', 'y'], 'present': False, 'collection': []}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'none', 'values': [], 'present': True, 'collection': None}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'none', 'values': ['x'], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'empty', 'values': [], 'present': False, 'collection': []}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x'], 'present': True, 'collection': None}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'})], 2: [({'mode': 'empty', 'values': [], 'present': False, 'collection': []}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x'], 'present': False, 'collection': None}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'any', 'values': ['x', 'y'], 'present': False, 'collection': ['x']}, {'quantifier-caption': 'at least one', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.any'}), ({'mode': 'all', 'values': [], 'present': True, 'collection': []}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': True, 'empty-collection-evidence': True, 'operator-key': 'collection.all'}), ({'mode': 'all', 'values': ['x', 'y'], 'present': False, 'collection': None}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'none', 'values': [], 'present': False, 'collection': ['x']}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'none', 'values': ['x'], 'present': True, 'collection': []}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': True, 'operator-key': 'collection.none'}), ({'mode': 'empty', 'values': [], 'present': False, 'collection': None}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x'], 'present': False, 'collection': ['x']}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x', 'y'], 'present': True, 'collection': []}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': True, 'operator-key': 'collection.empty'})], 3: [({'mode': 'empty', 'values': [], 'present': False, 'collection': ['x']}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x'], 'present': True, 'collection': None}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'all', 'values': [], 'present': True, 'collection': None}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': True, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'all', 'values': ['x'], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'none', 'values': [], 'present': False, 'collection': []}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'none', 'values': ['x'], 'present': True, 'collection': None}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'none', 'values': ['x', 'y'], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'empty', 'values': ['x'], 'present': False, 'collection': []}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x', 'y'], 'present': True, 'collection': None}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'missing', 'values': [], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'missing field', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.missing'})], 4: [({'mode': 'empty', 'values': [], 'present': True, 'collection': None}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x', 'y'], 'present': False, 'collection': None}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'all', 'values': ['x'], 'present': True, 'collection': []}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': True, 'operator-key': 'collection.all'}), ({'mode': 'none', 'values': [], 'present': False, 'collection': None}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'none', 'values': ['x'], 'present': False, 'collection': ['x']}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'none', 'values': ['x', 'y'], 'present': True, 'collection': []}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': True, 'operator-key': 'collection.none'}), ({'mode': 'empty', 'values': ['x'], 'present': False, 'collection': None}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x', 'y'], 'present': False, 'collection': ['x']}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'missing', 'values': [], 'present': True, 'collection': []}, {'quantifier-caption': 'missing field', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': True, 'operator-key': 'collection.missing'}), ({'mode': 'missing', 'values': ['x', 'y'], 'present': False, 'collection': None}, {'quantifier-caption': 'missing field', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.missing'})], 5: [({'mode': 'empty', 'values': [], 'present': True, 'collection': []}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': True, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x', 'y'], 'present': True, 'collection': None}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'all', 'values': ['x', 'y'], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'none', 'values': ['x'], 'present': False, 'collection': []}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'none', 'values': ['x', 'y'], 'present': True, 'collection': None}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'empty', 'values': [], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x', 'y'], 'present': False, 'collection': []}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'missing', 'values': [], 'present': True, 'collection': None}, {'quantifier-caption': 'missing field', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.missing'}), ({'mode': 'missing', 'values': ['x'], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'missing field', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.missing'}), ({'mode': 'any', 'values': [], 'present': False, 'collection': []}, {'quantifier-caption': 'at least one', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.any'})]}
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:
Unary collection predicates discard element-value payloads is violated by the widget projection.

Collection-valued fields expose any/all/none element match modes distinct from empty-collection and missing-field predicates; switching to unary collection modes removes element operands. This example checks: Unary collection predicates discard element-value payloads.

split: open-access


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

N = 1
observations = []
def solve(d):
    return {'quantifier-caption':({'any':'at least one','all':'every','none':'no element','empty':'empty collection','missing':'missing field'}[d['mode']]), 'element-editor':(d['mode'] in ('any','all','none')), 'unary-collection-value':(d['values'] if d['mode'] in ('any','all','none') else None), 'all-empty-warning':(d['values']==[]), 'empty-collection-evidence':(d['present'] and d['collection']==[]), 'operator-key':('collection.'+d['mode'])}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'mode': 'any', 'values': [], 'present': False, 'collection': None}, {'quantifier-caption': 'at least one', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.any'}), ({'mode': 'all', 'values': [], 'present': True, 'collection': None}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': True, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'any', 'values': ['x'], 'present': False, 'collection': []}, {'quantifier-caption': 'at least one', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.any'}), ({'mode': 'any', 'values': ['x', 'y'], 'present': True, 'collection': None}, {'quantifier-caption': 'at least one', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.any'}), ({'mode': 'all', 'values': [], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': True, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'all', 'values': ['x', 'y'], 'present': False, 'collection': []}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'none', 'values': [], 'present': True, 'collection': None}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'none', 'values': ['x'], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'empty', 'values': [], 'present': False, 'collection': []}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x'], 'present': True, 'collection': None}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'})], 2: [({'mode': 'any', 'values': [], 'present': False, 'collection': []}, {'quantifier-caption': 'at least one', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.any'}), ({'mode': 'all', 'values': [], 'present': False, 'collection': None}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': True, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'any', 'values': ['x', 'y'], 'present': False, 'collection': ['x']}, {'quantifier-caption': 'at least one', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.any'}), ({'mode': 'all', 'values': [], 'present': True, 'collection': []}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': True, 'empty-collection-evidence': True, 'operator-key': 'collection.all'}), ({'mode': 'all', 'values': ['x', 'y'], 'present': False, 'collection': None}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'none', 'values': [], 'present': False, 'collection': ['x']}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'none', 'values': ['x'], 'present': True, 'collection': []}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': True, 'operator-key': 'collection.none'}), ({'mode': 'empty', 'values': [], 'present': False, 'collection': None}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x'], 'present': False, 'collection': ['x']}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x', 'y'], 'present': True, 'collection': []}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': True, 'operator-key': 'collection.empty'})], 3: [({'mode': 'any', 'values': [], 'present': False, 'collection': ['x']}, {'quantifier-caption': 'at least one', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.any'}), ({'mode': 'all', 'values': [], 'present': True, 'collection': None}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': True, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'all', 'values': ['x'], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'none', 'values': [], 'present': False, 'collection': []}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'none', 'values': ['x'], 'present': True, 'collection': None}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'none', 'values': ['x', 'y'], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'empty', 'values': ['x'], 'present': False, 'collection': []}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x', 'y'], 'present': True, 'collection': None}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'missing', 'values': [], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'missing field', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.missing'}), ({'mode': 'missing', 'values': ['x', 'y'], 'present': False, 'collection': []}, {'quantifier-caption': 'missing field', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.missing'})], 4: [({'mode': 'any', 'values': [], 'present': True, 'collection': None}, {'quantifier-caption': 'at least one', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.any'}), ({'mode': 'all', 'values': [], 'present': False, 'collection': None}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': True, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'all', 'values': ['x'], 'present': True, 'collection': []}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': True, 'operator-key': 'collection.all'}), ({'mode': 'none', 'values': [], 'present': False, 'collection': None}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'none', 'values': ['x'], 'present': False, 'collection': ['x']}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'none', 'values': ['x', 'y'], 'present': True, 'collection': []}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': True, 'operator-key': 'collection.none'}), ({'mode': 'empty', 'values': ['x'], 'present': False, 'collection': None}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x', 'y'], 'present': False, 'collection': ['x']}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'missing', 'values': [], 'present': True, 'collection': []}, {'quantifier-caption': 'missing field', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': True, 'operator-key': 'collection.missing'}), ({'mode': 'missing', 'values': ['x', 'y'], 'present': False, 'collection': None}, {'quantifier-caption': 'missing field', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.missing'})], 5: [({'mode': 'any', 'values': [], 'present': True, 'collection': []}, {'quantifier-caption': 'at least one', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': False, 'empty-collection-evidence': True, 'operator-key': 'collection.any'}), ({'mode': 'all', 'values': [], 'present': True, 'collection': None}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': True, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'all', 'values': ['x', 'y'], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'none', 'values': ['x'], 'present': False, 'collection': []}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'none', 'values': ['x', 'y'], 'present': True, 'collection': None}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'empty', 'values': [], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x', 'y'], 'present': False, 'collection': []}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'missing', 'values': [], 'present': True, 'collection': None}, {'quantifier-caption': 'missing field', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.missing'}), ({'mode': 'missing', 'values': ['x'], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'missing field', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.missing'}), ({'mode': 'any', 'values': [], 'present': False, 'collection': []}, {'quantifier-caption': 'at least one', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.any'})]}
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 {'quantifier-caption':({'any':'at least one','all':'every','none':'no element','empty':'empty collection','missing':'missing field'}[d['mode']]), 'element-editor':(d['mode'] in ('any','all','none')), 'unary-collection-value':(d['values'] if d['mode'] in ('any','all','none') else None), 'all-empty-warning':(False), 'empty-collection-evidence':(d['present'] and d['collection']==[]), 'operator-key':('collection.'+d['mode'])}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'mode': 'any', 'values': [], 'present': False, 'collection': None}, {'quantifier-caption': 'at least one', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.any'}), ({'mode': 'all', 'values': [], 'present': True, 'collection': None}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': True, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'any', 'values': ['x'], 'present': False, 'collection': []}, {'quantifier-caption': 'at least one', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.any'}), ({'mode': 'any', 'values': ['x', 'y'], 'present': True, 'collection': None}, {'quantifier-caption': 'at least one', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.any'}), ({'mode': 'all', 'values': [], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': True, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'all', 'values': ['x', 'y'], 'present': False, 'collection': []}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'none', 'values': [], 'present': True, 'collection': None}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'none', 'values': ['x'], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'empty', 'values': [], 'present': False, 'collection': []}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x'], 'present': True, 'collection': None}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'})], 2: [({'mode': 'any', 'values': [], 'present': False, 'collection': []}, {'quantifier-caption': 'at least one', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.any'}), ({'mode': 'all', 'values': [], 'present': False, 'collection': None}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': True, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'any', 'values': ['x', 'y'], 'present': False, 'collection': ['x']}, {'quantifier-caption': 'at least one', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.any'}), ({'mode': 'all', 'values': [], 'present': True, 'collection': []}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': True, 'empty-collection-evidence': True, 'operator-key': 'collection.all'}), ({'mode': 'all', 'values': ['x', 'y'], 'present': False, 'collection': None}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'none', 'values': [], 'present': False, 'collection': ['x']}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'none', 'values': ['x'], 'present': True, 'collection': []}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': True, 'operator-key': 'collection.none'}), ({'mode': 'empty', 'values': [], 'present': False, 'collection': None}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x'], 'present': False, 'collection': ['x']}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x', 'y'], 'present': True, 'collection': []}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': True, 'operator-key': 'collection.empty'})], 3: [({'mode': 'any', 'values': [], 'present': False, 'collection': ['x']}, {'quantifier-caption': 'at least one', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.any'}), ({'mode': 'all', 'values': [], 'present': True, 'collection': None}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': True, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'all', 'values': ['x'], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'none', 'values': [], 'present': False, 'collection': []}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'none', 'values': ['x'], 'present': True, 'collection': None}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'none', 'values': ['x', 'y'], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'empty', 'values': ['x'], 'present': False, 'collection': []}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x', 'y'], 'present': True, 'collection': None}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'missing', 'values': [], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'missing field', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.missing'}), ({'mode': 'missing', 'values': ['x', 'y'], 'present': False, 'collection': []}, {'quantifier-caption': 'missing field', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.missing'})], 4: [({'mode': 'any', 'values': [], 'present': True, 'collection': None}, {'quantifier-caption': 'at least one', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.any'}), ({'mode': 'all', 'values': [], 'present': False, 'collection': None}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': True, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'all', 'values': ['x'], 'present': True, 'collection': []}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': True, 'operator-key': 'collection.all'}), ({'mode': 'none', 'values': [], 'present': False, 'collection': None}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'none', 'values': ['x'], 'present': False, 'collection': ['x']}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'none', 'values': ['x', 'y'], 'present': True, 'collection': []}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': True, 'operator-key': 'collection.none'}), ({'mode': 'empty', 'values': ['x'], 'present': False, 'collection': None}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x', 'y'], 'present': False, 'collection': ['x']}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'missing', 'values': [], 'present': True, 'collection': []}, {'quantifier-caption': 'missing field', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': True, 'operator-key': 'collection.missing'}), ({'mode': 'missing', 'values': ['x', 'y'], 'present': False, 'collection': None}, {'quantifier-caption': 'missing field', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.missing'})], 5: [({'mode': 'any', 'values': [], 'present': True, 'collection': []}, {'quantifier-caption': 'at least one', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': False, 'empty-collection-evidence': True, 'operator-key': 'collection.any'}), ({'mode': 'all', 'values': [], 'present': True, 'collection': None}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': True, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'all', 'values': ['x', 'y'], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'every', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.all'}), ({'mode': 'none', 'values': ['x'], 'present': False, 'collection': []}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'none', 'values': ['x', 'y'], 'present': True, 'collection': None}, {'quantifier-caption': 'no element', 'element-editor': True, 'unary-collection-value': ['x', 'y'], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.none'}), ({'mode': 'empty', 'values': [], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'empty', 'values': ['x', 'y'], 'present': False, 'collection': []}, {'quantifier-caption': 'empty collection', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.empty'}), ({'mode': 'missing', 'values': [], 'present': True, 'collection': None}, {'quantifier-caption': 'missing field', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.missing'}), ({'mode': 'missing', 'values': ['x'], 'present': True, 'collection': ['x']}, {'quantifier-caption': 'missing field', 'element-editor': False, 'unary-collection-value': None, 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.missing'}), ({'mode': 'any', 'values': [], 'present': False, 'collection': []}, {'quantifier-caption': 'at least one', 'element-editor': True, 'unary-collection-value': [], 'all-empty-warning': False, 'empty-collection-evidence': False, 'operator-key': 'collection.any'})]}
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:
Empty all-element constraints receive their explicit vacuity warning is violated by the widget projection.

Collection-valued fields expose any/all/none element match modes distinct from empty-collection and missing-field predicates; switching to unary collection modes removes element operands. This example checks: Empty all-element constraints receive their explicit vacuity warning.

split: open-access