def test_find(self): word_ladder.checkUserInput() word_ladder.findWords() word_ladder.find(word_ladder.start, word_ladder.words, word_ladder.seen, word_ladder.target, word_ladder.path) self.assertEqual(word_ladder.paths, [['lead', 'load', 'goad', 'gold']])
def test_build0(self): word_ladder.checkUserInput() word_ladder.findWords() self.assertEqual( word_ladder.build0('lead', word_ladder.words, word_ladder.seen), [ 'bead', 'dead', 'head', 'leaf', 'leak', 'leal', 'lean', 'leap', 'lear', 'leas', 'lend', 'leud', 'lewd', 'load', 'mead', 'read' ])
def test_findWorld_len(self): word_ladder.checkUserInput() word_ladder.findWords() self.assertEqual(word_ladder.words.__len__(), 3862)
def test_checkUserInput(self): word_ladder.fname = 'dictionary.txt' word_ladder.start = 'lead' word_ladder.target = 'gold' word_ladder.steps = 3 self.assertTrue(word_ladder.checkUserInput())
def test_isInDictionary_False(self): word_ladder.checkUserInput() self.assertTrue(word_ladder.isInDictionary('wordttt'))
def test_checkUserInput_others_error(self): word_ladder.fname = '' word_ladder.start = '' word_ladder.target = '' word_ladder.steps = '' self.assertFalse(word_ladder.checkUserInput())
def test_checkUserInput_target_not_in_file(self): word_ladder.fname = 'dictionary.txt' word_ladder.start = 'llll' word_ladder.target = 'gold' word_ladder.steps = 3 self.assertFalse(word_ladder.checkUserInput())
def test_checkUserInput_number_in_word(self): word_ladder.fname = 'dictionary.txt' word_ladder.start = 'are1' word_ladder.target = 'gold' word_ladder.steps = 3 self.assertFalse(word_ladder.checkUserInput())
def test_checkUserInput_not_found_file(self): word_ladder.fname = 'xxx.txt' word_ladder.start = 'lead' word_ladder.target = 'gold' word_ladder.steps = 3 self.assertFalse(word_ladder.checkUserInput())
def test_checkUserInput_Different_length(self): word_ladder.fname = 'dictionary.txt' word_ladder.start = 'hello' word_ladder.target = 'gold' word_ladder.steps = 3 self.assertFalse(word_ladder.checkUserInput())