def __init__(self, player): """Initialize variables""" self.player = player self.guesses = 0 self.bad_guesses = [] self.secret_word = Hangman.gen_rand_word(self, 4, 6) self.blank_word = Hangman.gen_blank_word(self, self.secret_word)
def test_rand_word_gen(self): """Test that the secret word is converted into underscores and coverted to string""" secret_word = 'test' blank_word = len(secret_word) * '_' blank_word = list(blank_word) blank_word = ''.join(blank_word) self.assertTrue(Hangman.gen_blank_word(secret_word) == blank_word)