Commits

Anonymous committed a824b82

Replaced home-made unordered-list comparison function by set comparison

Comments (0)

Files changed (2)

djangotoolbox/test.py

         """
         current_state = object_list_to_table(columns,
             self.model.all())[1:]
-        if not equal_lists(current_state, state_table):
+        if set(current_state) != set(state_table):
             print 'DB state not valid:'
             print 'Current state:'
             print columns

djangotoolbox/utils.py

     result.update([(key, data[key]) for key in attrs])
     return result
 
-def equal_lists(left, right):
-    """
-    Compares two lists and returs True if they contain the same elements, but
-    doesn't require that they have the same order.
-    """
-    right = list(right)
-    if len(left) != len(right):
-        return False
-    for item in left:
-        if item in right:
-            del right[right.index(item)]
-        else:
-            return False
-    return True
-
 def object_list_to_table(headings, dict_list):
     """
     Converts objects to table-style list of rows with heading: