def test_add_challenger(self): m1 = Challenger("Kakouak", "lol") m2 = Challenger("Kakouik", "lol") m3 = Challenger("Kikouak", "lol") m4 = Challenger("Kikouik", "lol") g = Group([m1, m2], "Test adding challengers") g.give_point(m1, 203) g.give_point(m2, 22) g.add_challenger(m4, 19) g.sort_challengers_by_points() self.assertSequenceEqual(g.challengers, [m1, m2, m4]) g.add_challenger(m3, 184) g.sort_challengers_by_points() self.assertSequenceEqual(g.challengers, [m1, m3, m2, m4])
def test_get_loser(self): m1 = Challenger("Kakouak", "lol") m2 = Challenger("Kakouik", "lol") m3 = Challenger("Kikouak", "lol") m4 = Challenger("Kikouik", "lol") g = Group([m1, m2, m3, m4], "Test getting loser") g.give_point(m1, 203) self.assertNotEqual(g.loser, m1) g.give_point(m2, 22) g.give_point(m3, 13) g.give_point(m4, 17) g.give_point(m4, 2) self.assertEqual(g.loser, m3) g.give_point(m3, 184) self.assertEqual(g.loser, m4)
def test_remove_challenger(self): m1 = Challenger("Kakouak", "lol") m2 = Challenger("Kakouik", "lol") m3 = Challenger("Kikouak", "lol") m4 = Challenger("Kikouik", "lol") g = Group([m1, m2, m3, m4], "Test removing challengers") g.give_point(m1, 203) g.give_point(m2, 22) g.give_point(m3, 13) g.remove_challenger(m4) g.sort_challengers_by_points() self.assertSetEqual(set(g.challengers), {m1, m2, m3}) g.remove_challenger(m3) g.sort_challengers_by_points() self.assertSetEqual(set(g.challengers), {m1, m2})
def test_give_point(self): m1 = Challenger("Kakouak", "lol") m2 = Challenger("Kakouik", "lol") m3 = Challenger("Kikouak", "lol") m4 = Challenger("Kikouik", "lol") g = Group([m1, m2, m3, m4], "Test giving points") g.give_point(m1, 203) self.assertEqual(g.scores[m1], 203) self.assertEqual(g.scores[m2], 0) self.assertEqual(g.scores[m3], 0) self.assertEqual(g.scores[m4], 0) g.give_point(m2, 22) g.give_point(m3, 13) g.give_point(m4, 17) g.give_point(m4, 2) self.assertEqual(g.scores[m1], 203) self.assertEqual(g.scores[m2], 22) self.assertEqual(g.scores[m3], 13) self.assertEqual(g.scores[m4], 19)
def test_get_points(self): m1 = Challenger("Kakouak", "lol") m2 = Challenger("Kakouik", "lol") m3 = Challenger("Kikouak", "lol") m4 = Challenger("Kikouik", "lol") g = Group([m1, m2, m3, m4], "Test getting points") g.give_point(m1, 203) self.assertEqual(g.get_points(m1), 203) self.assertEqual(g.get_points(m2), 0) self.assertEqual(g.get_points(m3), 0) self.assertEqual(g.get_points(m4), 0) g.give_point(m2, 22) g.give_point(m3, 13) g.give_point(m4, 17) g.give_point(m4, 2) self.assertEqual(g.get_points(m1), 203) self.assertEqual(g.get_points(m2), 22) self.assertEqual(g.get_points(m3), 13) self.assertEqual(g.get_points(m4), 19)