def testIfTryToUpdateDataInAnInvalidColumnThenShouldTrowAnException(self): sudoku = SudokuBoard() try: sudoku.set_value('A', 10, '5') self.fail("Did not raise the exception InvalidColumnException") except InvalidColumnException: pass
def testWhenTryToSetAnInvalidValueThehnShouldRaiseanException(self): sudoku = SudokuBoard(3) try: sudoku.set_value('C', 2, '5') self.fail("Did not raise the exception InvalidParameterValueException") except InvalidParameterValueException: pass
def testWhenTrySetDateInCorrectAndNonEditableCellThenShouldThrownAnException(self): sudoku = SudokuBoard(3) sudoku.set_editable('C', 2, False) try: sudoku.set_value('C', 2, '2') self.fail("Did not raise the exception CellNotEditableException") except CellNotEditableException: pass
def test_given_a_sudoku_table_then_should_convert_it_to_dictionary(self): sudoku = SudokuBoard(3) rows = ['A', 'B', 'C'] cols = range(1, 4) for row in rows: for col in cols: sudoku.set_value(row, col, self.dic_with_data[row + str(col)]) dictionary = sudoku.to_dictionary() self.assertDictEqual(self.dic_with_data, dictionary)
def testWhenTrySetDataInCorrectAndEditableCellThenShouldSetDataProperly(self): sudoku = SudokuBoard(3) sudoku.set_value('C', 2, '2') self.assertEqual('2', sudoku.dic['C2'].get_value())
def testIfTryToAddDataInRightCellThenShouldAddTheDataProperly(self): sudoku = SudokuBoard(18) sudoku.set_value('B', 2, '5') self.assertEqual('5', sudoku.dic['B2'].get_value())