コード例 #1
0
 def test_words_has_same_length_method(self):
     word_ladder = WordLadder(
         os.path.join(word_lists_dir, 'word_lists', 'linux_english_words'))
     eq_(word_ladder.words_has_same_length(), None)
     word_ladder.start = '1234'
     eq_(word_ladder.words_has_same_length(), None)
     word_ladder.end = '1234'
     eq_(word_ladder.words_has_same_length(), True)
     word_ladder.start = '12345'
     eq_(word_ladder.words_has_same_length(), False)
コード例 #2
0
 def test_find_path_if_words_are_defined_trough_instance_variables(self):
     word_ladder = WordLadder(
         os.path.join(word_lists_dir, 'word_lists',
                      'linux_english_words_length_4'))
     word_ladder.start = 'sail'
     word_ladder.end = 'fear'
     eq_(word_ladder.find_path(),
         ['sail', 'hail', 'hair', 'heir', 'hear', 'fear'])