def test_store_played_game_known_player(self): tournament = Tournament() tournament.register_player("player1") tournament.store_played_game(PlayedGame("player1", 17)) self.assertEqual(tournament.played_games, [PlayedGame("player1", 17)])
def test_leaderboard_games_played_ordered_by_points(self): tournament = Tournament() tournament.register_player("player1") tournament.register_player("player2") tournament.store_played_game(PlayedGame("player1", 15)) tournament.store_played_game(PlayedGame("player2", 18)) self.assertEqual(tournament.leaderboard(), [Rank("player2", 18), Rank("player1", 15)])