+from unittest import TestCase
+
+from pseudoku.grid import Grid
+
+class SudokuTestCase(TestCase):
+ """TestCase subclass that provides some convenience methods for testing
+ sudoku puzzles.
+ """
+
+ def assertSolvable(self, grid, msg=None):
+ """Asserts that the given puzzle, when run through Grid.solve(),
+ produces a filled grid.
+
+ grid may be either a Grid object or a string.
+ """
+
+ if type(grid) == str:
+ grid = Grid.from_string(grid)
+
+ grid.solve()
+ self.assertTrue(grid.filled, msg)