def test_status_as_dict_1(self): status_dict = { 'candidate': 'D', 'votes': 7, 'nbr_round': 2, 'status': K.STATUS_DEFEATED } test_status = status.Status(status_dict) self.assertEqual(test_status.as_dict(), status_dict)
def _tabulate_setup(self): """ Create instance values needed to tabulate IRV or STV """ self.tallies = {candidate: [] for candidate in self.candidates} self.tallies.update(self.other_categories()) self.ballots_for = {tab_code: [] for tab_code in self.tallies} self.status = {candidate: status.Status(candidate, self.zero_votes()) for candidate in self.candidates} self.nbr_round = 0
def test_status_create_4(self): status_dict = { 'candidate': 'D', 'votes': 7, 'nbr_round': 2, 'status': K.STATUS_DEFEATED } test_status = status.Status(status_dict) self.assertEqual(test_status.candidate, 'D') self.assertEqual(test_status.votes, 7) self.assertEqual(test_status.nbr_round, 2) self.assertEqual(test_status.status, K.STATUS_DEFEATED)
def test_status_create_3(self): test_status = status.Status('C', K.ONE * 5, 3, K.STATUS_ELECTED) self.assertEqual(test_status.candidate, 'C') self.assertEqual(test_status.votes, K.Decimal(5)) self.assertEqual(test_status.nbr_round, 3) self.assertEqual(test_status.status, K.STATUS_ELECTED)
def test_status_create_2(self): test_status = status.Status('B', K.ZERO) self.assertEqual(test_status.candidate, 'B') self.assertEqual(test_status.votes, K.ZERO) self.assertEqual(test_status.nbr_round, None) self.assertEqual(test_status.status, K.STATUS_CONTINUING)
def make_status_2(self): return status.Status('F', K.ONE * 17, 3, K.STATUS_CONTINUING)
def make_status_1(self): return status.Status('E', 13, 4, K.STATUS_ELECTED)