def test_is_not_solution(): """Verify that wrong solutions are invalid""" for k in sudoku_solutions: # modify solution, check that is_solution fails not_solution = deepcopy(sudoku_solutions[k]) # swap two elements not_solution[3][4], not_solution[3][3] = not_solution[3][3], not_solution[3][4] assert not sudoku.is_solution(not_solution, sudoku_problems[k])
def test_is_not_solution(self): """Verify that wrong solutions are invalid""" for k in sudoku_solutions: # modify solution, check that is_solution fails not_solution = deepcopy(sudoku_solutions[k]) # swap two elements not_solution[3][4], not_solution[3][3] = not_solution[3][3], not_solution[3][4] self.assertFalse(sudoku.is_solution(not_solution, sudoku_problems[k]))
def test_is_solution_to_problem(self): """Check that is_solution control that solution is a solution for the problem at hand.""" self.assertFalse(sudoku.is_solution(sudoku_solutions[TEST_KEYS[0]], sudoku_problems[TEST_KEYS[1]]))
def test_is_solution(self): """Verify that solutions to given problems are valid""" for k in sudoku_solutions: self.assertTrue(sudoku.is_solution(sudoku_solutions[k], sudoku_problems[k]))
def test_is_solution_to_problem(): """Check that is_solution control that solution is a solution to the problem at hand, not come other problem.""" assert not sudoku.is_solution(sudoku_solutions[TEST_KEYS[0]], sudoku_problems[TEST_KEYS[1]])