X-Git-Url: http://git.veekun.com/pseudoku.git/blobdiff_plain/bbf0c8e40c0b3205d7e8e0ec83e13374a0bf7f56..1ebfc79f097b15fd37d3441344148a77c541ae08:/pseudoku/tests/__init__.py diff --git a/pseudoku/tests/__init__.py b/pseudoku/tests/__init__.py index e69de29..3821889 100644 --- a/pseudoku/tests/__init__.py +++ b/pseudoku/tests/__init__.py @@ -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)