Exemple #1
0
    def test_winner_player_two(self):
        game = TieBreakGame("player 1", "player 2")

        for _ in range(self.MINIMUM_POINTS + self.MINIMUM_LEAD):
            game.point_won_by("player 2")

        self.assertEqual(game.winner(), "player 2")
Exemple #2
0
    def test_score_with_mixed_points(self):
        game = TieBreakGame("player 1", "player 2")
        game.point_won_by("player 2")
        game.point_won_by("player 1")
        game.point_won_by("player 2")
        game.point_won_by("player 2")
        game.point_won_by("player 2")

        self.assertEqual(game.score(), "1-4")
Exemple #3
0
    def test_score_with_player_one_points(self):
        game = TieBreakGame("player 1", "player 2")
        game.point_won_by("player 1")
        game.point_won_by("player 1")
        game.point_won_by("player 1")

        self.assertEqual(game.score(), "3-0")
Exemple #4
0
    def test_player_two_wins_closest_possible_tiebreaker(self):
        game = TieBreakGame("player 1", "player 2")
        for _ in range(5):
            game.point_won_by("player 1")

        for _ in range(7):
            game.point_won_by("player 2")

        self.assertEqual(game.winner(), "player 2")
Exemple #5
0
    def test_score_is_empty_when_game_is_won(self):
        game = TieBreakGame("player 1", "player 2")
        for _ in range(self.MINIMUM_POINTS + self.MINIMUM_LEAD):
            game.point_won_by("player 2")

        self.assertEqual(game.score(), "")
Exemple #6
0
    def test_score_with_no_points(self):
        game = TieBreakGame("player 1", "player 2")

        self.assertEqual(game.score(), "0-0")
Exemple #7
0
    def test_initial_winner(self):
        game = TieBreakGame("player 1", "player 2")

        self.assertIsNone(game.winner())