Esempio n. 1
0
    def test_when_score_is_6_6_and_when_p2_win_2_set_then_p2_win_the_set(self):
        tennis = Tennis()
        tennis.set = (6, 6)
        tennis.game = (0, 3)

        tennis.player2_win_point()

        self.assertEqual(tennis.score_set(), '0:0')
        self.assertEqual(tennis.score_match(), '6:7, 0:0')
Esempio n. 2
0
    def test_when_p1_and_p2_have_5_and_p1_win_the_set_then_a_other_game_in_the_set_should_be_played(
            self):
        tennis = Tennis()
        tennis.set = (5, 5)
        tennis.game = (3, 0)

        tennis.player1_win_point()

        self.assertEqual(tennis.score_match(), '6:5')
        self.assertEqual(tennis.score_set(), '6:5')
Esempio n. 3
0
    def test_set_evolution(self):
        tennis = Tennis()

        for i in range(1, 5):
            tennis.player1_win_point()  # 15
            tennis.player1_win_point()  # 30
            tennis.player1_win_point()  # 40
            tennis.player1_win_point()  # WIN

            self.assertEqual(tennis.score_match(), '%d:0' % i)
            self.assertEqual(tennis.score_set(), '%d:0' % i)
Esempio n. 4
0
    def test_when_the_set_starts_then_the_set_score_is_0_game_for_each_player(
            self):
        tennis = Tennis()

        score = tennis.score_set()
        self.assertEqual(score, '0:0')