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

N = 1
observations = []
def solve(d):
    return {'normalize-drag':([min(d['start'],d['end']),max(d['start'],d['end'])]), 'bucket-intersection':([i for i,(a,b) in enumerate(d['bins']) if a<=max(d['start'],d['end']) and b>=min(d['start'],d['end'])]), 'click-no-range':(d['start']==d['end']), 'brush-domain-start':(max(d['minimum'],min(d['start'],d['end']))), 'brush-domain-end':(min(d['maximum'],max(d['start'],d['end']))), 'brush-publish':(d['released'] and d['start']!=d['end'])}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'start': -1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [-1, 0], 'bucket-intersection': [], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 0, 'brush-publish': False}), ({'start': -1, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [-1, 5], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': 0, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': False}), ({'start': 0, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 2], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 2, 'brush-publish': True}), ({'start': 1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': False}), ({'start': 1, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [1, 1], 'bucket-intersection': [], 'click-no-range': True, 'brush-domain-start': 1, 'brush-domain-end': 1, 'brush-publish': False}), ({'start': 1, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [1, 5], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 3, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 3], 'bucket-intersection': [0, 1], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 3, 'brush-publish': True}), ({'start': 3, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [2, 3], 'bucket-intersection': [1], 'click-no-range': False, 'brush-domain-start': 2, 'brush-domain-end': 3, 'brush-publish': False}), ({'start': 3, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [3, 5], 'bucket-intersection': [1, 2], 'click-no-range': False, 'brush-domain-start': 3, 'brush-domain-end': 5, 'brush-publish': True})], 2: [({'start': -1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [-1, 0], 'bucket-intersection': [], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 0, 'brush-publish': True}), ({'start': 0, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 5], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': True}), ({'start': 1, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [1, 2], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 2, 'brush-publish': False}), ({'start': 1, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [1, 5], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': 3, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [1, 3], 'bucket-intersection': [0, 1], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 3, 'brush-publish': False}), ({'start': 3, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [2, 3], 'bucket-intersection': [1], 'click-no-range': False, 'brush-domain-start': 2, 'brush-domain-end': 3, 'brush-publish': True}), ({'start': 6, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 6], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 6, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [1, 6], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': 6, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [5, 6], 'bucket-intersection': [2], 'click-no-range': False, 'brush-domain-start': 5, 'brush-domain-end': 5, 'brush-publish': False})], 3: [({'start': -1, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [-1, 2], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 2, 'brush-publish': False}), ({'start': 1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': True}), ({'start': 1, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [1, 2], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 2, 'brush-publish': True}), ({'start': 3, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 3], 'bucket-intersection': [0, 1], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 3, 'brush-publish': False}), ({'start': 3, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [1, 3], 'bucket-intersection': [0, 1], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 3, 'brush-publish': True}), ({'start': 3, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [3, 5], 'bucket-intersection': [1, 2], 'click-no-range': False, 'brush-domain-start': 3, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 6, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 6], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': 6, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [2, 6], 'bucket-intersection': [1, 2], 'click-no-range': False, 'brush-domain-start': 2, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 6, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [5, 6], 'bucket-intersection': [2], 'click-no-range': False, 'brush-domain-start': 5, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': -1, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [-1, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': False})], 4: [({'start': -1, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [-1, 2], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 2, 'brush-publish': True}), ({'start': 1, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [1, 5], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 3, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [2, 3], 'bucket-intersection': [1], 'click-no-range': False, 'brush-domain-start': 2, 'brush-domain-end': 3, 'brush-publish': False}), ({'start': 3, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [3, 5], 'bucket-intersection': [1, 2], 'click-no-range': False, 'brush-domain-start': 3, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': 6, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [1, 6], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 6, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [2, 6], 'bucket-intersection': [1, 2], 'click-no-range': False, 'brush-domain-start': 2, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': -1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [-1, 0], 'bucket-intersection': [], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 0, 'brush-publish': False}), ({'start': -1, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [-1, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': True}), ({'start': -1, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [-1, 5], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 0, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 0], 'bucket-intersection': [], 'click-no-range': True, 'brush-domain-start': 0, 'brush-domain-end': 0, 'brush-publish': False})], 5: [({'start': 0, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 0], 'bucket-intersection': [], 'click-no-range': True, 'brush-domain-start': 0, 'brush-domain-end': 0, 'brush-publish': False}), ({'start': 3, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 3], 'bucket-intersection': [0, 1], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 3, 'brush-publish': True}), ({'start': 6, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [1, 6], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': 6, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [5, 6], 'bucket-intersection': [2], 'click-no-range': False, 'brush-domain-start': 5, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': -1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [-1, 0], 'bucket-intersection': [], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 0, 'brush-publish': True}), ({'start': -1, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [-1, 2], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 2, 'brush-publish': False}), ({'start': -1, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [-1, 5], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': 0, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': False}), ({'start': 0, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 2], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 2, 'brush-publish': True}), ({'start': 1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': False})]}
for index, (data, expected) in enumerate(fixtures[N]):
    check("contract fixture " + str(index), solve(data), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(d):
    return {'normalize-drag':([min(d['start'],d['end']),max(d['start'],d['end'])]), 'bucket-intersection':([i for i,(a,b) in enumerate(d['bins']) if a>=min(d['start'],d['end']) and b<=max(d['start'],d['end'])]), 'click-no-range':(d['start']==d['end']), 'brush-domain-start':(max(d['minimum'],min(d['start'],d['end']))), 'brush-domain-end':(min(d['maximum'],max(d['start'],d['end']))), 'brush-publish':(d['released'] and d['start']!=d['end'])}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'start': -1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [-1, 0], 'bucket-intersection': [], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 0, 'brush-publish': False}), ({'start': -1, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [-1, 5], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': 0, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': False}), ({'start': 0, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 2], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 2, 'brush-publish': True}), ({'start': 1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': False}), ({'start': 1, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [1, 1], 'bucket-intersection': [], 'click-no-range': True, 'brush-domain-start': 1, 'brush-domain-end': 1, 'brush-publish': False}), ({'start': 1, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [1, 5], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 3, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 3], 'bucket-intersection': [0, 1], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 3, 'brush-publish': True}), ({'start': 3, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [2, 3], 'bucket-intersection': [1], 'click-no-range': False, 'brush-domain-start': 2, 'brush-domain-end': 3, 'brush-publish': False}), ({'start': 3, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [3, 5], 'bucket-intersection': [1, 2], 'click-no-range': False, 'brush-domain-start': 3, 'brush-domain-end': 5, 'brush-publish': True})], 2: [({'start': -1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [-1, 0], 'bucket-intersection': [], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 0, 'brush-publish': True}), ({'start': 0, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 5], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': True}), ({'start': 1, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [1, 2], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 2, 'brush-publish': False}), ({'start': 1, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [1, 5], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': 3, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [1, 3], 'bucket-intersection': [0, 1], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 3, 'brush-publish': False}), ({'start': 3, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [2, 3], 'bucket-intersection': [1], 'click-no-range': False, 'brush-domain-start': 2, 'brush-domain-end': 3, 'brush-publish': True}), ({'start': 6, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 6], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 6, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [1, 6], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': 6, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [5, 6], 'bucket-intersection': [2], 'click-no-range': False, 'brush-domain-start': 5, 'brush-domain-end': 5, 'brush-publish': False})], 3: [({'start': -1, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [-1, 2], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 2, 'brush-publish': False}), ({'start': 1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': True}), ({'start': 1, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [1, 2], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 2, 'brush-publish': True}), ({'start': 3, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 3], 'bucket-intersection': [0, 1], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 3, 'brush-publish': False}), ({'start': 3, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [1, 3], 'bucket-intersection': [0, 1], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 3, 'brush-publish': True}), ({'start': 3, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [3, 5], 'bucket-intersection': [1, 2], 'click-no-range': False, 'brush-domain-start': 3, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 6, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 6], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': 6, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [2, 6], 'bucket-intersection': [1, 2], 'click-no-range': False, 'brush-domain-start': 2, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 6, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [5, 6], 'bucket-intersection': [2], 'click-no-range': False, 'brush-domain-start': 5, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': -1, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [-1, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': False})], 4: [({'start': -1, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [-1, 2], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 2, 'brush-publish': True}), ({'start': 1, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [1, 5], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 3, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [2, 3], 'bucket-intersection': [1], 'click-no-range': False, 'brush-domain-start': 2, 'brush-domain-end': 3, 'brush-publish': False}), ({'start': 3, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [3, 5], 'bucket-intersection': [1, 2], 'click-no-range': False, 'brush-domain-start': 3, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': 6, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [1, 6], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 6, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [2, 6], 'bucket-intersection': [1, 2], 'click-no-range': False, 'brush-domain-start': 2, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': -1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [-1, 0], 'bucket-intersection': [], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 0, 'brush-publish': False}), ({'start': -1, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [-1, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': True}), ({'start': -1, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [-1, 5], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 0, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 0], 'bucket-intersection': [], 'click-no-range': True, 'brush-domain-start': 0, 'brush-domain-end': 0, 'brush-publish': False})], 5: [({'start': 0, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 0], 'bucket-intersection': [], 'click-no-range': True, 'brush-domain-start': 0, 'brush-domain-end': 0, 'brush-publish': False}), ({'start': 3, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 3], 'bucket-intersection': [0, 1], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 3, 'brush-publish': True}), ({'start': 6, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [1, 6], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': 6, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [5, 6], 'bucket-intersection': [2], 'click-no-range': False, 'brush-domain-start': 5, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': -1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [-1, 0], 'bucket-intersection': [], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 0, 'brush-publish': True}), ({'start': -1, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [-1, 2], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 2, 'brush-publish': False}), ({'start': -1, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [-1, 5], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': 0, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': False}), ({'start': 0, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 2], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 2, 'brush-publish': True}), ({'start': 1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': False})]}
for index, (data, expected) in enumerate(fixtures[N]):
    check("contract fixture " + str(index), solve(data), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Brush overlap excludes touching-only buckets and includes partially intersected ones is violated by the widget projection.

A histogram brush selects intersecting bucket identities over a half-open horizontal interval; clicks without width do not create a range and the final brush converts to domain edges. This example checks: Brush overlap excludes touching-only buckets and includes partially intersected ones.

split: open-access


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

N = 1
observations = []
def solve(d):
    return {'normalize-drag':([min(d['start'],d['end']),max(d['start'],d['end'])]), 'bucket-intersection':([i for i,(a,b) in enumerate(d['bins']) if a<max(d['start'],d['end']) and b>min(d['start'],d['end'])] if d['start']!=d['end'] else []), 'click-no-range':(abs(d['start']-d['end'])<=1), 'brush-domain-start':(max(d['minimum'],min(d['start'],d['end']))), 'brush-domain-end':(min(d['maximum'],max(d['start'],d['end']))), 'brush-publish':(d['released'] and d['start']!=d['end'])}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'start': -1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [-1, 0], 'bucket-intersection': [], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 0, 'brush-publish': False}), ({'start': 1, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [1, 1], 'bucket-intersection': [], 'click-no-range': True, 'brush-domain-start': 1, 'brush-domain-end': 1, 'brush-publish': False}), ({'start': -1, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [-1, 5], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': 0, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': False}), ({'start': 0, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 2], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 2, 'brush-publish': True}), ({'start': 1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': False}), ({'start': 1, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [1, 5], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 3, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 3], 'bucket-intersection': [0, 1], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 3, 'brush-publish': True}), ({'start': 3, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [2, 3], 'bucket-intersection': [1], 'click-no-range': False, 'brush-domain-start': 2, 'brush-domain-end': 3, 'brush-publish': False}), ({'start': 3, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [3, 5], 'bucket-intersection': [1, 2], 'click-no-range': False, 'brush-domain-start': 3, 'brush-domain-end': 5, 'brush-publish': True})], 2: [({'start': -1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [-1, 0], 'bucket-intersection': [], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 0, 'brush-publish': True}), ({'start': 1, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [1, 1], 'bucket-intersection': [], 'click-no-range': True, 'brush-domain-start': 1, 'brush-domain-end': 1, 'brush-publish': False}), ({'start': 0, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 5], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': True}), ({'start': 1, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [1, 2], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 2, 'brush-publish': False}), ({'start': 1, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [1, 5], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': 3, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [1, 3], 'bucket-intersection': [0, 1], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 3, 'brush-publish': False}), ({'start': 3, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [2, 3], 'bucket-intersection': [1], 'click-no-range': False, 'brush-domain-start': 2, 'brush-domain-end': 3, 'brush-publish': True}), ({'start': 6, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 6], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 6, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [1, 6], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 5, 'brush-publish': True})], 3: [({'start': 0, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': False}), ({'start': 0, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 0], 'bucket-intersection': [], 'click-no-range': True, 'brush-domain-start': 0, 'brush-domain-end': 0, 'brush-publish': False}), ({'start': 1, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [1, 2], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 2, 'brush-publish': True}), ({'start': 3, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 3], 'bucket-intersection': [0, 1], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 3, 'brush-publish': False}), ({'start': 3, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [1, 3], 'bucket-intersection': [0, 1], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 3, 'brush-publish': True}), ({'start': 3, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [3, 5], 'bucket-intersection': [1, 2], 'click-no-range': False, 'brush-domain-start': 3, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 6, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 6], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': 6, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [2, 6], 'bucket-intersection': [1, 2], 'click-no-range': False, 'brush-domain-start': 2, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 6, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [5, 6], 'bucket-intersection': [2], 'click-no-range': False, 'brush-domain-start': 5, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': -1, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [-1, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': False})], 4: [({'start': 0, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': True}), ({'start': 0, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 0], 'bucket-intersection': [], 'click-no-range': True, 'brush-domain-start': 0, 'brush-domain-end': 0, 'brush-publish': False}), ({'start': 3, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [2, 3], 'bucket-intersection': [1], 'click-no-range': False, 'brush-domain-start': 2, 'brush-domain-end': 3, 'brush-publish': False}), ({'start': 3, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [3, 5], 'bucket-intersection': [1, 2], 'click-no-range': False, 'brush-domain-start': 3, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': 6, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [1, 6], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 6, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [2, 6], 'bucket-intersection': [1, 2], 'click-no-range': False, 'brush-domain-start': 2, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': -1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [-1, 0], 'bucket-intersection': [], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 0, 'brush-publish': False}), ({'start': -1, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [-1, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': True}), ({'start': -1, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [-1, 5], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 0, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 0], 'bucket-intersection': [], 'click-no-range': True, 'brush-domain-start': 0, 'brush-domain-end': 0, 'brush-publish': False})], 5: [({'start': 1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': False}), ({'start': 1, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [1, 1], 'bucket-intersection': [], 'click-no-range': True, 'brush-domain-start': 1, 'brush-domain-end': 1, 'brush-publish': False}), ({'start': 6, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [1, 6], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': 6, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [5, 6], 'bucket-intersection': [2], 'click-no-range': False, 'brush-domain-start': 5, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': -1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [-1, 0], 'bucket-intersection': [], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 0, 'brush-publish': True}), ({'start': -1, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [-1, 2], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 2, 'brush-publish': False}), ({'start': -1, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [-1, 5], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': 0, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': False}), ({'start': 0, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 2], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 2, 'brush-publish': True}), ({'start': 1, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [1, 5], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 5, 'brush-publish': False})]}
for index, (data, expected) in enumerate(fixtures[N]):
    check("contract fixture " + str(index), solve(data), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

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

N = 1
observations = []
def solve(d):
    return {'normalize-drag':([min(d['start'],d['end']),max(d['start'],d['end'])]), 'bucket-intersection':([i for i,(a,b) in enumerate(d['bins']) if a<max(d['start'],d['end']) and b>min(d['start'],d['end'])] if d['start']!=d['end'] else []), 'click-no-range':(False), 'brush-domain-start':(max(d['minimum'],min(d['start'],d['end']))), 'brush-domain-end':(min(d['maximum'],max(d['start'],d['end']))), 'brush-publish':(d['released'] and d['start']!=d['end'])}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'start': -1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [-1, 0], 'bucket-intersection': [], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 0, 'brush-publish': False}), ({'start': 1, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [1, 1], 'bucket-intersection': [], 'click-no-range': True, 'brush-domain-start': 1, 'brush-domain-end': 1, 'brush-publish': False}), ({'start': -1, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [-1, 5], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': 0, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': False}), ({'start': 0, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 2], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 2, 'brush-publish': True}), ({'start': 1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': False}), ({'start': 1, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [1, 5], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 3, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 3], 'bucket-intersection': [0, 1], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 3, 'brush-publish': True}), ({'start': 3, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [2, 3], 'bucket-intersection': [1], 'click-no-range': False, 'brush-domain-start': 2, 'brush-domain-end': 3, 'brush-publish': False}), ({'start': 3, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [3, 5], 'bucket-intersection': [1, 2], 'click-no-range': False, 'brush-domain-start': 3, 'brush-domain-end': 5, 'brush-publish': True})], 2: [({'start': -1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [-1, 0], 'bucket-intersection': [], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 0, 'brush-publish': True}), ({'start': 1, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [1, 1], 'bucket-intersection': [], 'click-no-range': True, 'brush-domain-start': 1, 'brush-domain-end': 1, 'brush-publish': False}), ({'start': 0, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 5], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': True}), ({'start': 1, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [1, 2], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 2, 'brush-publish': False}), ({'start': 1, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [1, 5], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': 3, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [1, 3], 'bucket-intersection': [0, 1], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 3, 'brush-publish': False}), ({'start': 3, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [2, 3], 'bucket-intersection': [1], 'click-no-range': False, 'brush-domain-start': 2, 'brush-domain-end': 3, 'brush-publish': True}), ({'start': 6, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 6], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 6, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [1, 6], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 5, 'brush-publish': True})], 3: [({'start': 0, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': False}), ({'start': 0, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 0], 'bucket-intersection': [], 'click-no-range': True, 'brush-domain-start': 0, 'brush-domain-end': 0, 'brush-publish': False}), ({'start': 1, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [1, 2], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 2, 'brush-publish': True}), ({'start': 3, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 3], 'bucket-intersection': [0, 1], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 3, 'brush-publish': False}), ({'start': 3, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [1, 3], 'bucket-intersection': [0, 1], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 3, 'brush-publish': True}), ({'start': 3, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [3, 5], 'bucket-intersection': [1, 2], 'click-no-range': False, 'brush-domain-start': 3, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 6, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 6], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': 6, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [2, 6], 'bucket-intersection': [1, 2], 'click-no-range': False, 'brush-domain-start': 2, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 6, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [5, 6], 'bucket-intersection': [2], 'click-no-range': False, 'brush-domain-start': 5, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': -1, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [-1, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': False})], 4: [({'start': 0, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': True}), ({'start': 0, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 0], 'bucket-intersection': [], 'click-no-range': True, 'brush-domain-start': 0, 'brush-domain-end': 0, 'brush-publish': False}), ({'start': 3, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [2, 3], 'bucket-intersection': [1], 'click-no-range': False, 'brush-domain-start': 2, 'brush-domain-end': 3, 'brush-publish': False}), ({'start': 3, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [3, 5], 'bucket-intersection': [1, 2], 'click-no-range': False, 'brush-domain-start': 3, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': 6, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [1, 6], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 6, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [2, 6], 'bucket-intersection': [1, 2], 'click-no-range': False, 'brush-domain-start': 2, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': -1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [-1, 0], 'bucket-intersection': [], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 0, 'brush-publish': False}), ({'start': -1, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [-1, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': True}), ({'start': -1, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [-1, 5], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 0, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 0], 'bucket-intersection': [], 'click-no-range': True, 'brush-domain-start': 0, 'brush-domain-end': 0, 'brush-publish': False})], 5: [({'start': 1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': False}), ({'start': 1, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [1, 1], 'bucket-intersection': [], 'click-no-range': True, 'brush-domain-start': 1, 'brush-domain-end': 1, 'brush-publish': False}), ({'start': 6, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [1, 6], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': 6, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [5, 6], 'bucket-intersection': [2], 'click-no-range': False, 'brush-domain-start': 5, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': -1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [-1, 0], 'bucket-intersection': [], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 0, 'brush-publish': True}), ({'start': -1, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [-1, 2], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 2, 'brush-publish': False}), ({'start': -1, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [-1, 5], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': 0, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': False}), ({'start': 0, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 2], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 2, 'brush-publish': True}), ({'start': 1, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [1, 5], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 5, 'brush-publish': False})]}
for index, (data, expected) in enumerate(fixtures[N]):
    check("contract fixture " + str(index), solve(data), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Only zero-width histogram gestures are treated as clicks is violated by the widget projection.

A histogram brush selects intersecting bucket identities over a half-open horizontal interval; clicks without width do not create a range and the final brush converts to domain edges. This example checks: Only zero-width histogram gestures are treated as clicks.

split: open-access


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

N = 1
observations = []
def solve(d):
    return {'normalize-drag':([min(d['start'],d['end']),max(d['start'],d['end'])]), 'bucket-intersection':([i for i,(a,b) in enumerate(d['bins']) if a<max(d['start'],d['end']) and b>min(d['start'],d['end'])] if d['start']!=d['end'] else []), 'click-no-range':(d['start']==d['end']), 'brush-domain-start':(min(d['start'],d['end'])), 'brush-domain-end':(min(d['maximum'],max(d['start'],d['end']))), 'brush-publish':(d['released'] and d['start']!=d['end'])}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'start': -1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [-1, 0], 'bucket-intersection': [], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 0, 'brush-publish': False}), ({'start': 3, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 3], 'bucket-intersection': [0, 1], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 3, 'brush-publish': True}), ({'start': -1, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [-1, 5], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': 0, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': False}), ({'start': 0, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 2], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 2, 'brush-publish': True}), ({'start': 1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': False}), ({'start': 1, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [1, 1], 'bucket-intersection': [], 'click-no-range': True, 'brush-domain-start': 1, 'brush-domain-end': 1, 'brush-publish': False}), ({'start': 1, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [1, 5], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 3, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [2, 3], 'bucket-intersection': [1], 'click-no-range': False, 'brush-domain-start': 2, 'brush-domain-end': 3, 'brush-publish': False}), ({'start': 3, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [3, 5], 'bucket-intersection': [1, 2], 'click-no-range': False, 'brush-domain-start': 3, 'brush-domain-end': 5, 'brush-publish': True})], 2: [({'start': -1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [-1, 0], 'bucket-intersection': [], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 0, 'brush-publish': True}), ({'start': 3, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [2, 3], 'bucket-intersection': [1], 'click-no-range': False, 'brush-domain-start': 2, 'brush-domain-end': 3, 'brush-publish': False}), ({'start': 0, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 5], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': True}), ({'start': 1, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [1, 2], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 2, 'brush-publish': False}), ({'start': 1, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [1, 5], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': 3, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [1, 3], 'bucket-intersection': [0, 1], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 3, 'brush-publish': False}), ({'start': 3, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [2, 3], 'bucket-intersection': [1], 'click-no-range': False, 'brush-domain-start': 2, 'brush-domain-end': 3, 'brush-publish': True}), ({'start': 6, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 6], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 6, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [1, 6], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 5, 'brush-publish': True})], 3: [({'start': -1, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [-1, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': False}), ({'start': 6, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 6], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': 1, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [1, 2], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 2, 'brush-publish': True}), ({'start': 3, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 3], 'bucket-intersection': [0, 1], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 3, 'brush-publish': False}), ({'start': 3, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [1, 3], 'bucket-intersection': [0, 1], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 3, 'brush-publish': True}), ({'start': 3, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [3, 5], 'bucket-intersection': [1, 2], 'click-no-range': False, 'brush-domain-start': 3, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 6, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [2, 6], 'bucket-intersection': [1, 2], 'click-no-range': False, 'brush-domain-start': 2, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 6, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [5, 6], 'bucket-intersection': [2], 'click-no-range': False, 'brush-domain-start': 5, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': -1, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [-1, 2], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 2, 'brush-publish': True}), ({'start': 0, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 0], 'bucket-intersection': [], 'click-no-range': True, 'brush-domain-start': 0, 'brush-domain-end': 0, 'brush-publish': False})], 4: [({'start': -1, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [-1, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': True}), ({'start': 6, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [2, 6], 'bucket-intersection': [1, 2], 'click-no-range': False, 'brush-domain-start': 2, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 3, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [2, 3], 'bucket-intersection': [1], 'click-no-range': False, 'brush-domain-start': 2, 'brush-domain-end': 3, 'brush-publish': False}), ({'start': 3, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [3, 5], 'bucket-intersection': [1, 2], 'click-no-range': False, 'brush-domain-start': 3, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': 6, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [1, 6], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 6, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [2, 6], 'bucket-intersection': [1, 2], 'click-no-range': False, 'brush-domain-start': 2, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': -1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [-1, 0], 'bucket-intersection': [], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 0, 'brush-publish': False}), ({'start': -1, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [-1, 5], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 0, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 0], 'bucket-intersection': [], 'click-no-range': True, 'brush-domain-start': 0, 'brush-domain-end': 0, 'brush-publish': False}), ({'start': 0, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 2], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 2, 'brush-publish': False})], 5: [({'start': -1, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [-1, 2], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 2, 'brush-publish': False}), ({'start': 6, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [5, 6], 'bucket-intersection': [2], 'click-no-range': False, 'brush-domain-start': 5, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': 6, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [1, 6], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': 6, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [5, 6], 'bucket-intersection': [2], 'click-no-range': False, 'brush-domain-start': 5, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': -1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [-1, 0], 'bucket-intersection': [], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 0, 'brush-publish': True}), ({'start': -1, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [-1, 5], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': 0, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': False}), ({'start': 0, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 2], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 2, 'brush-publish': True}), ({'start': 1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': False}), ({'start': 1, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [1, 1], 'bucket-intersection': [], 'click-no-range': True, 'brush-domain-start': 1, 'brush-domain-end': 1, 'brush-publish': False})]}
for index, (data, expected) in enumerate(fixtures[N]):
    check("contract fixture " + str(index), solve(data), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(d):
    return {'normalize-drag':([min(d['start'],d['end']),max(d['start'],d['end'])]), 'bucket-intersection':([i for i,(a,b) in enumerate(d['bins']) if a<max(d['start'],d['end']) and b>min(d['start'],d['end'])] if d['start']!=d['end'] else []), 'click-no-range':(d['start']==d['end']), 'brush-domain-start':(max(d['minimum'],d['start'])), 'brush-domain-end':(min(d['maximum'],max(d['start'],d['end']))), 'brush-publish':(d['released'] and d['start']!=d['end'])}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = {1: [({'start': -1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [-1, 0], 'bucket-intersection': [], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 0, 'brush-publish': False}), ({'start': 3, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 3], 'bucket-intersection': [0, 1], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 3, 'brush-publish': True}), ({'start': -1, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [-1, 5], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': 0, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': False}), ({'start': 0, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 2], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 2, 'brush-publish': True}), ({'start': 1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': False}), ({'start': 1, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [1, 1], 'bucket-intersection': [], 'click-no-range': True, 'brush-domain-start': 1, 'brush-domain-end': 1, 'brush-publish': False}), ({'start': 1, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [1, 5], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 3, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [2, 3], 'bucket-intersection': [1], 'click-no-range': False, 'brush-domain-start': 2, 'brush-domain-end': 3, 'brush-publish': False}), ({'start': 3, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [3, 5], 'bucket-intersection': [1, 2], 'click-no-range': False, 'brush-domain-start': 3, 'brush-domain-end': 5, 'brush-publish': True})], 2: [({'start': -1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [-1, 0], 'bucket-intersection': [], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 0, 'brush-publish': True}), ({'start': 3, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [2, 3], 'bucket-intersection': [1], 'click-no-range': False, 'brush-domain-start': 2, 'brush-domain-end': 3, 'brush-publish': False}), ({'start': 0, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 5], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': True}), ({'start': 1, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [1, 2], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 2, 'brush-publish': False}), ({'start': 1, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [1, 5], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': 3, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [1, 3], 'bucket-intersection': [0, 1], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 3, 'brush-publish': False}), ({'start': 3, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [2, 3], 'bucket-intersection': [1], 'click-no-range': False, 'brush-domain-start': 2, 'brush-domain-end': 3, 'brush-publish': True}), ({'start': 6, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 6], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 6, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [1, 6], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 5, 'brush-publish': True})], 3: [({'start': -1, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [-1, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': False}), ({'start': 6, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 6], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': 1, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [1, 2], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 2, 'brush-publish': True}), ({'start': 3, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 3], 'bucket-intersection': [0, 1], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 3, 'brush-publish': False}), ({'start': 3, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [1, 3], 'bucket-intersection': [0, 1], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 3, 'brush-publish': True}), ({'start': 3, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [3, 5], 'bucket-intersection': [1, 2], 'click-no-range': False, 'brush-domain-start': 3, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 6, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [2, 6], 'bucket-intersection': [1, 2], 'click-no-range': False, 'brush-domain-start': 2, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 6, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [5, 6], 'bucket-intersection': [2], 'click-no-range': False, 'brush-domain-start': 5, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': -1, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [-1, 2], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 2, 'brush-publish': True}), ({'start': 0, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 0], 'bucket-intersection': [], 'click-no-range': True, 'brush-domain-start': 0, 'brush-domain-end': 0, 'brush-publish': False})], 4: [({'start': -1, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [-1, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': True}), ({'start': 6, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [2, 6], 'bucket-intersection': [1, 2], 'click-no-range': False, 'brush-domain-start': 2, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 3, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [2, 3], 'bucket-intersection': [1], 'click-no-range': False, 'brush-domain-start': 2, 'brush-domain-end': 3, 'brush-publish': False}), ({'start': 3, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [3, 5], 'bucket-intersection': [1, 2], 'click-no-range': False, 'brush-domain-start': 3, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': 6, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [1, 6], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 6, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [2, 6], 'bucket-intersection': [1, 2], 'click-no-range': False, 'brush-domain-start': 2, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': -1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [-1, 0], 'bucket-intersection': [], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 0, 'brush-publish': False}), ({'start': -1, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [-1, 5], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': 0, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 0], 'bucket-intersection': [], 'click-no-range': True, 'brush-domain-start': 0, 'brush-domain-end': 0, 'brush-publish': False}), ({'start': 0, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 2], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 2, 'brush-publish': False})], 5: [({'start': -1, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [-1, 2], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 2, 'brush-publish': False}), ({'start': 6, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [5, 6], 'bucket-intersection': [2], 'click-no-range': False, 'brush-domain-start': 5, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': 6, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [1, 6], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 1, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': 6, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [5, 6], 'bucket-intersection': [2], 'click-no-range': False, 'brush-domain-start': 5, 'brush-domain-end': 5, 'brush-publish': False}), ({'start': -1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [-1, 0], 'bucket-intersection': [], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 0, 'brush-publish': True}), ({'start': -1, 'end': 5, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [-1, 5], 'bucket-intersection': [0, 1, 2], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 5, 'brush-publish': True}), ({'start': 0, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': False}), ({'start': 0, 'end': 2, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [0, 2], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 2, 'brush-publish': True}), ({'start': 1, 'end': 0, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': False}, {'normalize-drag': [0, 1], 'bucket-intersection': [0], 'click-no-range': False, 'brush-domain-start': 0, 'brush-domain-end': 1, 'brush-publish': False}), ({'start': 1, 'end': 1, 'bins': [[0, 2], [2, 4], [4, 6]], 'minimum': 0, 'maximum': 5, 'released': True}, {'normalize-drag': [1, 1], 'bucket-intersection': [], 'click-no-range': True, 'brush-domain-start': 1, 'brush-domain-end': 1, 'brush-publish': False})]}
for index, (data, expected) in enumerate(fixtures[N]):
    check("contract fixture " + str(index), solve(data), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Brush lower bounds clamp to the domain after drag normalization is violated by the widget projection.

A histogram brush selects intersecting bucket identities over a half-open horizontal interval; clicks without width do not create a range and the final brush converts to domain edges. This example checks: Brush lower bounds clamp to the domain after drag normalization.

split: open-access