Now, Nose only reports one failed test, the check to see whether the original
schedules instance and the one loaded from the file are equal. The problem here is that, once again, there's a need to redefine what it means to be equal.
That can be fixed by adding the following to the definition of
def __eq__(self, other): if len(self.tasks) != len(other.tasks): return False left_tasks = list(self.tasks) left_tasks.sort(key = (lambda task: task.begins)) right_tasks = list(other.tasks) right_tasks.sort(key = (lambda task: task.begins)) return tuple(left_tasks) == tuple(right_tasks) def __ne__(self, other): return not self.__eq__(other)
key parameter of
sort was added in Python 2.4. Prior to that version, ...