Turned original test puzzle into a real testcase.
[pseudoku.git] / pseudoku / tests / integrity / simple.py
1 from unittest import TestCase
2
3 from pseudoku.grid import Grid
4
5 class SimpleGridTestCase(TestCase):
6 """Tests the solving integrity of some puzzles that can be solved using
7 only elimination and uniqueness.
8 """
9
10 def _test_single_puzzle(self, puzzle, msg=None):
11 """Solves a single puzzle and verifies that the result is, at least,
12 not incorrect.
13 """
14
15 grid = Grid.from_string(puzzle)
16 grid.solve()
17 self.assertTrue(grid.is_filled(), msg)
18
19 def test_simple(self):
20 self._test_single_puzzle("""
21 ...69.... 9.5..876. ..4..1.2.
22 6...5...3 38.....49 7...3...2
23 .7.9..3.. .231..4.8 ....83...
24 """)