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

N = 1
observations = []
def solve(d):
    return {'selected-id':([x['id'] for x in d['presets'] if x['name']==d['caption']]), 'visible-scope':([x['id'] for x in d['presets'] if x['scope']==d['scope']]), 'modified-label':(d['caption']+(' (modified)' if d['dirty'] else '')), 'missing-active':(d['active'] is not None and not any(x['id']==d['active'] for x in d['presets'])), 'duplicate-caption':(sum(x['name']==d['caption'] for x in d['presets'])>1), 'apply-selected':(next((x['criteria'] for x in d['presets'] if x['id']==d['active']),None))}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Same', 'scope': 'a', 'dirty': False}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Same', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': None, 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': None, 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'p', 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'q', 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'gone', 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'p', 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': ['p'], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'q', 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'gone', 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None})], 2: [({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Same', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': None, 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'p', 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'q', 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'gone', 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'p', 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': ['p'], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'q', 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'gone', 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': None, 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': ['q'], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None})], 3: [({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Same', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Same', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'p', 'caption': 'Same', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Same (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'q', 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'gone', 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'p', 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': ['p'], 'visible-scope': ['p'], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'q', 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'gone', 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': None, 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'p', 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': ['p'], 'visible-scope': ['p'], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']})], 4: [({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'p', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'gone', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'p', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': ['p'], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'q', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'gone', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': None, 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'p', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': ['p'], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'q', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': ['q'], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['y']})], 5: [({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'p', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': ['p'], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']}), ({'presets': [], 'active': 'p', 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'p', 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': ['p'], 'visible-scope': [], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'q', 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Same (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'gone', 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Same (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': None, 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': ['q'], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': True, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'p', 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': ['p'], 'visible-scope': ['q'], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': True, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'q', 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': ['q'], 'visible-scope': ['q'], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': True, 'apply-selected': ['y']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'gone', 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': ['q'], 'modified-label': 'Same (modified)', 'missing-active': True, 'duplicate-caption': True, 'apply-selected': None})]}
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 {'selected-id':([d['active']]), 'visible-scope':([x['id'] for x in d['presets'] if x['scope']==d['scope']]), 'modified-label':(d['caption']+(' (modified)' if d['dirty'] else '')), 'missing-active':(d['active'] is not None and not any(x['id']==d['active'] for x in d['presets'])), 'duplicate-caption':(sum(x['name']==d['caption'] for x in d['presets'])>1), 'apply-selected':(next((x['criteria'] for x in d['presets'] if x['id']==d['active']),None))}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Same', 'scope': 'a', 'dirty': False}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Same', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': None, 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': None, 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'p', 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'q', 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'gone', 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'p', 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': ['p'], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'q', 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'gone', 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None})], 2: [({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Same', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': None, 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'p', 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'q', 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'gone', 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'p', 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': ['p'], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'q', 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'gone', 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': None, 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': ['q'], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None})], 3: [({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Same', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Same', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'p', 'caption': 'Same', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Same (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'q', 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'gone', 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'p', 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': ['p'], 'visible-scope': ['p'], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'q', 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'gone', 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': None, 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'p', 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': ['p'], 'visible-scope': ['p'], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']})], 4: [({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'p', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'gone', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'p', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': ['p'], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'q', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'gone', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': None, 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'p', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': ['p'], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'q', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': ['q'], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['y']})], 5: [({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'p', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': ['p'], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']}), ({'presets': [], 'active': 'p', 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'p', 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': ['p'], 'visible-scope': [], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'q', 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Same (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'gone', 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Same (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': None, 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': ['q'], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': True, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'p', 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': ['p'], 'visible-scope': ['q'], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': True, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'q', 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': ['q'], 'visible-scope': ['q'], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': True, 'apply-selected': ['y']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'gone', 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': ['q'], 'modified-label': 'Same (modified)', 'missing-active': True, 'duplicate-caption': True, 'apply-selected': None})]}
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:
Preset picker selection follows a present stable identifier is violated by the widget projection.

The preset picker identifies saved configurations by ID rather than caption, filters visibility by scope, and differentiates selected, modified and unavailable saved views. This example checks: Preset picker selection follows a present stable identifier.

split: open-access


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

N = 1
observations = []
def solve(d):
    return {'selected-id':([x['id'] for x in d['presets'] if x['id']==d['active']]), 'visible-scope':([x['id'] for x in d['presets']]), 'modified-label':(d['caption']+(' (modified)' if d['dirty'] else '')), 'missing-active':(d['active'] is not None and not any(x['id']==d['active'] for x in d['presets'])), 'duplicate-caption':(sum(x['name']==d['caption'] for x in d['presets'])>1), 'apply-selected':(next((x['criteria'] for x in d['presets'] if x['id']==d['active']),None))}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Same', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Same', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': None, 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': None, 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'p', 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'q', 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'gone', 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'p', 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': ['p'], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'q', 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'gone', 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None})], 2: [({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'p', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': ['p'], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']}), ({'presets': [], 'active': 'p', 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'q', 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'gone', 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'p', 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': ['p'], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'q', 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'gone', 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': None, 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': ['q'], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None})], 3: [({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'q', 'caption': 'Same', 'scope': 'a', 'dirty': True}, {'selected-id': ['q'], 'visible-scope': ['p'], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': True, 'apply-selected': ['y']}), ({'presets': [], 'active': 'q', 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'gone', 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'p', 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': ['p'], 'visible-scope': ['p'], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'q', 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'gone', 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': None, 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'p', 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': ['p'], 'visible-scope': ['p'], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']})], 4: [({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'gone', 'caption': 'Same', 'scope': 'a', 'dirty': False}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Same', 'missing-active': True, 'duplicate-caption': True, 'apply-selected': None}), ({'presets': [], 'active': 'gone', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'p', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': ['p'], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'q', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'gone', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': None, 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'p', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': ['p'], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'q', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': ['q'], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['y']})], 5: [({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'p', 'caption': 'Same', 'scope': 'ab', 'dirty': False}, {'selected-id': ['p'], 'visible-scope': [], 'modified-label': 'Same', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'gone', 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'p', 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': ['p'], 'visible-scope': [], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'q', 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Same (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'gone', 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Same (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': None, 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': ['q'], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': True, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'p', 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': ['p'], 'visible-scope': ['q'], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': True, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'q', 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': ['q'], 'visible-scope': ['q'], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': True, 'apply-selected': ['y']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'gone', 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': ['q'], 'modified-label': 'Same (modified)', 'missing-active': True, 'duplicate-caption': True, 'apply-selected': None})]}
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 {'selected-id':([x['id'] for x in d['presets'] if x['id']==d['active']]), 'visible-scope':([x['id'] for x in d['presets'] if d['scope'] in x['scope']]), 'modified-label':(d['caption']+(' (modified)' if d['dirty'] else '')), 'missing-active':(d['active'] is not None and not any(x['id']==d['active'] for x in d['presets'])), 'duplicate-caption':(sum(x['name']==d['caption'] for x in d['presets'])>1), 'apply-selected':(next((x['criteria'] for x in d['presets'] if x['id']==d['active']),None))}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Same', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Same', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': None, 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': None, 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'p', 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'q', 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'gone', 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'p', 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': ['p'], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'q', 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'gone', 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None})], 2: [({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'p', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': ['p'], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']}), ({'presets': [], 'active': 'p', 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'q', 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'gone', 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'p', 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': ['p'], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'q', 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'gone', 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': None, 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': ['q'], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None})], 3: [({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'q', 'caption': 'Same', 'scope': 'a', 'dirty': True}, {'selected-id': ['q'], 'visible-scope': ['p'], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': True, 'apply-selected': ['y']}), ({'presets': [], 'active': 'q', 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'gone', 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'p', 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': ['p'], 'visible-scope': ['p'], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'q', 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'gone', 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': None, 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'p', 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': ['p'], 'visible-scope': ['p'], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']})], 4: [({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'gone', 'caption': 'Same', 'scope': 'a', 'dirty': False}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Same', 'missing-active': True, 'duplicate-caption': True, 'apply-selected': None}), ({'presets': [], 'active': 'gone', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'p', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': ['p'], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'q', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'gone', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': None, 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'p', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': ['p'], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'q', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': ['q'], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['y']})], 5: [({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'p', 'caption': 'Same', 'scope': 'ab', 'dirty': False}, {'selected-id': ['p'], 'visible-scope': [], 'modified-label': 'Same', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'gone', 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'p', 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': ['p'], 'visible-scope': [], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'q', 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Same (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'gone', 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Same (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': None, 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': ['q'], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': True, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'p', 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': ['p'], 'visible-scope': ['q'], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': True, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'q', 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': ['q'], 'visible-scope': ['q'], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': True, 'apply-selected': ['y']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'gone', 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': ['q'], 'modified-label': 'Same (modified)', 'missing-active': True, 'duplicate-caption': True, 'apply-selected': None})]}
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:
Preset choices use exact compatible scope is violated by the widget projection.

The preset picker identifies saved configurations by ID rather than caption, filters visibility by scope, and differentiates selected, modified and unavailable saved views. This example checks: Preset choices use exact compatible scope.

split: open-access


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

N = 1
observations = []
def solve(d):
    return {'selected-id':([x['id'] for x in d['presets'] if x['id']==d['active']]), 'visible-scope':([x['id'] for x in d['presets'] if x['scope']==d['scope']]), 'modified-label':(d['caption']), 'missing-active':(d['active'] is not None and not any(x['id']==d['active'] for x in d['presets'])), 'duplicate-caption':(sum(x['name']==d['caption'] for x in d['presets'])>1), 'apply-selected':(next((x['criteria'] for x in d['presets'] if x['id']==d['active']),None))}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'presets': [], 'active': None, 'caption': 'Same', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': None, 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': None, 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'p', 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'q', 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'gone', 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'p', 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': ['p'], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'q', 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'gone', 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None})], 2: [({'presets': [], 'active': None, 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'p', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'p', 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'q', 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'gone', 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'p', 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': ['p'], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'q', 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'gone', 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': None, 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': ['q'], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None})], 3: [({'presets': [], 'active': None, 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'q', 'caption': 'Same', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Same', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'q', 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'gone', 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'p', 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': ['p'], 'visible-scope': ['p'], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'q', 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'gone', 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': None, 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'p', 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': ['p'], 'visible-scope': ['p'], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']})], 4: [({'presets': [], 'active': None, 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'gone', 'caption': 'Same', 'scope': 'a', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Same', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'gone', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'p', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': ['p'], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'q', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'gone', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': None, 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'p', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': ['p'], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'q', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': ['q'], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['y']})], 5: [({'presets': [], 'active': 'p', 'caption': 'Same', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Same (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'gone', 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'p', 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': ['p'], 'visible-scope': [], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'q', 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Same (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'gone', 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Same (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': None, 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': ['q'], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': True, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'p', 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': ['p'], 'visible-scope': ['q'], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': True, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'q', 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': ['q'], 'visible-scope': ['q'], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': True, 'apply-selected': ['y']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'gone', 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': ['q'], 'modified-label': 'Same (modified)', 'missing-active': True, 'duplicate-caption': True, 'apply-selected': None})]}
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 {'selected-id':([x['id'] for x in d['presets'] if x['id']==d['active']]), 'visible-scope':([x['id'] for x in d['presets'] if x['scope']==d['scope']]), 'modified-label':(d['caption']+' (modified)'), 'missing-active':(d['active'] is not None and not any(x['id']==d['active'] for x in d['presets'])), 'duplicate-caption':(sum(x['name']==d['caption'] for x in d['presets'])>1), 'apply-selected':(next((x['criteria'] for x in d['presets'] if x['id']==d['active']),None))}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'presets': [], 'active': None, 'caption': 'Same', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': None, 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': None, 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'p', 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'q', 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'gone', 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'p', 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': ['p'], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'q', 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'gone', 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None})], 2: [({'presets': [], 'active': None, 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'p', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'p', 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'q', 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'gone', 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'p', 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': ['p'], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'q', 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'gone', 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': None, 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': ['q'], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None})], 3: [({'presets': [], 'active': None, 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'q', 'caption': 'Same', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Same', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'q', 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'gone', 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'p', 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': ['p'], 'visible-scope': ['p'], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'q', 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'gone', 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': None, 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'p', 'caption': 'Other', 'scope': 'a', 'dirty': True}, {'selected-id': ['p'], 'visible-scope': ['p'], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']})], 4: [({'presets': [], 'active': None, 'caption': 'Other', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'gone', 'caption': 'Same', 'scope': 'a', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Same', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'gone', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'p', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': ['p'], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'q', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'gone', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': None, 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': [], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'p', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': ['p'], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'q', 'caption': 'Other', 'scope': 'a', 'dirty': False}, {'selected-id': ['q'], 'visible-scope': ['p'], 'modified-label': 'Other', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['y']})], 5: [({'presets': [], 'active': 'p', 'caption': 'Same', 'scope': 'a', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Same (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [], 'active': 'gone', 'caption': 'Other', 'scope': 'ab', 'dirty': False}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Other', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': None, 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'p', 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': ['p'], 'visible-scope': [], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': False, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'q', 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Same (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}], 'active': 'gone', 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': [], 'modified-label': 'Same (modified)', 'missing-active': True, 'duplicate-caption': False, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': None, 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': ['q'], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': True, 'apply-selected': None}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'p', 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': ['p'], 'visible-scope': ['q'], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': True, 'apply-selected': ['x']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'q', 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': ['q'], 'visible-scope': ['q'], 'modified-label': 'Same (modified)', 'missing-active': False, 'duplicate-caption': True, 'apply-selected': ['y']}), ({'presets': [{'id': 'p', 'name': 'Same', 'scope': 'a', 'criteria': ['x']}, {'id': 'q', 'name': 'Same', 'scope': 'ab', 'criteria': ['y']}], 'active': 'gone', 'caption': 'Same', 'scope': 'ab', 'dirty': True}, {'selected-id': [], 'visible-scope': ['q'], 'modified-label': 'Same (modified)', 'missing-active': True, 'duplicate-caption': True, 'apply-selected': None})]}
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:
Dirty preset selection is visibly marked modified is violated by the widget projection.

The preset picker identifies saved configurations by ID rather than caption, filters visibility by scope, and differentiates selected, modified and unavailable saved views. This example checks: Dirty preset selection is visibly marked modified.

split: open-access