class __cmp__(unittest.TestCase): """ Test cases of __cmp__ """ def setUp(self): """ Build the Action for the test """ self.action1 = BuildBattleAction(priority = 1) self.action2 = BuildBattleAction(priority = 0) def notImplemented(self): """ Test that it returns NotImplemented """ cmp = self.action1.__cmp__(1) assert cmp is NotImplemented, "Should be NotImplemented" def sortList(self): """ Test that it sorts a list properly """ actions = [self.action1, self.action2] actions.sort() assert actions[0] is self.action2, "Should put low priority action to the front" assert actions[1] is self.action1, "Should put high priority action to the back"