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')
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')
def test_when_the_player_who_has_the_ADVANTAGE_loose_the_point_then_the_score_is_DEUCE( self): tennis = Tennis() tennis.game = (4, 3) tennis.player2_win_point() self.assertEqual(tennis.score_game(), '40:40') self.assertTrue(tennis.deuce_activated(), 'The deuce rule is activated')
def test_when_the_player_who_has_the_ADVANTAGE_win_the_point_then_he_win_the_game( self): tennis = Tennis() tennis.game = (4, 3) tennis.player1_win_point() self.assertEqual(tennis.score_game(), 'WIN GAME:40') self.assertFalse(tennis.deuce_activated(), 'The deuce rule is activated')
def test_when_score_is_DEUCE_and_when_player_1_win_the_point_then_player_1_take_the_ADVANTAGE( self): tennis = Tennis() tennis.game = (3, 3) tennis.player1_win_point() self.assertEqual(tennis.score_game(), 'ADV:40') self.assertTrue(tennis.deuce_activated(), 'The deuce rule is activated')
def test_2_players_reach_the_score_40_then_the_DEUCE_rule_is_activated( self): tennis = Tennis() tennis.game = (3, 2) tennis.player2_win_point() self.assertEqual(tennis.score_game(), '40:40') self.assertTrue(tennis.deuce_activated(), 'The deuce rule is activated')