def test_seven_wrong_guesses_should_end_game(self): """Test method.""" game = GuessingGame("secret") game.guess('a') game.guess('b') game.guess('d') game.guess('f') game.guess('g') game.guess('h') game.guess('i') assert not game.in_progress
def test_seven_wrong_guesses_should_lose(self): """Test method.""" game = GuessingGame("secret") game.guess('a') game.guess('b') game.guess('d') game.guess('f') game.guess('g') game.guess('h') game.guess('i') assert game.lost
def test_guessing_same_character_should_not_count(self): """Test method.""" game = GuessingGame("secret") game.guess('s') assert len(game.guesses) == 1 game.guess('s') assert len(game.guesses) == 1 game.guess('a') assert game.wrong_guesses == 1 game.guess('a') assert game.wrong_guesses == 1
def test_correct_guesses_should_win(self): """Test method.""" game = GuessingGame("secret") game.guess('s') game.guess('e') game.guess('c') game.guess('r') # game.guess('e') game.guess('t') assert game.won
def test_correct_guesses_should_end_game(self): """Test method.""" game = GuessingGame("secret") game.guess('s') game.guess('e') game.guess('c') game.guess('r') # game.guess('e') game.guess('t') assert not game.in_progress
def test_wrong_guesses_should_increment_wrong_guesses(self): """Test method.""" game = GuessingGame("secret") game.guess('a') assert game.wrong_guesses == 1 game.guess('b') assert game.wrong_guesses == 2 game.guess('d') assert game.wrong_guesses == 3 game.guess('f') assert game.wrong_guesses == 4 game.guess('g') assert game.wrong_guesses == 5 game.guess('h') assert game.wrong_guesses == 6
def test_guesses_should_be_added_to_previous_guesses(self, guess): """Test method.""" game = GuessingGame("secret") game.guess(guess) assert guess in game.guesses
def test_guesses_should_be_case_insensitive(self): """Test method.""" game = GuessingGame("secret") assert game.guess('s') == GuessResult.CORRECT assert game.guess('E') == GuessResult.CORRECT
def test_multiple_guess_should_return_multiple(self, guess): """Test method.""" game = GuessingGame("secret") game.guess(guess) assert game.guess(guess) == GuessResult.MULTIPLE
def test_incorrect_guess_should_return_incorrect(self, guess): """Test method.""" game = GuessingGame("secret") assert game.guess(guess) == GuessResult.INCORRECT
def test_guess_should_be_a_letter(self, guess): """Test method.""" game = GuessingGame("secret") assert game.guess(guess) == GuessResult.NOTLEGAL