def test_copy_funkction_works_properly(): # GIVEN sample_array = np.array([ [0, 0, 0], [0, 5, 0], [1, 0, 0], ]) sample_sudoku = Sudoku(sample_array) # WHEN copied_sudoku = sample_sudoku.copy() # THEN assert np.all(copied_sudoku.array == sample_sudoku.array) assert np.all( copied_sudoku._possibles.matrix == sample_sudoku._possibles.matrix)
def test_copy_function_return_independent_copy(): # GIVEN sample_array = np.array([ [0, 0, 0], [0, 5, 0], [1, 0, 0], ]) sample_sudoku = Sudoku(sample_array) # WHEN copied_sudoku = sample_sudoku.copy() copied_sudoku[0, 0] = 5 copied_sudoku.update() # THEN assert np.any(copied_sudoku.array != sample_sudoku.array) assert np.any( copied_sudoku._possibles.matrix != sample_sudoku._possibles.matrix)