Skip to content

Commit

Permalink
use parametrize for v1-6 (but not 7 bc score text is different)
Browse files Browse the repository at this point in the history
  • Loading branch information
hjwp committed Sep 13, 2024
1 parent fa54acc commit 300fed6
Showing 1 changed file with 13 additions and 40 deletions.
53 changes: 13 additions & 40 deletions python/tennis_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,50 +11,23 @@


@pytest.mark.parametrize(
"p1_points p2_points score p1_name p2_name".split(), test_cases
)
def test_get_score_game1(p1_points, p2_points, score, p1_name, p2_name):
game = play_game(TennisGame1, p1_points, p2_points, p1_name, p2_name)
assert score == game.score()


@pytest.mark.parametrize(
"p1_points p2_points score p1_name p2_name".split(), test_cases
)
def test_get_score_game2(p1_points, p2_points, score, p1_name, p2_name):
game = play_game(TennisGame2, p1_points, p2_points, p1_name, p2_name)
assert score == game.score()


@pytest.mark.parametrize(
"p1_points p2_points score p1_name p2_name".split(), test_cases
)
def test_get_score_game3(p1_points, p2_points, score, p1_name, p2_name):
game = play_game(TennisGame3, p1_points, p2_points, p1_name, p2_name)
assert score == game.score()


@pytest.mark.parametrize(
"p1_points p2_points score p1_name p2_name".split(), test_cases
)
def test_get_score_game4(p1_points, p2_points, score, p1_name, p2_name):
game = play_game(TennisGame4, p1_points, p2_points, p1_name, p2_name)
assert score == game.score()


@pytest.mark.parametrize(
"p1_points p2_points score p1_name p2_name".split(), test_cases
"TennisGameClass",
[
TennisGame1,
TennisGame2,
TennisGame3,
TennisGame4,
TennisGame5,
TennisGame6,
],
)
def test_get_score_game5(p1_points, p2_points, score, p1_name, p2_name):
game = play_game(TennisGame5, p1_points, p2_points, p1_name, p2_name)
assert score == game.score()


@pytest.mark.parametrize(
"p1_points p2_points score p1_name p2_name".split(), test_cases
)
def test_get_score_game6(p1_points, p2_points, score, p1_name, p2_name):
game = play_game(TennisGame6, p1_points, p2_points, p1_name, p2_name)
def test_get_score_most_games(
TennisGameClass, p1_points, p2_points, score, p1_name, p2_name
):
game = play_game(TennisGameClass, p1_points, p2_points, p1_name, p2_name)
assert score == game.score()


Expand Down

0 comments on commit 300fed6

Please sign in to comment.