def test_merge_events():
 events_orig = [[1, 0, 1], [3, 0, 2], [10, 0, 3], [20, 0, 4]]
 events_replacement = [[1, 0, 12], [3, 0, 12], [10, 0, 34], [20, 0, 34]]
 events_no_replacement = [[1, 0, 1], [1, 0, 12], [1, 0, 1234], [3, 0, 2], [3, 0, 12], [3, 0, 1234], [10, 0, 3], [10, 0, 34], [10, 0, 1234], [20, 0, 4], [20, 0, 34], [20, 0, 1234]]
 for (replace_events, events_good) in [(True, events_replacement), (False, events_no_replacement)]:
  events = merge_events(events_orig, [1, 2], 12, replace_events)
  events = merge_events(events, [3, 4], 34, replace_events)
  events = merge_events(events, [1, 2, 3, 4], 1234, replace_events)
  assert_array_equal(events, events_good)

def test_merge_events ( ) : events_orig = [ [ 1 , 0 , 1 ] , [ 3 , 0 , 2 ] , [ 10 , 0 , 3 ] , [ 20 , 0 , 4 ] ] events_replacement = [ [ 1 , 0 , 12 ] , [ 3 , 0 , 12 ] , [ 10 , 0 , 34 ] , [ 20 , 0 , 34 ] ] events_no_replacement = [ [ 1 , 0 , 1 ] , [ 1 , 0 , 12 ] , [ 1 , 0 , 1234 ] , [ 3 , 0 , 2 ] , [ 3 , 0 , 12 ] , [ 3 , 0 , 1234 ] , [ 10 , 0 , 3 ] , [ 10 , 0 , 34 ] , [ 10 , 0 , 1234 ] , [ 20 , 0 , 4 ] , [ 20 , 0 , 34 ] , [ 20 , 0 , 1234 ] ] for ( replace_events , events_good ) in [ ( True , events_replacement ) , ( False , events_no_replacement ) ] : events = merge_events ( events_orig , [ 1 , 2 ] , 12 , replace_events ) events = merge_events ( events , [ 3 , 4 ] , 34 , replace_events ) events = merge_events ( events , [ 1 , 2 , 3 , 4 ] , 1234 , replace_events ) assert_array_equal ( events , events_good )
test event merging .