Documented constraints.diagonal test more better.
[pseudoku.git] / pseudoku / tests / __init__.py
1 from unittest import TestCase
2
3 from pseudoku.grid import Grid
4
5 class SudokuTestCase(TestCase):
6 """TestCase subclass that provides some convenience methods for testing
7 sudoku puzzles.
8 """
9
10 def assertSolvable(self, grid, msg=None):
11 """Asserts that the given puzzle, when run through Grid.solve(),
12 produces a filled grid.
13
14 grid may be either a Grid object or a string.
15 """
16
17 if type(grid) == str:
18 grid = Grid.from_string(grid)
19
20 grid.solve()
21 self.assertTrue(grid.filled, msg)