def test_update(self): board = self.easy_board s = Sodoku(board) i, j = s.get_feasible_ordered()[0] f = s.find_feasible(i, j) s.update(i, j, next(iter(f))) self.assertTrue(s.is_valid()) return
#!/usr/bin/python from sodoku import Sodoku sodoku = Sodoku()
def test_solve000(self): board = self.easy_board s = solve(Sodoku(board)) self.assertTrue(s.is_solved()) self.assertTrue(verify_solves(s, board)) return
def test_feasible(self): board = self.easy_board s = Sodoku(board) feasible = set(s.find_feasible(4, 4)) self.assertEqual(feasible, {3, 7, 8}) return
def test_copy(self): board = self.easy_board s = Sodoku(board) s.copy() return
def test_valid_001(self): board = self.easy_board s = Sodoku(board) self.assertTrue(s.is_valid()) return
def test_valid_002(self): board = self.invalid_board s = Sodoku(board) self.assertFalse(s.is_valid()) return
def test_iter_col(self): board = self.easy_board s = Sodoku(board) self.assertTrue({1, 5, 9, 6}, set(s.get_fixed(s.iter_col(4)))) return
def test_iter_box(self): board = self.easy_board s = Sodoku(board) self.assertTrue({4, 5, 2}, set(s.get_fixed(s.iter_box(4, 4)))) return
def test_iter_row(self): board = self.easy_board s = Sodoku(board) self.assertTrue({2, 5, 4}, set(s.get_fixed(s.iter_row(4)))) return
def test000(self): board = self.easy_board str(Sodoku(board)) return
def test_solve_ai_se(self): board = ai_SE_board s = solve(Sodoku(board)) self.assertTrue(s.is_solved()) self.assertTrue(verify_solves(s, board)) return
def test_solve_min_clues(self): board = min_clues_board s = solve(Sodoku(board)) self.assertTrue(s.is_solved()) self.assertTrue(verify_solves(s, board)) return
def test_solve006(self): board = board006 s = solve(Sodoku(board)) self.assertTrue(s.is_solved()) self.assertTrue(verify_solves(s, board)) return