def test_guess_not_success(): game = create_game() result = game.guess('d') assert not result assert game.guess_count == 1 assert 'd' in game.guessed_letters assert game.get_current_state() == '_' * len(game.answer)
def test_guess_success(): game = create_game() answer = game.answer result = game.guess(answer[0]) assert result assert game.guess_count == 0 assert answer[0] in game.guessed_letters assert game.get_current_state().startswith(answer[0])
def create_digin_game(): deck = choose_existent_deck() create_game(deck.id, MODE_FRONT2REVER)
def test_get_result_win(attempts_number): game = create_game() game.guess_count = attempts_number answer = game.answer game.guessed_letters = list(answer) assert game.get_result() == Result.WIN
def test_get_result_continue(attempts_number): game = create_game() game.guess_count = attempts_number assert game.get_result() == Result.CONTINUE
def test_get_result_fail(attempts_number): game = create_game() game.guess_count = attempts_number assert game.get_result() == Result.FAIL
def test_guess_game_over(): game = create_game() game.guess_count = MAX_AMOUNT_OF_ATTEMPS + 1 with pytest.raises(ValueError): game.guess("a")
def test_guess_not_a_letter(): game = create_game() with pytest.raises(ValueError): game.guess("1")
def test_create_game(): game = create_game() assert game.answer in WORDS_LIST assert game.guess_count == 0 assert game.guessed_letters == []