def test_tennis_score(self):
     test_cases = [
         (0, 0, "Love-All"),
         (1, 1, "Fifteen-All"),
         (2, 2, "Thirty-All"),
         (3, 3, "Fourty-All"),
     ]
     for p1_points, p2_points, expected_score in test_cases:
         # self.subTest is necessary, actually creates sub tests that you can see in test runner
         with self.subTest(f"This is a test for {expected_score}"):
             self.assertEqual(expected_score,
                              tennis_score(p1_points, p2_points))
    def assert_tennis_score(self, expected_score, player1_points,
                            player2_points):
        """
        A custom assert test

        Example:
            expected_score = "Deuce"
            player1_points = 3
            player2_points = 3
        """
        self.assertEqual(expected_score,
                         tennis_score(player1_points, player2_points))
Beispiel #3
0
def test_tennis_score(expected_score, player1_points, player2_points, comment):
    """
    Parametrized test, which produces a many test cases based on the test data
    We could pull test data out of the data out of the database or
    a spreasheet, or some other kind of text file.

    Args:
        expected_score: a data that test should returns
        player1_points: a score of the first player
        player2_points: a score of the second player
        comment: a relevant test name, which used for description
    """
    assert expected_score == tennis_score(player1_points, player2_points)
Beispiel #4
0
 def assert_tennis_score(self, expected_score, score1, score2):
     self.assertEqual(expected_score, tennis_score(score1, score2))
Beispiel #5
0
 def assert_tennis_score(self, expected_score, player1_points,
                         player2_points):
     self.assertEqual(expected_score,
                      tennis_score(player1_points, player2_points))
Beispiel #6
0
def test_early_game_scores_equal(expected_score, player1_points, player2_points):
    assert expected_score == tennis_score(player1_points, player2_points)
    assert 'Love-All' == tennis_score(0, 0)
    assert 'Fifteen-All' == tennis_score(1, 1)
    assert 'Thirty-All' == tennis_score(2, 2)
Beispiel #7
0
def test_early_game_scores_equal_ordinary():
    assert "Love-All" == tennis_score(0, 0)
    assert "Fifteen-All" == tennis_score(1, 1)
    assert "Thirty-All" == tennis_score(2, 2)
Beispiel #8
0
def test_early_game_scores_equal(expected_score, player1_points,
                                 player2_points):
    assert expected_score == tennis_score(player1_points, player2_points)
Beispiel #9
0
def assert_tennis_score(expected_score, player1_points, player2_points):
    assert expected_score == tennis_score(player1_points,player2_points)
Beispiel #10
0
def test_early_game_scores_equal(expected, player1, player2, comment):
    assert expected == tennis_score(player1, player2), comment
def test_tennis_scores(expected_score, player1_points, player2_points,
                       comment):
    assert expected_score == tennis_score(player1_points, player2_points)
Beispiel #12
0
 def assert_tennis_score(self, expected_score, player1_points, player2_points):
     self.assertEqual(expected_score, tennis_score(player1_points, player2_points))
Beispiel #13
0
def test_tennis_scores(expected_score, player1_points, player2_points, comment):
    assert expected_score == tennis_score(player1_points, player2_points)
def test_early_game_scores_equal(expected_score, player_one_score, player_two_score):
    assert expected_score == tennis_score(player_one_score, player_two_score)
def test_score_tennis(p1_points, p2_points, expected_score):
    assert tennis_score(p1_points, p2_points) == expected_score