Documented constraints.diagonal test more better.
[pseudoku.git] / pseudoku / tests / constraints / diagonal.py
1 from pseudoku.grid import Grid
2 from pseudoku.grid.constraints import Diagonal
3
4 from pseudoku.tests import SudokuTestCase
5
6 class DiagonalGridTestCase(SudokuTestCase):
7 """Tests that grids with extra Diagonal constraints are solved."""
8
9 def test_main_diagonals(self):
10 """Tests an easy puzzle with constraints along both main diagonals."""
11
12 grid = Grid.from_string("""
13 3...2...7 ...3.1... ..6...4..
14 89.....54 4...5...8 61.....32
15 ..8...2.. ...5.9... 1...6...9
16 """)
17 grid.add_constraint(Diagonal(grid, direction='down', offset=0))
18 grid.add_constraint(Diagonal(grid, direction='up', offset=0))
19 self.assertSolvable(grid, "Main diagonals (Color Sudoku, page 8)")