def test_uncover_word_with_misses_and_guesses(): word = _uncover_word('Python', '******', 'y') assert word == '*y****' word = _uncover_word('Python', '*y****', 'z') # Miss! assert word == '*y****' word = _uncover_word('Python', '*y****', 'n') assert word == '*y***n' word = _uncover_word('Python', '*y***n', 'o') assert word == '*y**on' word = _uncover_word('Python', '*y**on', 'x') # Miss! assert word == '*y**on' word = _uncover_word('Python', '*y**on', 'a') # Miss! assert word == '*y**on'
def test_uncover_word_with_all_equal_characters(): word = _uncover_word('aaa', '***', 'a') assert word == 'aaa'
def test_uncover_word_with_repeated_elements(): word = _uncover_word('rmotr', '*****', 'r') assert word == 'r***r'
def test_uncover_word_with_miss_character(): word = _uncover_word('Python', '******', 'z') assert word == '******'
def test_uncover_word_with_correct_character(): word = _uncover_word('Python', '******', 'y') assert word == '*y****'
def test_uncover_word_with_invalid_masked_word(): """Length of words is different""" with pytest.raises(InvalidWordException): _uncover_word('aaa', '**********', 'x')
def test_uncover_word_is_case_insensitive_same_case(): word = _uncover_word('Python', '******', 'P') assert word == 'p*****'
def test_uncover_word_with_empty_word(): """Words are empty""" with pytest.raises(InvalidWordException): _uncover_word('', '', 'x')
def test_uncover_word_is_case_insensitive_different_case(): word = _uncover_word('Python', '******', 'p') assert word == 'p*****'
def test_uncover_word_with_invalid_character(): """Character to guess has len() > 1""" with pytest.raises(InvalidGuessedLetterException): _uncover_word('aaa', '***', 'xyz')