Пример #1
0
def test_game_submit_solution_without_anyone_playing():
    # given
    player = "Davide"
    solution = [[]]

    # when and then
    game = Game()
    game.add_player(player=player)
    expected_msg = "^Game has not started yet, draw first$"
    with pytest.raises(errors.WordylibError, match=expected_msg):
        game.submit(player=player, solution=solution)
Пример #2
0
def test_game_submit_solution_overusing_drawn_letters(solution):
    # given
    random.seed(100)
    player = "Davide"

    # when and then
    game = Game()
    game.add_player(player=player)
    game.draw()
    expected_msg = r"^Some letters were used too many times \(.*\)$"
    with pytest.raises(errors.InvalidSubmission, match=expected_msg):
        game.submit(player=player, solution=solution)
Пример #3
0
def two_round_game():
    random.seed(100)
    player1 = "Davide"
    player2 = "Cherry"

    game = Game()
    game.add_player(player=player1)
    game.add_player(player=player2)
    game.draw()
    game.submit(
        player=player2,
        solution=[["A", "r", "I", "A"], [" ", "I", " ", " "],
                  [" ", "M", "U", "D"]],
    )
    game.draw()
    game.submit(player=player2, solution=[["S", "O"]])
    return game