Documented constraints.diagonal test more better.
[pseudoku.git] / pseudoku / tests / __init__.py
index e69de29..3821889 100644 (file)
@@ -0,0 +1,21 @@
+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)