コード例 #1
0
 def test_subregion_constraints(self):
     grid = SudokuGrid()
     grid.set(1, 1, 1)
     for (x, y) in [(0, 0), (0, 2), (2, 0), (2, 2)]:
         try:
             grid.set(x, y, 1)
             self.fail(
                 "Trying to assign a 1 to ({}, {}) should have resulted in an exception"
                 .format(x, y))
         except SudokuError:
             pass
コード例 #2
0
 def test_col_constraints(self):
     grid = SudokuGrid()
     grid.set(0, 0, 1)
     for y in range(grid.GRID_SIZE):
         try:
             grid.set(0, y, 1)
             self.fail(
                 "Trying to assign a 1 to ({}, {}) should have resulted in an exception"
                 .format(0, y))
         except SudokuError:
             pass