def generic_recursive_equality_test(a, b, class_history):
 dict_a = a.__dict__
 dict_b = b.__dict__
 for key in dict_a:
  assert (key in dict_b), u'Did not pickle {0}'.format(key)
  if hasattr(dict_a[key], u'__eq__'):
   eq = (dict_a[key] == dict_b[key])
   if (u'__iter__' in dir(eq)):
    eq = (False not in eq)
   assert eq, u'Value of {0} changed by pickling'.format(key)
  if hasattr(dict_a[key], u'__dict__'):
   if (dict_a[key].__class__ in class_history):
    pass
   else:
    new_class_history = [dict_a[key].__class__]
    new_class_history.extend(class_history)
    generic_recursive_equality_test(dict_a[key], dict_b[key], new_class_history)

def generic_recursive_equality_test ( a , b , class_history ) : dict_a = a . __dict__ dict_b = b . __dict__ for key in dict_a : assert ( key in dict_b ) , u'Did not pickle {0}' . format ( key ) if hasattr ( dict_a [ key ] , u'__eq__' ) : eq = ( dict_a [ key ] == dict_b [ key ] ) if ( u'__iter__' in dir ( eq ) ) : eq = ( False not in eq ) assert eq , u'Value of {0} changed by pickling' . format ( key ) if hasattr ( dict_a [ key ] , u'__dict__' ) : if ( dict_a [ key ] . __class__ in class_history ) : pass else : new_class_history = [ dict_a [ key ] . __class__ ] new_class_history . extend ( class_history ) generic_recursive_equality_test ( dict_a [ key ] , dict_b [ key ] , new_class_history )
check if the attributes of a and b are equal .