Esempio n. 1
0
class TestFindWords(object):
    def setup(self):
        self.grid = Grid([['A', 'B', 'C'],
                          ['D', 'E', 'F'],
                          ['G', 'H', 'I']])

        self.words = ['FED', 'CAB', 'GAD', 'BID', 'HIGH']

    def test_no_wrap(self):
        indices = self.grid.find_words(self.words, False)
        print indices
        assert indices == [((1, 2), (1, 0)),
                           None,
                           None,
                           None,
                           None]

    def test_wrap(self):
        indices = self.grid.find_words(self.words, True)
        assert indices == [((1, 2), (1, 0)),
                           ((0, 2), (0, 1)),
                           ((2, 0), (1, 0)),
                           ((0, 1), (1, 0)),
                           None]