1 from pseudoku
.grid
import Grid
2 from pseudoku
.grid
.constraints
import Diagonal
4 from pseudoku
.tests
import SudokuTestCase
6 class DiagonalGridTestCase(SudokuTestCase
):
7 """Tests that grids with extra Diagonal constraints are solved."""
9 def test_main_diagonals(self
):
10 """Tests an easy puzzle with constraints along both main diagonals."""
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
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)")