예제 #1
0
    def test_write_results_failure(self, mock_logger):
        expected_results = OrderedDict()
        expected_results['DIAMOND'] = [(7, 1), (1, 1)]

        ws = WordSearch('data/farm.pzl')
        ws.read()
        ws.solve()
        ws.write()
예제 #2
0
    def test_write_results_valid(self):
        expected_results = [
            'CHICKEN Not Found \n', 'COW (4, 6) (2, 6) \n',
            'PIG (11, 6) (11, 4) \n'
        ]

        ws = WordSearch('data/farm.pzl')
        ws.read()
        ws.solve()
        ws.write()

        with open(ws.file_name + '.out', 'rw') as f:
            data = f.readlines()
            self.assertEquals(data, expected_results)
예제 #3
0
    def test_solve_valid_data(self):
        expected_results = OrderedDict()
        expected_results['DICTIONARY'] = [(1, 5), (1, 14)]
        expected_results['INTEGER'] = 'Not Found'
        expected_results['LIST'] = 'Not Found'
        expected_results['PIP'] = [(6, 10), (8, 10)]
        expected_results['PYTHON'] = [(15, 14), (10, 14)]
        expected_results['STRING'] = 'Not Found'
        expected_results['TUPLE'] = [(8, 6), (8, 2)]

        ws = WordSearch('data/python.pzl')
        ws.read()
        ws.solve()
        self.assertEquals(ws.results, expected_results)