コード例 #1
0
    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)])
コード例 #2
0
    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)])
コード例 #3
0
    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)])