Exemple #1
0
    def test_one_key_one_value_cpc_win(self):
        param = {('CPC','GREEN','NDP','LIBERAL'):1}
        param_expected = {('CPC','GREEN','NDP','LIBERAL'):1}

        result = vs.voting_irv(param)
        result_expected = ('CPC', None)

        self.assertEqual(param, param_expected,
                         "Dict parameter should be {0}, but is {1}".format(
                            param_expected, param))

        self.assertEqual(result, result_expected,
                "Voting Irv should return {0}, but returned {1}".format(
                            result_expected, result))
Exemple #2
0
    def test_multiple_keys_multiple_values_liberal_win(self):

        param = {('LIBERAL','NDP','CPC','GREEN'):4,
                 ('CPC','GREEN','LIBERAL','NDP'):2}
        param_expected = {('LIBERAL','NDP','CPC','GREEN'):4,
                         ('CPC','GREEN','LIBERAL','NDP'):2}

        result = vs.voting_irv(param)
        result_expected = ('LIBERAL', None)

        self.assertEqual(param, param_expected,
                         "Dict parameter should be {0}, but is {1}".format(
                            param_expected, param))

        self.assertEqual(result, result_expected,
                "Voting Irv should return {0}, but returned {1}".format(
                            result_expected, result))