def compareEvents(test, actualEvents, expectedEvents):
 if (len(actualEvents) != len(expectedEvents)):
  test.assertEqual(actualEvents, expectedEvents)
 allMergedKeys = set()
 for event in expectedEvents:
  allMergedKeys |= set(event.keys())
 def simplify(event):
  copy = event.copy()
  for key in event.keys():
   if (key not in allMergedKeys):
    copy.pop(key)
  return copy
 simplifiedActual = [simplify(event) for event in actualEvents]
 test.assertEqual(simplifiedActual, expectedEvents)

def compareEvents ( test , actualEvents , expectedEvents ) : if ( len ( actualEvents ) != len ( expectedEvents ) ) : test . assertEqual ( actualEvents , expectedEvents ) allMergedKeys = set ( ) for event in expectedEvents : allMergedKeys |= set ( event . keys ( ) ) def simplify ( event ) : copy = event . copy ( ) for key in event . keys ( ) : if ( key not in allMergedKeys ) : copy . pop ( key ) return copy simplifiedActual = [ simplify ( event ) for event in actualEvents ] test . assertEqual ( simplifiedActual , expectedEvents )
compare two sequences of log events .